You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@skywalking.apache.org by wu...@apache.org on 2026/10/18 08:52:56 UTC
(skywalking-horizon-ui) branch main updated: feat(conversation-view): show where a model call's history changed (#202)
This is an automated email from the ASF dual-hosted git repository.
wu-sheng pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/skywalking-horizon-ui.git
The following commit(s) were added to refs/heads/main by this push:
new d5830a15 feat(conversation-view): show where a model call's history changed (#202)
d5830a15 is described below
commit d5830a1502e2c405c0ab4530b6f953f931048b03
Author: 吴晟 Wu Sheng <wu...@foxmail.com>
AuthorDate: Sun Oct 18 16:52:50 2026 +0800
feat(conversation-view): show where a model call's history changed (#202)
The AI Sessionizer now compares each model call's history with the call
before it, and where the history changed it draws a history.change step
just before the call (apache/skywalking-ai-sessionizer#77).
- The transcript and the flow timeline draw that step as a card of its
own, dashed and in a colour no other kind uses. It says how many
messages were kept, changed, dropped and added, whether their order or
the system prompt changed, and what became of the earlier call's
reply. Clicking it selects the call it stands before. It is no context
reset, and the page says reset only where a reset is recorded.
- The Prompt tab's "What changed" mode says what the Sessionizer found,
instead of comparing two bodies by position. A Claude Code request
that continues a provider thread holds only its new messages, so the
old comparison read every such request as a rewritten history or as
"the context was replaced by a summary". A kept history shows what the
call added; a changed one marks each message kept, changed or added
where the pairing is certain, and lists what was dropped. A first call
after a reset says so, and a summary only when the reset has one.
- The prompt store reads a request's message list as the Sessionizer
reads it.
- 29 new texts in all eight locales; five unused ones removed.
---
apps/ui/src/i18n/locales/de.json | 32 +-
apps/ui/src/i18n/locales/en.json | 32 +-
apps/ui/src/i18n/locales/es.json | 32 +-
apps/ui/src/i18n/locales/fr.json | 32 +-
apps/ui/src/i18n/locales/ja.json | 32 +-
apps/ui/src/i18n/locales/ko.json | 32 +-
apps/ui/src/i18n/locales/pt.json | 32 +-
apps/ui/src/i18n/locales/zh-CN.json | 32 +-
.../layer/ai-conversation/conversationStrings.ts | 35 +-
docs/changelog/1.1.0.md | 6 +-
docs/operate/ai-agent-conversations.md | 19 +-
packages/conversation-view/src/model.ts | 24 +-
packages/conversation-view/src/prompt/messages.ts | 104 +-
packages/conversation-view/src/prompt/store.ts | 100 +-
packages/conversation-view/src/strings.ts | 68 +-
packages/conversation-view/src/styles.css | 16 +
packages/conversation-view/src/view/history.ts | 65 +
packages/conversation-view/src/view/prompt.ts | 275 +++--
packages/conversation-view/src/view/timeline.ts | 2 +-
packages/conversation-view/src/view/transcript.ts | 6 +-
packages/conversation-view/src/vocabulary.ts | 4 +-
.../test/fixtures/history/forget.json | 746 +++++++++++
.../test/fixtures/history/forget.sd | 10 +
.../test/fixtures/history/reset.json | 1294 ++++++++++++++++++++
.../test/fixtures/history/reset.sd | 16 +
.../test/fixtures/history/threads.json | 1016 +++++++++++++++
.../test/fixtures/history/threads.sd | 14 +
.../conversation-view/test/prompt-guards.test.ts | 92 +-
.../conversation-view/test/prompt-history.test.ts | 429 +++++++
.../test/prompt-langchain.test.ts | 6 +-
.../conversation-view/test/prompt-panel.test.ts | 81 +-
.../conversation-view/test/prompt-store.test.ts | 3 +-
32 files changed, 4323 insertions(+), 364 deletions(-)
diff --git a/apps/ui/src/i18n/locales/de.json b/apps/ui/src/i18n/locales/de.json
index 3eafc099..8c2b564d 100644
--- a/apps/ui/src/i18n/locales/de.json
+++ b/apps/ui/src/i18n/locales/de.json
@@ -3289,21 +3289,41 @@
"How much of the request to show": "Wie viel von der Anfrage gezeigt wird",
"Whole request": "Ganze Anfrage",
"The body": "Der Körper",
- "What it added": "Was hinzukam",
- "The request before this one is not among the loaded bodies, so there is nothing to compare with.": "Die vorherige Anfrage gehört nicht zu den geladenen Körpern, es gibt also nichts zum Vergleichen.",
- "This request names no request before it, so there is nothing to compare with.": "Diese Anfrage nennt keine vorherige Anfrage, es gibt also nichts zum Vergleichen.",
"System prompt": "System-Prompt",
"Tools ({count})": "Werkzeuge ({count})",
"Messages ({count})": "Nachrichten ({count})",
"{bytes} bytes as sent": "{bytes} Bytes wie gesendet",
"Settings": "Einstellungen",
"{count} block(s), {bytes} bytes": "{count} Block/Blöcke, {bytes} Bytes",
- "The {count} message(s) before are as the call before sent them, {bytes} bytes.": "Die {count} vorherigen Nachrichten sind so, wie der vorige Aufruf sie sendete, {bytes} Bytes.",
- "The history before this point was rewritten, and not by a compaction.": "Der Verlauf vor diesem Punkt wurde neu geschrieben, und nicht durch eine Verdichtung.",
- "The context was replaced by a summary here, so the list starts again: {before} message(s) became {after}.": "Der Kontext wurde hier durch eine Zusammenfassung ersetzt, die Liste beginnt neu: aus {before} Nachricht(en) wurden {after}.",
"Also changed: {what}.": "Ebenfalls geändert: {what}.",
"Added by this call ({count})": "Von diesem Aufruf hinzugefügt ({count})",
"This request adds no message.": "Diese Anfrage fügt keine Nachricht hinzu.",
+ "What changed": "Was sich geändert hat",
+ "History changed · cause unavailable": "Verlauf geändert · Ursache nicht verfügbar",
+ "{kept} kept, {changed} changed, {dropped} dropped, {added} added": "{kept} behalten, {changed} geändert, {dropped} entfernt, {added} hinzugefügt",
+ "the order changed": "die Reihenfolge hat sich geändert",
+ "whether the order changed is not known": "ob sich die Reihenfolge geändert hat, ist nicht bekannt",
+ "the system prompt changed": "der System-Prompt hat sich geändert",
+ "the previous reply is included unchanged": "die vorige Antwort ist unverändert enthalten",
+ "the previous reply is included with changes": "die vorige Antwort ist geändert enthalten",
+ "the previous reply was not found in this history": "die vorige Antwort ist in diesem Verlauf nicht zu finden",
+ "whether the previous reply is included is not known": "ob die vorige Antwort enthalten ist, ist nicht bekannt",
+ "This is the first call of its stream since the context began, so there is nothing to compare with.": "Dies ist der erste Aufruf seines Streams, seit der Kontext begann, daher gibt es nichts zu vergleichen.",
+ "The context was reset here, so there is nothing before this call to compare with.": "Hier wurde der Kontext zurückgesetzt, daher gibt es vor diesem Aufruf nichts zu vergleichen.",
+ "The context was reset here and replaced by a summary, so there is nothing before this call to compare with.": "Hier wurde der Kontext zurückgesetzt und durch eine Zusammenfassung ersetzt, daher gibt es vor diesem Aufruf nichts zu vergleichen.",
+ "A call of an auxiliary stream is not compared with the calls around it.": "Ein Aufruf eines Hilfsstreams wird nicht mit den Aufrufen um ihn herum verglichen.",
+ "The framework made this call for its own purpose, so it is not compared with the calls around it.": "Das Framework hat diesen Aufruf für eigene Zwecke gemacht, daher wird er nicht mit den Aufrufen um ihn herum verglichen.",
+ "This history cannot be compared with the call before it: {why}.": "Dieser Verlauf kann nicht mit dem vorigen Aufruf verglichen werden: {why}.",
+ "This request does not record its history, so there is nothing to compare with.": "Diese Anfrage hält ihren Verlauf nicht fest, daher gibt es nichts zu vergleichen.",
+ "The history of the call before is kept whole: its {count} message(s) come first, as it sent them.": "Der Verlauf des vorigen Aufrufs bleibt ganz erhalten: seine {count} Nachricht(en) kommen zuerst, wie er sie gesendet hat.",
+ "The history of the call before is kept whole.": "Der Verlauf des vorigen Aufrufs bleibt ganz erhalten.",
+ "The history of the call before changed:": "Der Verlauf des vorigen Aufrufs hat sich geändert:",
+ "whether the system prompt changed is not known": "ob sich der System-Prompt geändert hat, ist nicht bekannt",
+ "This request continues a provider thread: it holds only its new messages, and the provider keeps the rest.": "Diese Anfrage setzt einen Thread des Anbieters fort: Sie enthält nur ihre neuen Nachrichten, den Rest behält der Anbieter.",
+ "Dropped from the call before ({count})": "Aus dem vorigen Aufruf entfernt ({count})",
+ "kept": "behalten",
+ "changed": "geändert",
+ "added": "hinzugefügt",
"stopped: {reason}": "beendet: {reason}",
"Thinking": "Denken",
"Injected by the runtime": "Von der Laufzeit eingefügt",
diff --git a/apps/ui/src/i18n/locales/en.json b/apps/ui/src/i18n/locales/en.json
index 9e043193..7e502154 100644
--- a/apps/ui/src/i18n/locales/en.json
+++ b/apps/ui/src/i18n/locales/en.json
@@ -3289,21 +3289,41 @@
"How much of the request to show": "How much of the request to show",
"Whole request": "Whole request",
"The body": "The body",
- "What it added": "What it added",
- "The request before this one is not among the loaded bodies, so there is nothing to compare with.": "The request before this one is not among the loaded bodies, so there is nothing to compare with.",
- "This request names no request before it, so there is nothing to compare with.": "This request names no request before it, so there is nothing to compare with.",
"System prompt": "System prompt",
"Tools ({count})": "Tools ({count})",
"Messages ({count})": "Messages ({count})",
"{bytes} bytes as sent": "{bytes} bytes as sent",
"Settings": "Settings",
"{count} block(s), {bytes} bytes": "{count} block(s), {bytes} bytes",
- "The {count} message(s) before are as the call before sent them, {bytes} bytes.": "The {count} message(s) before are as the call before sent them, {bytes} bytes.",
- "The history before this point was rewritten, and not by a compaction.": "The history before this point was rewritten, and not by a compaction.",
- "The context was replaced by a summary here, so the list starts again: {before} message(s) became {after}.": "The context was replaced by a summary here, so the list starts again: {before} message(s) became {after}.",
"Also changed: {what}.": "Also changed: {what}.",
"Added by this call ({count})": "Added by this call ({count})",
"This request adds no message.": "This request adds no message.",
+ "What changed": "What changed",
+ "History changed · cause unavailable": "History changed · cause unavailable",
+ "{kept} kept, {changed} changed, {dropped} dropped, {added} added": "{kept} kept, {changed} changed, {dropped} dropped, {added} added",
+ "the order changed": "the order changed",
+ "whether the order changed is not known": "whether the order changed is not known",
+ "the system prompt changed": "the system prompt changed",
+ "the previous reply is included unchanged": "the previous reply is included unchanged",
+ "the previous reply is included with changes": "the previous reply is included with changes",
+ "the previous reply was not found in this history": "the previous reply was not found in this history",
+ "whether the previous reply is included is not known": "whether the previous reply is included is not known",
+ "This is the first call of its stream since the context began, so there is nothing to compare with.": "This is the first call of its stream since the context began, so there is nothing to compare with.",
+ "The context was reset here, so there is nothing before this call to compare with.": "The context was reset here, so there is nothing before this call to compare with.",
+ "The context was reset here and replaced by a summary, so there is nothing before this call to compare with.": "The context was reset here and replaced by a summary, so there is nothing before this call to compare with.",
+ "A call of an auxiliary stream is not compared with the calls around it.": "A call of an auxiliary stream is not compared with the calls around it.",
+ "The framework made this call for its own purpose, so it is not compared with the calls around it.": "The framework made this call for its own purpose, so it is not compared with the calls around it.",
+ "This history cannot be compared with the call before it: {why}.": "This history cannot be compared with the call before it: {why}.",
+ "This request does not record its history, so there is nothing to compare with.": "This request does not record its history, so there is nothing to compare with.",
+ "The history of the call before is kept whole: its {count} message(s) come first, as it sent them.": "The history of the call before is kept whole: its {count} message(s) come first, as it sent them.",
+ "The history of the call before is kept whole.": "The history of the call before is kept whole.",
+ "The history of the call before changed:": "The history of the call before changed:",
+ "whether the system prompt changed is not known": "whether the system prompt changed is not known",
+ "This request continues a provider thread: it holds only its new messages, and the provider keeps the rest.": "This request continues a provider thread: it holds only its new messages, and the provider keeps the rest.",
+ "Dropped from the call before ({count})": "Dropped from the call before ({count})",
+ "kept": "kept",
+ "changed": "changed",
+ "added": "added",
"stopped: {reason}": "stopped: {reason}",
"Thinking": "Thinking",
"Injected by the runtime": "Injected by the runtime",
diff --git a/apps/ui/src/i18n/locales/es.json b/apps/ui/src/i18n/locales/es.json
index 060a4578..41ecb108 100644
--- a/apps/ui/src/i18n/locales/es.json
+++ b/apps/ui/src/i18n/locales/es.json
@@ -3289,21 +3289,41 @@
"How much of the request to show": "Cuánto de la solicitud mostrar",
"Whole request": "Solicitud completa",
"The body": "El cuerpo",
- "What it added": "Lo que añadió",
- "The request before this one is not among the loaded bodies, so there is nothing to compare with.": "La solicitud anterior no está entre los cuerpos cargados, así que no hay con qué comparar.",
- "This request names no request before it, so there is nothing to compare with.": "Esta solicitud no indica ninguna solicitud anterior, así que no hay con qué comparar.",
"System prompt": "Prompt del sistema",
"Tools ({count})": "Herramientas ({count})",
"Messages ({count})": "Mensajes ({count})",
"{bytes} bytes as sent": "{bytes} bytes tal como se enviaron",
"Settings": "Ajustes",
"{count} block(s), {bytes} bytes": "{count} bloque(s), {bytes} bytes",
- "The {count} message(s) before are as the call before sent them, {bytes} bytes.": "Los {count} mensajes anteriores son como los envió la llamada anterior, {bytes} bytes.",
- "The history before this point was rewritten, and not by a compaction.": "El historial anterior a este punto se reescribió, y no por una compactación.",
- "The context was replaced by a summary here, so the list starts again: {before} message(s) became {after}.": "Aquí el contexto se sustituyó por un resumen, así que la lista vuelve a empezar: {before} mensaje(s) pasaron a ser {after}.",
"Also changed: {what}.": "También cambió: {what}.",
"Added by this call ({count})": "Añadido por esta llamada ({count})",
"This request adds no message.": "Esta solicitud no añade ningún mensaje.",
+ "What changed": "Qué cambió",
+ "History changed · cause unavailable": "Historial cambiado · causa no disponible",
+ "{kept} kept, {changed} changed, {dropped} dropped, {added} added": "{kept} conservado(s), {changed} cambiado(s), {dropped} quitado(s), {added} añadido(s)",
+ "the order changed": "el orden cambió",
+ "whether the order changed is not known": "no se sabe si el orden cambió",
+ "the system prompt changed": "el prompt del sistema cambió",
+ "the previous reply is included unchanged": "la respuesta anterior está incluida sin cambios",
+ "the previous reply is included with changes": "la respuesta anterior está incluida con cambios",
+ "the previous reply was not found in this history": "la respuesta anterior no está en este historial",
+ "whether the previous reply is included is not known": "no se sabe si la respuesta anterior está incluida",
+ "This is the first call of its stream since the context began, so there is nothing to compare with.": "Es la primera llamada de su flujo desde que empezó el contexto, así que no hay nada con qué comparar.",
+ "The context was reset here, so there is nothing before this call to compare with.": "Aquí se reinició el contexto, así que no hay nada antes de esta llamada con qué comparar.",
+ "The context was reset here and replaced by a summary, so there is nothing before this call to compare with.": "Aquí se reinició el contexto y se sustituyó por un resumen, así que no hay nada antes de esta llamada con qué comparar.",
+ "A call of an auxiliary stream is not compared with the calls around it.": "Una llamada de un flujo auxiliar no se compara con las llamadas que la rodean.",
+ "The framework made this call for its own purpose, so it is not compared with the calls around it.": "El framework hizo esta llamada para su propio fin, así que no se compara con las llamadas que la rodean.",
+ "This history cannot be compared with the call before it: {why}.": "Este historial no se puede comparar con la llamada anterior: {why}.",
+ "This request does not record its history, so there is nothing to compare with.": "Esta solicitud no registra su historial, así que no hay nada con qué comparar.",
+ "The history of the call before is kept whole: its {count} message(s) come first, as it sent them.": "El historial de la llamada anterior se conserva entero: sus {count} mensaje(s) van primero, tal como los envió.",
+ "The history of the call before is kept whole.": "El historial de la llamada anterior se conserva entero.",
+ "The history of the call before changed:": "El historial de la llamada anterior cambió:",
+ "whether the system prompt changed is not known": "no se sabe si el prompt del sistema cambió",
+ "This request continues a provider thread: it holds only its new messages, and the provider keeps the rest.": "Esta solicitud continúa un hilo del proveedor: solo contiene sus mensajes nuevos, y el proveedor guarda el resto.",
+ "Dropped from the call before ({count})": "Quitados de la llamada anterior ({count})",
+ "kept": "conservado",
+ "changed": "cambiado",
+ "added": "añadido",
"stopped: {reason}": "detenido: {reason}",
"Thinking": "Razonamiento",
"Injected by the runtime": "Insertado por el runtime",
diff --git a/apps/ui/src/i18n/locales/fr.json b/apps/ui/src/i18n/locales/fr.json
index 55dbb60e..29999d78 100644
--- a/apps/ui/src/i18n/locales/fr.json
+++ b/apps/ui/src/i18n/locales/fr.json
@@ -3289,21 +3289,41 @@
"How much of the request to show": "Quelle part de la requête afficher",
"Whole request": "Requête entière",
"The body": "Le corps",
- "What it added": "Ce qu’il a ajouté",
- "The request before this one is not among the loaded bodies, so there is nothing to compare with.": "La requête précédente ne fait pas partie des corps chargés ; il n’y a rien à comparer.",
- "This request names no request before it, so there is nothing to compare with.": "Cette requête ne désigne aucune requête précédente ; il n’y a rien à comparer.",
"System prompt": "Prompt système",
"Tools ({count})": "Outils ({count})",
"Messages ({count})": "Messages ({count})",
"{bytes} bytes as sent": "{bytes} octets tels qu’envoyés",
"Settings": "Réglages",
"{count} block(s), {bytes} bytes": "{count} bloc(s), {bytes} octets",
- "The {count} message(s) before are as the call before sent them, {bytes} bytes.": "Les {count} messages précédents sont tels que l’appel précédent les a envoyés, {bytes} octets.",
- "The history before this point was rewritten, and not by a compaction.": "L’historique antérieur à ce point a été réécrit, et pas par un compactage.",
- "The context was replaced by a summary here, so the list starts again: {before} message(s) became {after}.": "Le contexte a été remplacé ici par un résumé, la liste recommence donc : {before} message(s) sont devenus {after}.",
"Also changed: {what}.": "A aussi changé : {what}.",
"Added by this call ({count})": "Ajouté par cet appel ({count})",
"This request adds no message.": "Cette requête n’ajoute aucun message.",
+ "What changed": "Ce qui a changé",
+ "History changed · cause unavailable": "Historique modifié · cause non disponible",
+ "{kept} kept, {changed} changed, {dropped} dropped, {added} added": "{kept} gardé(s), {changed} modifié(s), {dropped} retiré(s), {added} ajouté(s)",
+ "the order changed": "l’ordre a changé",
+ "whether the order changed is not known": "on ne sait pas si l’ordre a changé",
+ "the system prompt changed": "le prompt système a changé",
+ "the previous reply is included unchanged": "la réponse précédente y figure telle quelle",
+ "the previous reply is included with changes": "la réponse précédente y figure modifiée",
+ "the previous reply was not found in this history": "la réponse précédente est introuvable dans cet historique",
+ "whether the previous reply is included is not known": "on ne sait pas si la réponse précédente y figure",
+ "This is the first call of its stream since the context began, so there is nothing to compare with.": "C’est le premier appel de son flux depuis le début du contexte, il n’y a donc rien à comparer.",
+ "The context was reset here, so there is nothing before this call to compare with.": "Le contexte a été réinitialisé ici, il n’y a donc rien avant cet appel à comparer.",
+ "The context was reset here and replaced by a summary, so there is nothing before this call to compare with.": "Le contexte a été réinitialisé ici et remplacé par un résumé, il n’y a donc rien avant cet appel à comparer.",
+ "A call of an auxiliary stream is not compared with the calls around it.": "Un appel d’un flux auxiliaire n’est pas comparé aux appels qui l’entourent.",
+ "The framework made this call for its own purpose, so it is not compared with the calls around it.": "Le framework a fait cet appel pour son propre usage, il n’est donc pas comparé aux appels qui l’entourent.",
+ "This history cannot be compared with the call before it: {why}.": "Cet historique ne peut pas être comparé à l’appel précédent : {why}.",
+ "This request does not record its history, so there is nothing to compare with.": "Cette requête n’enregistre pas son historique, il n’y a donc rien à comparer.",
+ "The history of the call before is kept whole: its {count} message(s) come first, as it sent them.": "L’historique de l’appel précédent est gardé en entier : ses {count} message(s) viennent en premier, tels qu’il les a envoyés.",
+ "The history of the call before is kept whole.": "L’historique de l’appel précédent est gardé en entier.",
+ "The history of the call before changed:": "L’historique de l’appel précédent a changé :",
+ "whether the system prompt changed is not known": "on ne sait pas si le prompt système a changé",
+ "This request continues a provider thread: it holds only its new messages, and the provider keeps the rest.": "Cette requête poursuit un fil du fournisseur : elle ne contient que ses nouveaux messages, et le fournisseur garde le reste.",
+ "Dropped from the call before ({count})": "Retirés de l’appel précédent ({count})",
+ "kept": "gardé",
+ "changed": "modifié",
+ "added": "ajouté",
"stopped: {reason}": "arrêté : {reason}",
"Thinking": "Réflexion",
"Injected by the runtime": "Inséré par le runtime",
diff --git a/apps/ui/src/i18n/locales/ja.json b/apps/ui/src/i18n/locales/ja.json
index fde6695a..ba41785d 100644
--- a/apps/ui/src/i18n/locales/ja.json
+++ b/apps/ui/src/i18n/locales/ja.json
@@ -3289,21 +3289,41 @@
"How much of the request to show": "リクエストをどこまで表示するか",
"Whole request": "リクエスト全体",
"The body": "ボディ",
- "What it added": "追加された内容",
- "The request before this one is not among the loaded bodies, so there is nothing to compare with.": "直前のリクエストは読み込まれたボディに含まれないため、比較できません。",
- "This request names no request before it, so there is nothing to compare with.": "このリクエストは直前のリクエストを示していないため、比較できません。",
"System prompt": "システムプロンプト",
"Tools ({count})": "ツール ({count})",
"Messages ({count})": "メッセージ ({count})",
"{bytes} bytes as sent": "送信時 {bytes} バイト",
"Settings": "設定",
"{count} block(s), {bytes} bytes": "{count} ブロック、{bytes} バイト",
- "The {count} message(s) before are as the call before sent them, {bytes} bytes.": "先行する {count} 件のメッセージは前回の呼び出しが送ったままです({bytes} バイト)。",
- "The history before this point was rewritten, and not by a compaction.": "この時点より前の履歴が書き換えられています。コンパクションによるものではありません。",
- "The context was replaced by a summary here, so the list starts again: {before} message(s) became {after}.": "ここでコンテキストが要約に置き換えられ、一覧が最初からになりました:{before} 件のメッセージが {after} 件になりました。",
"Also changed: {what}.": "ほかに変わった点: {what}。",
"Added by this call ({count})": "この呼び出しが追加 ({count})",
"This request adds no message.": "このリクエストはメッセージを追加していません。",
+ "What changed": "変わった点",
+ "History changed · cause unavailable": "履歴が変わりました · 原因は不明",
+ "{kept} kept, {changed} changed, {dropped} dropped, {added} added": "保持 {kept}、変更 {changed}、削除 {dropped}、追加 {added}",
+ "the order changed": "順序が変わりました",
+ "whether the order changed is not known": "順序が変わったかどうかは不明です",
+ "the system prompt changed": "システムプロンプトが変わりました",
+ "the previous reply is included unchanged": "前の応答がそのまま含まれています",
+ "the previous reply is included with changes": "前の応答が変更されて含まれています",
+ "the previous reply was not found in this history": "この履歴に前の応答は見つかりません",
+ "whether the previous reply is included is not known": "前の応答が含まれているかどうかは不明です",
+ "This is the first call of its stream since the context began, so there is nothing to compare with.": "これはコンテキストが始まってからこのストリームで最初の呼び出しのため、比較するものがありません。",
+ "The context was reset here, so there is nothing before this call to compare with.": "ここでコンテキストがリセットされたため、この呼び出しより前に比較するものがありません。",
+ "The context was reset here and replaced by a summary, so there is nothing before this call to compare with.": "ここでコンテキストがリセットされて要約に置き換えられたため、この呼び出しより前に比較するものがありません。",
+ "A call of an auxiliary stream is not compared with the calls around it.": "補助ストリームの呼び出しは、前後の呼び出しと比較しません。",
+ "The framework made this call for its own purpose, so it is not compared with the calls around it.": "この呼び出しはフレームワークが自身の目的で行ったため、前後の呼び出しと比較しません。",
+ "This history cannot be compared with the call before it: {why}.": "この履歴は前の呼び出しと比較できません: {why}。",
+ "This request does not record its history, so there is nothing to compare with.": "このリクエストは履歴を記録していないため、比較するものがありません。",
+ "The history of the call before is kept whole: its {count} message(s) come first, as it sent them.": "前の呼び出しの履歴はそのまま保持されています: その {count} 件のメッセージが送られたとおりに先頭にあります。",
+ "The history of the call before is kept whole.": "前の呼び出しの履歴はそのまま保持されています。",
+ "The history of the call before changed:": "前の呼び出しの履歴が変わりました:",
+ "whether the system prompt changed is not known": "システムプロンプトが変わったかどうかは不明です",
+ "This request continues a provider thread: it holds only its new messages, and the provider keeps the rest.": "このリクエストはプロバイダーのスレッドを継続します: 新しいメッセージだけを含み、残りはプロバイダーが保持します。",
+ "Dropped from the call before ({count})": "前の呼び出しから削除 ({count})",
+ "kept": "保持",
+ "changed": "変更",
+ "added": "追加",
"stopped: {reason}": "停止理由: {reason}",
"Thinking": "思考",
"Injected by the runtime": "ランタイムが挿入",
diff --git a/apps/ui/src/i18n/locales/ko.json b/apps/ui/src/i18n/locales/ko.json
index 8bfa569a..a816ec87 100644
--- a/apps/ui/src/i18n/locales/ko.json
+++ b/apps/ui/src/i18n/locales/ko.json
@@ -3289,21 +3289,41 @@
"How much of the request to show": "요청을 어디까지 표시할지",
"Whole request": "요청 전체",
"The body": "본문",
- "What it added": "추가된 내용",
- "The request before this one is not among the loaded bodies, so there is nothing to compare with.": "이전 요청이 불러온 본문에 없어 비교할 대상이 없습니다.",
- "This request names no request before it, so there is nothing to compare with.": "이 요청은 이전 요청을 가리키지 않으므로 비교할 대상이 없습니다.",
"System prompt": "시스템 프롬프트",
"Tools ({count})": "도구 ({count})",
"Messages ({count})": "메시지 ({count})",
"{bytes} bytes as sent": "보낸 시점 {bytes}바이트",
"Settings": "설정",
"{count} block(s), {bytes} bytes": "블록 {count}개, {bytes}바이트",
- "The {count} message(s) before are as the call before sent them, {bytes} bytes.": "앞선 메시지 {count}개는 이전 호출이 보낸 그대로입니다({bytes}바이트).",
- "The history before this point was rewritten, and not by a compaction.": "이 지점 이전의 대화 기록이 다시 작성되었습니다. 컴팩션 때문은 아닙니다.",
- "The context was replaced by a summary here, so the list starts again: {before} message(s) became {after}.": "여기서 컨텍스트가 요약으로 대체되어 목록이 다시 시작되었습니다: 메시지 {before}개가 {after}개가 되었습니다.",
"Also changed: {what}.": "그 밖에 바뀐 것: {what}.",
"Added by this call ({count})": "이 호출이 추가함 ({count})",
"This request adds no message.": "이 요청은 메시지를 추가하지 않습니다.",
+ "What changed": "바뀐 것",
+ "History changed · cause unavailable": "기록이 바뀜 · 원인 알 수 없음",
+ "{kept} kept, {changed} changed, {dropped} dropped, {added} added": "유지 {kept}, 변경 {changed}, 삭제 {dropped}, 추가 {added}",
+ "the order changed": "순서가 바뀜",
+ "whether the order changed is not known": "순서가 바뀌었는지 알 수 없음",
+ "the system prompt changed": "시스템 프롬프트가 바뀜",
+ "the previous reply is included unchanged": "이전 응답이 그대로 포함됨",
+ "the previous reply is included with changes": "이전 응답이 바뀌어 포함됨",
+ "the previous reply was not found in this history": "이 기록에서 이전 응답을 찾을 수 없음",
+ "whether the previous reply is included is not known": "이전 응답이 포함되었는지 알 수 없음",
+ "This is the first call of its stream since the context began, so there is nothing to compare with.": "컨텍스트가 시작된 뒤 이 스트림의 첫 호출이므로 비교할 것이 없습니다.",
+ "The context was reset here, so there is nothing before this call to compare with.": "여기서 컨텍스트가 재설정되었으므로 이 호출 앞에 비교할 것이 없습니다.",
+ "The context was reset here and replaced by a summary, so there is nothing before this call to compare with.": "여기서 컨텍스트가 재설정되고 요약으로 대체되었으므로 이 호출 앞에 비교할 것이 없습니다.",
+ "A call of an auxiliary stream is not compared with the calls around it.": "보조 스트림의 호출은 앞뒤 호출과 비교하지 않습니다.",
+ "The framework made this call for its own purpose, so it is not compared with the calls around it.": "이 호출은 프레임워크가 자체 목적으로 만든 것이므로 앞뒤 호출과 비교하지 않습니다.",
+ "This history cannot be compared with the call before it: {why}.": "이 기록은 이전 호출과 비교할 수 없습니다: {why}.",
+ "This request does not record its history, so there is nothing to compare with.": "이 요청은 기록을 남기지 않으므로 비교할 것이 없습니다.",
+ "The history of the call before is kept whole: its {count} message(s) come first, as it sent them.": "이전 호출의 기록이 그대로 유지됩니다: 그 메시지 {count}개가 보낸 그대로 앞에 옵니다.",
+ "The history of the call before is kept whole.": "이전 호출의 기록이 그대로 유지됩니다.",
+ "The history of the call before changed:": "이전 호출의 기록이 바뀌었습니다:",
+ "whether the system prompt changed is not known": "시스템 프롬프트가 바뀌었는지 알 수 없음",
+ "This request continues a provider thread: it holds only its new messages, and the provider keeps the rest.": "이 요청은 제공자 스레드를 이어 갑니다: 새 메시지만 담고 나머지는 제공자가 보관합니다.",
+ "Dropped from the call before ({count})": "이전 호출에서 삭제됨 ({count})",
+ "kept": "유지",
+ "changed": "변경",
+ "added": "추가",
"stopped: {reason}": "중단: {reason}",
"Thinking": "사고",
"Injected by the runtime": "런타임이 삽입함",
diff --git a/apps/ui/src/i18n/locales/pt.json b/apps/ui/src/i18n/locales/pt.json
index 287a1885..0d0c94b5 100644
--- a/apps/ui/src/i18n/locales/pt.json
+++ b/apps/ui/src/i18n/locales/pt.json
@@ -3289,21 +3289,41 @@
"How much of the request to show": "Quanto da requisição mostrar",
"Whole request": "Requisição inteira",
"The body": "O corpo",
- "What it added": "O que acrescentou",
- "The request before this one is not among the loaded bodies, so there is nothing to compare with.": "A requisição anterior não está entre os corpos carregados, então não há com o que comparar.",
- "This request names no request before it, so there is nothing to compare with.": "Esta requisição não indica nenhuma requisição anterior, então não há com o que comparar.",
"System prompt": "Prompt do sistema",
"Tools ({count})": "Ferramentas ({count})",
"Messages ({count})": "Mensagens ({count})",
"{bytes} bytes as sent": "{bytes} bytes como enviados",
"Settings": "Configurações",
"{count} block(s), {bytes} bytes": "{count} bloco(s), {bytes} bytes",
- "The {count} message(s) before are as the call before sent them, {bytes} bytes.": "As {count} mensagens anteriores estão como a chamada anterior as enviou, {bytes} bytes.",
- "The history before this point was rewritten, and not by a compaction.": "O histórico anterior a este ponto foi reescrito, e não por uma compactação.",
- "The context was replaced by a summary here, so the list starts again: {before} message(s) became {after}.": "Aqui o contexto foi substituído por um resumo, então a lista recomeça: {before} mensagem(ns) passaram a ser {after}.",
"Also changed: {what}.": "Também mudou: {what}.",
"Added by this call ({count})": "Adicionado por esta chamada ({count})",
"This request adds no message.": "Esta requisição não acrescenta nenhuma mensagem.",
+ "What changed": "O que mudou",
+ "History changed · cause unavailable": "Histórico mudou · causa indisponível",
+ "{kept} kept, {changed} changed, {dropped} dropped, {added} added": "{kept} mantida(s), {changed} alterada(s), {dropped} removida(s), {added} adicionada(s)",
+ "the order changed": "a ordem mudou",
+ "whether the order changed is not known": "não se sabe se a ordem mudou",
+ "the system prompt changed": "o prompt do sistema mudou",
+ "the previous reply is included unchanged": "a resposta anterior está incluída sem alterações",
+ "the previous reply is included with changes": "a resposta anterior está incluída com alterações",
+ "the previous reply was not found in this history": "a resposta anterior não foi encontrada neste histórico",
+ "whether the previous reply is included is not known": "não se sabe se a resposta anterior está incluída",
+ "This is the first call of its stream since the context began, so there is nothing to compare with.": "Esta é a primeira chamada do seu fluxo desde que o contexto começou, então não há nada com que comparar.",
+ "The context was reset here, so there is nothing before this call to compare with.": "Aqui o contexto foi reiniciado, então não há nada antes desta chamada com que comparar.",
+ "The context was reset here and replaced by a summary, so there is nothing before this call to compare with.": "Aqui o contexto foi reiniciado e substituído por um resumo, então não há nada antes desta chamada com que comparar.",
+ "A call of an auxiliary stream is not compared with the calls around it.": "Uma chamada de um fluxo auxiliar não é comparada com as chamadas ao redor.",
+ "The framework made this call for its own purpose, so it is not compared with the calls around it.": "O framework fez esta chamada para seu próprio fim, então ela não é comparada com as chamadas ao redor.",
+ "This history cannot be compared with the call before it: {why}.": "Este histórico não pode ser comparado com a chamada anterior: {why}.",
+ "This request does not record its history, so there is nothing to compare with.": "Esta requisição não registra seu histórico, então não há nada com que comparar.",
+ "The history of the call before is kept whole: its {count} message(s) come first, as it sent them.": "O histórico da chamada anterior é mantido inteiro: suas {count} mensagem(ns) vêm primeiro, como ela as enviou.",
+ "The history of the call before is kept whole.": "O histórico da chamada anterior é mantido inteiro.",
+ "The history of the call before changed:": "O histórico da chamada anterior mudou:",
+ "whether the system prompt changed is not known": "não se sabe se o prompt do sistema mudou",
+ "This request continues a provider thread: it holds only its new messages, and the provider keeps the rest.": "Esta requisição continua uma thread do provedor: contém só suas mensagens novas, e o provedor guarda o resto.",
+ "Dropped from the call before ({count})": "Removidas da chamada anterior ({count})",
+ "kept": "mantida",
+ "changed": "alterada",
+ "added": "adicionada",
"stopped: {reason}": "parou: {reason}",
"Thinking": "Raciocínio",
"Injected by the runtime": "Inserido pelo runtime",
diff --git a/apps/ui/src/i18n/locales/zh-CN.json b/apps/ui/src/i18n/locales/zh-CN.json
index 34d41fe4..356fbbdf 100644
--- a/apps/ui/src/i18n/locales/zh-CN.json
+++ b/apps/ui/src/i18n/locales/zh-CN.json
@@ -3289,21 +3289,41 @@
"How much of the request to show": "显示请求的范围",
"Whole request": "完整请求",
"The body": "报文",
- "What it added": "新增内容",
- "The request before this one is not among the loaded bodies, so there is nothing to compare with.": "上一条请求不在已加载的报文中,无法比较。",
- "This request names no request before it, so there is nothing to compare with.": "此请求未指明上一条请求,无法比较。",
"System prompt": "系统提示词",
"Tools ({count})": "工具({count})",
"Messages ({count})": "消息({count})",
"{bytes} bytes as sent": "发送时 {bytes} 字节",
"Settings": "设置",
"{count} block(s), {bytes} bytes": "{count} 个块,{bytes} 字节",
- "The {count} message(s) before are as the call before sent them, {bytes} bytes.": "此前的 {count} 条消息与上次调用发送时相同,共 {bytes} 字节。",
- "The history before this point was rewritten, and not by a compaction.": "此前的历史记录被重写,但并非压缩(compaction)所致。",
- "The context was replaced by a summary here, so the list starts again: {before} message(s) became {after}.": "此处上下文被摘要取代,消息列表重新开始:{before} 条消息变为 {after} 条。",
"Also changed: {what}.": "同时变化:{what}。",
"Added by this call ({count})": "本次调用新增({count})",
"This request adds no message.": "该请求没有新增消息。",
+ "What changed": "变化内容",
+ "History changed · cause unavailable": "历史已变化 · 原因无从得知",
+ "{kept} kept, {changed} changed, {dropped} dropped, {added} added": "保留 {kept}、变化 {changed}、删除 {dropped}、新增 {added}",
+ "the order changed": "顺序有变化",
+ "whether the order changed is not known": "顺序是否变化无从得知",
+ "the system prompt changed": "系统提示词有变化",
+ "the previous reply is included unchanged": "上一个回复原样包含在内",
+ "the previous reply is included with changes": "上一个回复包含在内但有改动",
+ "the previous reply was not found in this history": "此历史中找不到上一个回复",
+ "whether the previous reply is included is not known": "上一个回复是否包含在内无从得知",
+ "This is the first call of its stream since the context began, so there is nothing to compare with.": "这是该 stream 自上下文开始以来的第一个调用,因此没有可比较的内容。",
+ "The context was reset here, so there is nothing before this call to compare with.": "此处上下文被重置,因此此调用之前没有可比较的内容。",
+ "The context was reset here and replaced by a summary, so there is nothing before this call to compare with.": "此处上下文被重置并被摘要取代,因此此调用之前没有可比较的内容。",
+ "A call of an auxiliary stream is not compared with the calls around it.": "辅助 stream 中的调用不与前后的调用比较。",
+ "The framework made this call for its own purpose, so it is not compared with the calls around it.": "此调用是框架出于自身目的发起的,因此不与前后的调用比较。",
+ "This history cannot be compared with the call before it: {why}.": "此历史无法与上一个调用比较:{why}。",
+ "This request does not record its history, so there is nothing to compare with.": "此请求没有记录其历史,因此没有可比较的内容。",
+ "The history of the call before is kept whole: its {count} message(s) come first, as it sent them.": "上一个调用的历史被完整保留:它的 {count} 条消息按原样排在最前。",
+ "The history of the call before is kept whole.": "上一个调用的历史被完整保留。",
+ "The history of the call before changed:": "上一个调用的历史有变化:",
+ "whether the system prompt changed is not known": "系统提示词是否变化无从得知",
+ "This request continues a provider thread: it holds only its new messages, and the provider keeps the rest.": "此请求延续一个提供方线程(provider thread):它只包含新消息,其余由提供方保留。",
+ "Dropped from the call before ({count})": "从上一个调用中删除({count})",
+ "kept": "保留",
+ "changed": "变化",
+ "added": "新增",
"stopped: {reason}": "停止原因:{reason}",
"Thinking": "思考",
"Injected by the runtime": "由运行时注入",
diff --git a/apps/ui/src/layer/ai-conversation/conversationStrings.ts b/apps/ui/src/layer/ai-conversation/conversationStrings.ts
index 95068b83..3e331384 100644
--- a/apps/ui/src/layer/ai-conversation/conversationStrings.ts
+++ b/apps/ui/src/layer/ai-conversation/conversationStrings.ts
@@ -271,9 +271,7 @@ export function conversationStrings(t: Translate): ViewStrings {
promptRequestModes: t('How much of the request to show'),
promptWholeRequest: t('Whole request'),
promptWholeBody: t('The body'),
- promptChanges: t('What it added'),
- promptNoPrevious: t('The request before this one is not among the loaded bodies, so there is nothing to compare with.'),
- promptNoPreviousNamed: t('This request names no request before it, so there is nothing to compare with.'),
+ promptChanges: t('What changed'),
promptSystem: t('System prompt'),
promptTools: t('Tools ({count})', { count: '{count}' }),
promptMessages: t('Messages ({count})', { count: '{count}' }),
@@ -281,12 +279,37 @@ export function conversationStrings(t: Translate): ViewStrings {
promptMessagesNote: t('{bytes} bytes as sent', { bytes: '{bytes}' }),
promptSettings: t('Settings'),
promptBlocks: t('{count} block(s), {bytes} bytes', { count: '{count}', bytes: '{bytes}' }),
- promptShared: t('The {count} message(s) before are as the call before sent them, {bytes} bytes.', { count: '{count}', bytes: '{bytes}' }),
- promptRewritten: t('The history before this point was rewritten, and not by a compaction.'),
- promptCompacted: t('The context was replaced by a summary here, so the list starts again: {before} message(s) became {after}.', { before: '{before}', after: '{after}' }),
promptAlsoChanged: t('Also changed: {what}.', { what: '{what}' }),
promptAdded: t('Added by this call ({count})', { count: '{count}' }),
promptNothingAdded: t('This request adds no message.'),
+ historyRole: t('History'),
+ historyChanged: t('History changed · cause unavailable'),
+ historyCounts: t('{kept} kept, {changed} changed, {dropped} dropped, {added} added', { kept: '{kept}', changed: '{changed}', dropped: '{dropped}', added: '{added}' }),
+ historyOrderChanged: t('the order changed'),
+ historyOrderUnknown: t('whether the order changed is not known'),
+ historySystemChanged: t('the system prompt changed'),
+ historyReplyBack: t('the previous reply is included unchanged'),
+ historyReplyBackChanged: t('the previous reply is included with changes'),
+ historyReplyNotFound: t('the previous reply was not found in this history'),
+ historyReplyUnknown: t('whether the previous reply is included is not known'),
+ promptHistoryFirst: t('This is the first call of its stream since the context began, so there is nothing to compare with.'),
+ promptReset: t('The context was reset here, so there is nothing before this call to compare with.'),
+ promptResetSummary: t('The context was reset here and replaced by a summary, so there is nothing before this call to compare with.'),
+ promptHistoryAuxiliary: t('A call of an auxiliary stream is not compared with the calls around it.'),
+ promptHistoryInternal: t('The framework made this call for its own purpose, so it is not compared with the calls around it.'),
+ promptHistoryUnavailable: t('This history cannot be compared with the call before it: {why}.', { why: '{why}' }),
+ promptHistoryNone: t('This request does not record its history, so there is nothing to compare with.'),
+ promptHistoryKept: t('The history of the call before is kept whole: its {count} message(s) come first, as it sent them.', { count: '{count}' }),
+ promptHistoryKeptAll: t('The history of the call before is kept whole.'),
+ promptHistoryChanged: t('The history of the call before changed:'),
+ historySystemUnknown: t('whether the system prompt changed is not known'),
+ promptToolsWord: t('Tools'),
+ promptThreadHeld: t('This request continues a provider thread: it holds only its new messages, and the provider keeps the rest.'),
+ promptDropped: t('Dropped from the call before ({count})', { count: '{count}' }),
+ promptMarkKept: t('kept'),
+ promptMarkChanged: t('changed'),
+ promptMarkAdded: t('added'),
+ promptMarkDropped: t('dropped'),
promptStopReason: t('stopped: {reason}', { reason: '{reason}' }),
promptThinking: t('Thinking'),
promptReminder: t('Injected by the runtime'),
diff --git a/docs/changelog/1.1.0.md b/docs/changelog/1.1.0.md
index eff909f5..f99c0bee 100644
--- a/docs/changelog/1.1.0.md
+++ b/docs/changelog/1.1.0.md
@@ -32,9 +32,11 @@
**The Conversations tab says what each conversation did.** Its columns are now Talks, **Model calls**, **Subagents**, **Bash runs** and **Changes**: the change records the Sessionizer captured as of the newest round, one per observation (a watched tool call per workspace root, the agent's own patch of an edit, a scan that found nothing, a change seen between calls that no call made), with the plus-over-minus mark and the lines those records added and removed, summed over the records, bes [...]
-**The conversation page shows the prompt each model call sent, and the answer it got.** When the AI Sessionizer captured the bodies a call exchanged with its model provider, the call's step gains a **Prompt** tab: the exact request as it was sent and the exact response as it came back, neither of which a transcript holds. The bodies are not part of the conversation document — they are megabytes per call — so the tab opens on an offer stating how many stored files of the session it needs [...]
+**The conversation page shows the prompt each model call sent, and the answer it got.** When the AI Sessionizer captured the bodies a call exchanged with its model provider, the call's step gains a **Prompt** tab: the exact request as it was sent and the exact response as it came back, neither of which a transcript holds. The bodies are not part of the conversation document — they are megabytes per call — so the tab opens on an offer stating how many stored files of the session it needs [...]
-**The Prompt tab reads a LangChain or LangGraph agent's calls.** For such an agent the Sessionizer stores what LangChain handed its model, a list of LangChain's own serialized messages, and the tab drew each of those requests as one empty message. It now shows every message in LangChain's words, `system`, `human`, `ai` and `tool`, with the tool calls an `ai` message made, each drawn once with the arguments LangChain parsed even where the provider repeats it in the message content, and ea [...]
+**The Prompt tab reads a LangChain or LangGraph agent's calls.** For such an agent the Sessionizer stores what LangChain handed its model, a list of LangChain's own serialized messages, and the tab drew each of those requests as one empty message. It now shows every message in LangChain's words, `system`, `human`, `ai` and `tool`, with the tool calls an `ai` message made, each drawn once with the arguments LangChain parsed even where the provider repeats it in the message content, and ea [...]
+
+**The conversation page shows where a model call's history changed.** When the AI Sessionizer finds that a call's history is not the one before it with more after it, as when an application trims the history it sends, it draws a **History changed · cause unavailable** step just before the call, dashed and in a colour of its own. The step says how many messages were kept, changed, dropped and added, whether their order changed, whether the system prompt changed, and what became of the ear [...]
**The conversation page shows what each call to an MCP server did.** A call to an MCP server is drawn on its own **MCP** lane of the flow timeline, and its card is named by the server and the tool instead of Claude Code's `mcp__<server>__<tool>`. When the asz Claude Code plugin observed the call, the card wears how it ended and the time the runtime measured around it, `returned · 380 ms`, and the inspector gains an **Execution** tab: the server by its configured name and where that confi [...]
diff --git a/docs/operate/ai-agent-conversations.md b/docs/operate/ai-agent-conversations.md
index 975b9de3..0167b097 100644
--- a/docs/operate/ai-agent-conversations.md
+++ b/docs/operate/ai-agent-conversations.md
@@ -64,7 +64,7 @@ The page's address is the thing to share. It carries the conversation, its agent
The page has three parts, and a header with the conversation's title, agent, agent runtime and id, a link back to the list, the theme chip and the language picker (the page follows your Horizon theme, the light one included, and every text of it is translated):
-- **Transcript** — the talks of one execution stream in reading order. What came from outside sits on the right; the agent's replies sit on the left; the work between an input and its reply (model calls, reasoning, tool uses, agent launches, context resets) is folded under a *show what the agent did* row so a long run reads as a conversation until you open it. Long pauses are marked. A tool call's input and result are drawn as the fields the runtime recorded rather than as one escaped st [...]
+- **Transcript** — the talks of one execution stream in reading order. What came from outside sits on the right; the agent's replies sit on the left; the work between an input and its reply (model calls, reasoning, tool uses, agent launches, context resets, and where a call's history changed) is folded under a *show what the agent did* row so a long run reads as a conversation until you open it. Long pauses are marked. A tool call's input and result are drawn as the fields the runtime re [...]
- **Flow timeline** — the same stream on a time axis, one lane per kind of activity (external input, responses, context put in, model calls, tools, calls to MCP servers, agent activity, runtime notices, nested streams). Busy stretches take the width; a long pause is cut to a marked gap. Selecting a step draws the relations that touch it: a solid line is an exact join, a dashed one was inferred, a faint curve is ownership (the model call that produced a step). A child agent appears as a n [...]
- **Inspector** — the selected step's **Details**, opening with where the step sits in words a reader knows (the activity window and its place among them, the agent, the talk by its opening line, the run's place in it, and the step by kind and name; the document's own ids sit in the tooltip), then its kind, lane, stream, segment, run, parent, time, token counts, request-to-result interval where the runtime recorded it, and its input and result drawn as fields the way the transcript draws [...]
@@ -88,21 +88,32 @@ A call to an MCP server is drawn on its own lane of the flow timeline, **MCP**,
When the asz Claude Code plugin observed the call, the card wears how it ended and the time the runtime measured around it, such as `returned · 380 ms` or `failed · 2.0 s`; clicking it opens the inspector's **Execution** tab. The tab lists each observation of the call: the observer, the MCP server by the name it was configured with and where that configuration came from, the outcome (`returned`, `failed` or `interrupted`), the measured time, when the observation ended, and the size and S [...]
+### Where a call's history changed
+
+A model call sends the model its history, the messages before it. A Claude Code request that continues a provider thread sends only the new messages, and the provider keeps the rest. The Sessionizer compares each call's history with the call before it in the same stream, where the runtime records its requests: Claude Code with provider bodies captured, and LangChain. A history that is the one before it with more after it is kept. Anything else, such as an application trimming the history [...]
+
+Its cause is unavailable, because no record says why a history changed. It is not a context reset: the page shows a reset only where the conversation records one, and the calls on both sides of the step stay in the same epoch.
+
### Prompts
When the Sessionizer captured the bodies a model call exchanged with its provider, the call's step gains a **Prompt** tab in the inspector: the exact request that was sent, and the exact response that came back, as the agent's runtime wrote them.
**Nothing is read until you ask.** The tab opens on an offer that says how many stored files the prompt needs and how many bytes they are, over a **Load the prompt** button. The bodies are not part of the conversation document — they are megabytes per call, and a conversation has hundreds of calls — so Horizon reads them from OAP one session at a time, only for the conversation you have open, and only when you press the button. What it has read it keeps for as long as the page is open, s [...]
-A **request** opens whole: the **system prompt**, the **tools** it offered with their descriptions, the **messages** it sent with their text, tool uses and tool results, and the **settings** — every other field of the body, the model, the sampling settings and the metadata, as JSON. Text the runtime injected rather than a person writing it, such as a `<system-reminder>`, is marked as injected. The **What it added** mode compares the request with the one the call before it sent and shows [...]
+A **request** opens whole: the **system prompt**, the **tools** it offered with their descriptions, the **messages** it sent with their text, tool uses and tool results, and the **settings** — every other field of the body, the model, the sampling settings and the metadata, as JSON. Text the runtime injected rather than a person writing it, such as a `<system-reminder>`, is marked as injected. The **What changed** mode says what the Sessionizer found when it compared the call's history w [...]
+
+- A **kept** history is the one before it with more after it. The mode names the history it kept instead of repeating it, *the history of the call before is kept whole: its 12 message(s) come first, as it sent them*, and shows only the messages this call added. It says what became of the earlier call's reply, and when the request continues a provider thread.
+- A **changed** history marks each message *kept*, *changed* (the same message, sent again with other content) or *added*, and lists the messages dropped from the call before, with the counts the history card gives. When either request continues a provider thread, the bodies hold only part of each history, so the mode gives the counts without marking each message.
+- A **first** call has nothing before it in its stream. After a context reset the mode says *the context was reset here*, and adds *and replaced by a summary* only when the reset has one.
+- A call the framework made for its own purpose, or a call of an auxiliary stream, is not compared, and a history the Sessionizer could not compare says why.
-Two things about a message move as the list grows, and the comparison leaves both out, so a message that only changed in these ways counts as unchanged. The cache marker, `cache_control`, moves to the newest message. And a message of one text block is sent as a list of blocks while it is the newest, and as a plain string once the marker has left it, so the same message has two spellings depending on where it sits. Reading those two spellings as different messages reports a history that m [...]
+It also says when the system prompt, the tools or the settings changed. Tools are not compared when either request continues a provider thread, since such a request sends none; the cache marker that moves down the list is left out. A request whose bodies landed before the Sessionizer recorded histories says there is nothing to compare.
Each message is drawn in a box of its own, headed by its role and its place in the request — *user, 1 of 3* — because one message can hold several blocks (an injected reminder and the text beside it, or an answer and the tool it then used) and the boxes are what keep the count honest. Inside a message every block is drawn the same way, labelled with what it is over an edge in the page's colour for that kind, so a label belongs to the block under it and never to the message: the text a ru [...]
A **response** is shown on its own: what stopped it, the token counts the provider reported, and the blocks it returned — text, reasoning, and the tool uses the agent went on to run. A tool result the provider marked failed says so. A long text is cut short with a *show all* link that opens it in place, as elsewhere on the page, and every text has a *copy* button that copies it in full, never the shortened preview.
-A **LangChain or LangGraph agent** is read in LangChain's own words. What the Sessionizer stores for such a call is what LangChain handed its model, before the model's client library turned it into the provider's request. Every message is headed by its type, `system`, `human`, `ai` or `tool`, and the system prompt is the first message rather than a section of its own. An `ai` message shows the tool calls it made, each once, and a `tool` message shows the result under the call it answers, [...]
+A **LangChain or LangGraph agent** is read in LangChain's own words. What the Sessionizer stores for such a call is what LangChain handed its model, before the model's client library turned it into the provider's request. Every message is headed by its type, `system`, `human`, `ai` or `tool`, and the system prompt is the first message rather than a section of its own. An `ai` message shows the tool calls it made, each once, and a `tool` message shows the result under the call it answers, [...]
**What is shown is checked, not trusted.** The Sessionizer stores a body cut into pieces so that history repeated across calls is stored once, and Horizon rebuilds each body in your browser and checks it against the byte count and the SHA-256 digest the Sessionizer recorded. A body it cannot rebuild says so instead of showing a partial one. A body of a shape it does not know — a provider other than the one it reads — is shown as the JSON document it is, with nothing left out.
diff --git a/packages/conversation-view/src/model.ts b/packages/conversation-view/src/model.ts
index 0b650c50..9283e582 100644
--- a/packages/conversation-view/src/model.ts
+++ b/packages/conversation-view/src/model.ts
@@ -261,7 +261,7 @@ export interface Folder {
* millisecond than the six injections behind it, so sorting by time buried
* the line that starts the talk six cards down. */
export function readOrder(a: Step, b: Step): number {
- if (a.ref && b.ref) return a.ref.seq - b.ref.seq || a.ref.row - b.ref.row;
+ if (a.ref && b.ref) return a.ref.seq - b.ref.seq || a.ref.row - b.ref.row || a.order - b.order;
return (a.at || 0) - (b.at || 0) || a.order - b.order;
}
@@ -269,6 +269,12 @@ export function timeOrder(a: Step, b: Step): number {
return (a.at || 0) - (b.at || 0) || a.order - b.order;
}
+/** The call a history.change card stands before, which the card names as the one it changed to. */
+export function cardCall(card: Step): string {
+ const to = card.attrs?.['to_call'];
+ return typeof to === 'string' ? to : card.id;
+}
+
export class ConversationModel {
readonly talks: TalkRow[] = [];
readonly talkById = new Map<string, TalkRow>();
@@ -376,6 +382,13 @@ export class ConversationModel {
flatten(t, t.id, row.stream);
}
for (const n of doc.loose ?? []) flatten(n, null, n.stream ?? 'main');
+ // A history.change card stands on its call's first record and comes just before the call. It takes
+ // the call's place in the document's order, so every step tied with the two, such as what the call
+ // said on that same record, sorts after the card as it does after the call.
+ for (const step of this.stepById.values()) {
+ const call = step.kind === 'history.change' ? this.stepById.get(cardCall(step)) : undefined;
+ if (call) step.order = call.order - 0.5;
+ }
for (const [name, steps] of this.stepsByStream) {
steps.sort(readOrder);
this.flowByStream.set(name, [...steps].sort(timeOrder));
@@ -417,6 +430,15 @@ export class ConversationModel {
return this.looseByStream.get(stream) ?? [];
}
+ /** The step a click on a step selects: a history.change card selects the call it stands before, when
+ * the document holds that call, and itself otherwise. */
+ target(id: string): string {
+ const step = this.stepById.get(id);
+ if (step?.kind !== 'history.change') return id;
+ const call = cardCall(step);
+ return this.stepById.has(call) ? call : id;
+ }
+
step(id: string | null | undefined): Step | null {
return id ? (this.stepById.get(id) ?? null) : null;
}
diff --git a/packages/conversation-view/src/prompt/messages.ts b/packages/conversation-view/src/prompt/messages.ts
index 6df7d45d..f830cadc 100644
--- a/packages/conversation-view/src/prompt/messages.ts
+++ b/packages/conversation-view/src/prompt/messages.ts
@@ -91,10 +91,8 @@ export type ReadBody = ReadRequest | ReadResponse | ReadOther;
const REMINDER = '<system-reminder>';
-/** How deep the provider's cache marker sits in each thing the delta compares: on a message and on
- * each of its content blocks, two levels in because the content is an array; on a system block or a
- * tool, one level into the list; nowhere in the settings. */
-const MARKED_IN_MESSAGE = 2;
+/** How deep the provider's cache marker sits in what is compared outside the messages: on a tool, one
+ * level into the list; nowhere in the settings. */
const MARKED_IN_LIST = 1;
const NOT_MARKED = -1;
@@ -346,87 +344,48 @@ function langChainBlocks(fields: Record<string, unknown>, raw: unknown): PromptB
return typeof content === 'string' ? [{ kind: 'text', text: '' }] : [{ kind: 'unknown', json: raw }];
}
-/** What one request adds to the one before it. */
-export interface PromptDelta {
- /** The messages this request carries that the one before it did not. */
- added: PromptMessage[];
- /** How many messages the two share, and how many bytes they are. */
- sharedMessages: number;
- sharedBytes: number;
- /** Whether the shared messages differ in their own text, rather than the list only growing. */
- rewritten: boolean;
- /** Whether the list was replaced rather than added to: a compaction starts it again from the
- * summary that took the place of the context, so it is shorter as well as different. A rewrite
- * that is not this is the rare one, and worth saying so. */
- replaced: boolean;
- /** What else changed outside the messages. */
- systemChanged: boolean;
- toolsChanged: boolean;
- settingsChanged: boolean;
+/** What changed between two requests outside their messages, whose history the call itself says. */
+export interface OutsideChanges {
+ tools: boolean;
+ settings: boolean;
}
+/** Settings a request carries about itself rather than about the call: who sent it, and the
+ * provider thread it starts or continues, which the call's history already says. */
+const NOT_SETTINGS = new Set(['metadata', 'thread', 'diagnostics']);
+
/**
- * Compares two requests, message by message, from the start. The cache marker the runtime moves down
- * the list as it goes is left out of the comparison, so a message that only lost or gained that marker
- * counts as unchanged; everything else is compared as it was sent.
+ * Compares what two requests carry besides their messages. A request that continues a provider
+ * thread sends no tools, and that is not a change, so the tools are not compared when either request
+ * continues one; between two other requests, a tool list added or taken away is a change. The cache
+ * marker the runtime moves is left out.
*/
-export function deltaOf(previous: ReadRequest, current: ReadRequest): PromptDelta {
- let shared = 0;
- let rewritten = false;
- const least = Math.min(previous.messages.length, current.messages.length);
- while (shared < least && same(previous.messages[shared]!.raw, current.messages[shared]!.raw, MARKED_IN_MESSAGE)) shared++;
- if (shared < least) rewritten = true;
- const replaced = rewritten && current.messages.length < previous.messages.length;
- const added = current.messages.slice(shared);
- let sharedBytes = 0;
- for (let i = 0; i < shared; i++) sharedBytes += size(current.messages[i]!.raw);
+export function outsideOf(previous: ReadRequest, current: ReadRequest, threaded: boolean): OutsideChanges {
return {
- added,
- sharedMessages: shared,
- sharedBytes,
- rewritten,
- replaced,
- systemChanged: !same(previous.raw['system'], current.raw['system'], MARKED_IN_LIST),
- toolsChanged: !same(previous.raw['tools'], current.raw['tools'], MARKED_IN_LIST),
- settingsChanged: !same(settings(previous), settings(current), NOT_MARKED),
+ tools: !threaded && !same(previous.raw['tools'], current.raw['tools'], MARKED_IN_LIST),
+ settings: !same(settings(previous), settings(current), NOT_MARKED),
};
}
function settings(r: ReadRequest): Record<string, unknown> {
const out: Record<string, unknown> = Object.create(null) as Record<string, unknown>;
- for (const [k, v] of Object.entries(r.rest)) if (k !== 'metadata') out[k] = v;
+ for (const [k, v] of Object.entries(r.rest)) if (!NOT_SETTINGS.has(k)) out[k] = v;
return out;
}
/**
* Two values, compared without the moving cache marker. `markedTo` is how deep the marker can sit in
- * this value: a message carries one and so does each of its content blocks, which are two levels in
- * because the content is an array; a system block or a tool is one level into the list it is in.
+ * this value: a tool is one level into the list it is in.
*/
function same(a: unknown, b: unknown, markedTo: number): boolean {
return canonical(a, markedTo) === canonical(b, markedTo);
}
-function size(value: unknown): number {
- return new TextEncoder().encode(JSON.stringify(value) ?? '').length;
-}
-
/**
- * The value as one string, with the two things the runtime changes about a message it is no longer
- * caching left out.
- *
- * The first is the `cache_control` marker, which the runtime moves down the message list as the
- * conversation grows, so a message that only gained or lost one is the same message. It sits on a
- * message, a content block, a system block or a tool, and nowhere deeper: a `cache_control` inside a
- * tool's own input or schema is the agent's data, and two calls that differ only there differ. That
- * is why the walk carries how deep the marker can be rather than removing the name at every depth.
- *
- * The second is the shape of the content itself. A message of one text block is sent as a list while
- * it is the newest, and as a plain string once the marker has left it, which is what Claude Code was
- * measured to write and what the Sessionizer reproduces. The text is the same and the message is the
- * same, so the two spellings have to compare equal: without this, every message compared unequal the
- * moment it stopped being the newest, and a history that merely grew was read as one that had been
- * rewritten.
+ * The value as one string, without the `cache_control` marker the runtime moves as the conversation
+ * grows. It sits on a tool and nowhere deeper: a `cache_control` inside a tool's own input schema is
+ * the agent's data, and two tools that differ only there differ. That is why the walk carries how deep
+ * the marker can be rather than removing the name at every depth.
*
* It builds a string instead of an object because a body can carry a `__proto__` key, and assigning
* that into an object changes the object's prototype instead of keeping the value.
@@ -438,22 +397,7 @@ function canonical(value: unknown, markedTo: number, depth = 0): string {
const parts: string[] = [];
for (const k of Object.keys(obj).sort()) {
if (depth <= markedTo && k === 'cache_control') continue;
- const v = k === 'content' && depth < markedTo ? plainContent(obj[k]) : obj[k];
- parts.push(`${JSON.stringify(k)}:${canonical(v, markedTo, depth + 1)}`);
+ parts.push(`${JSON.stringify(k)}:${canonical(obj[k], markedTo, depth + 1)}`);
}
return `{${parts.join(',')}}`;
}
-
-/**
- * One text block and the plain string it becomes, as the same value. Anything else is left as it is:
- * a message of several blocks, or of one block that is not text, never takes the short spelling.
- */
-function plainContent(content: unknown): unknown {
- if (typeof content === 'string') return [{ type: 'text', text: content }];
- if (!Array.isArray(content) || content.length !== 1) return content;
- const only = content[0] as Record<string, unknown> | null;
- if (!only || typeof only !== 'object' || only['type'] !== 'text' || typeof only['text'] !== 'string') return content;
- // Only the type and the text survive: the marker is dropped by the walk above, and a lone text
- // block carries nothing else the plain spelling could have kept.
- return [{ type: 'text', text: only['text'] }];
-}
diff --git a/packages/conversation-view/src/prompt/store.ts b/packages/conversation-view/src/prompt/store.ts
index 26b6069b..c0d79ad1 100644
--- a/packages/conversation-view/src/prompt/store.ts
+++ b/packages/conversation-view/src/prompt/store.ts
@@ -79,9 +79,74 @@ export interface PromptManifest {
call?: string;
request?: string;
previous_request?: string;
+ /** What a request says of its call's history: the rules it was written under, its message list,
+ * and a Claude Code request's provider thread. See Session Data, History. */
+ history_form?: string;
+ messages?: unknown;
+ thread?: unknown;
segments: PromptSegment[];
}
+/** One message of a request's history, as a manifest names it: the digest of the id the runtime sent,
+ * when it sent one, and the digest of the message's form. */
+export interface HistoryEntry {
+ id?: string;
+ digest: string;
+}
+
+/** Eight bytes in hex, either case, as the Sessionizer's reader takes a digest. */
+const DIGEST = /^[0-9a-fA-F]{16}$/;
+
+/** A JSON key that is there with a value; a null is read as no key, as the Sessionizer's reader reads it. */
+function has(o: Record<string, unknown>, key: string): boolean {
+ return o[key] !== undefined && o[key] !== null;
+}
+
+/** An entry, its digests in lower case: the Sessionizer reads a digest as the number it spells, so two
+ * spellings of one number are one digest. */
+function entryOf(v: unknown): HistoryEntry | null {
+ if (!v || typeof v !== 'object' || Array.isArray(v)) return null;
+ const o = v as Record<string, unknown>;
+ const digest = o['digest'];
+ if (typeof digest !== 'string' || !DIGEST.test(digest)) return null;
+ if (!has(o, 'id') || o['id'] === '') return { digest: digest.toLowerCase() };
+ const id = o['id'];
+ return typeof id === 'string' && DIGEST.test(id) ? { id: id.toLowerCase(), digest: digest.toLowerCase() } : null;
+}
+
+/** Whether a value has the shape of an entry, whatever its digests say: an object whose id and digest,
+ * when there, are strings. */
+function entryShaped(v: unknown): boolean {
+ if (v === null) return true;
+ if (typeof v !== 'object' || Array.isArray(v)) return false;
+ const o = v as Record<string, unknown>;
+ return ['id', 'digest'].every((k) => !has(o, k) || typeof o[k] === 'string');
+}
+
+/** Whether every field a message list may carry has its type, as the Sessionizer's reader takes the
+ * list whole: a field of another type makes the list one it does not read, whatever its shape. */
+function typed(l: Record<string, unknown>): boolean {
+ const list = (v: unknown) => Array.isArray(v) && v.every(entryShaped);
+ // An integer a number in JavaScript holds exactly: past that, two counts read as one.
+ const integer = (v: unknown) => typeof v === 'number' && Number.isSafeInteger(v);
+ const text = (v: unknown) => typeof v === 'string';
+ const rules: Array<[string, (v: unknown) => boolean]> = [
+ ['entries', list], ['add', list], ['base', text], ['unavailable', text], ['keep', integer], ['count', integer],
+ ];
+ return rules.every(([k, ok]) => !has(l, k) || ok(l[k]));
+}
+
+function entriesOf(v: unknown): HistoryEntry[] | null {
+ if (!Array.isArray(v)) return null;
+ const out: HistoryEntry[] = [];
+ for (const x of v) {
+ const e = entryOf(x);
+ if (!e) return null;
+ out.push(e);
+ }
+ return out;
+}
+
interface Part {
kind: string;
/** The part's `data` as the record line spells it, or null when it has none. */
@@ -325,12 +390,37 @@ export class PromptStore {
throw new PromptError(`${record.id} was removed by retention`, STATE_REMOVED);
}
- /** The record a response with that provider request id carries, or null. */
- responseOfRequestId(requestId: string): PromptRecord | null {
- for (const r of this.records.values()) {
- if (r.manifest.role === ROLE_RESPONSE && r.manifest.request === requestId) return r;
+ /**
+ * The whole message list of the request held under a record id, or null when it carries none or
+ * it does not read: a list against a base is the base's first entries and its own, and the base
+ * must have landed before it, in the same form, holding at least what is kept of it.
+ */
+ listOf(id: string, depth = 0): HistoryEntry[] | null {
+ const record = this.records.get(id);
+ const m = record?.manifest;
+ if (!record || !m || m.role !== ROLE_REQUEST || !m.history_form) return null;
+ if (!m.messages || typeof m.messages !== 'object' || Array.isArray(m.messages)) return null;
+ // Exactly one of the three shapes, as the Sessionizer's reader takes them; any mix is no list.
+ const l = m.messages as Record<string, unknown>;
+ if (!typed(l) || has(l, 'unavailable')) return null;
+ if (has(l, 'entries')) return has(l, 'base') ? null : entriesOf(l['entries']);
+ if (!has(l, 'base') || !has(l, 'keep') || !has(l, 'add') || depth >= MAX_DEPTH) return null;
+ const keep = l['keep'];
+ if (typeof l['base'] !== 'string' || l['base'] === '' || typeof keep !== 'number' || !Number.isInteger(keep) || keep < 1 || keep > 0xffffffff) {
+ return null;
}
- return null;
+ const base = this.records.get(l['base']);
+ const add = entriesOf(l['add']);
+ if (!base || !add || base.manifest.history_form !== m.history_form) return null;
+ if (base.seq > record.seq || (base.seq === record.seq && base.row >= record.row)) return null;
+ const prior = this.listOf(l['base'], depth + 1);
+ if (!prior || keep > prior.length) return null;
+ return [...prior.slice(0, keep), ...add];
+ }
+
+ /** The record id of the body at a landed position, or null when it is not held. */
+ idAt(seq: number, row: number): string | null {
+ return this.byPosition.get(`${seq}/${row}`)?.id ?? null;
}
private add(record: PromptRecord): AddOutcome {
diff --git a/packages/conversation-view/src/strings.ts b/packages/conversation-view/src/strings.ts
index 832d92e4..18ac4f3c 100644
--- a/packages/conversation-view/src/strings.ts
+++ b/packages/conversation-view/src/strings.ts
@@ -281,8 +281,6 @@ export interface ViewStrings {
promptWholeRequest: string;
promptWholeBody: string;
promptChanges: string;
- promptNoPrevious: string;
- promptNoPreviousNamed: string;
promptSystem: string;
promptTools: string;
promptMessages: string;
@@ -290,12 +288,37 @@ export interface ViewStrings {
promptMessagesNote: string;
promptSettings: string;
promptBlocks: string;
- promptShared: string;
- promptRewritten: string;
- promptCompacted: string;
promptAlsoChanged: string;
promptAdded: string;
promptNothingAdded: string;
+ historyRole: string;
+ historyChanged: string;
+ historyCounts: string;
+ historyOrderChanged: string;
+ historyOrderUnknown: string;
+ historySystemChanged: string;
+ historyReplyBack: string;
+ historyReplyBackChanged: string;
+ historyReplyNotFound: string;
+ historyReplyUnknown: string;
+ promptHistoryFirst: string;
+ promptReset: string;
+ promptResetSummary: string;
+ promptHistoryAuxiliary: string;
+ promptHistoryInternal: string;
+ promptHistoryUnavailable: string;
+ promptHistoryNone: string;
+ promptHistoryKept: string;
+ promptHistoryKeptAll: string;
+ promptHistoryChanged: string;
+ historySystemUnknown: string;
+ promptToolsWord: string;
+ promptThreadHeld: string;
+ promptDropped: string;
+ promptMarkKept: string;
+ promptMarkChanged: string;
+ promptMarkAdded: string;
+ promptMarkDropped: string;
promptStopReason: string;
promptThinking: string;
promptReminder: string;
@@ -611,9 +634,7 @@ export const ENGLISH: ViewStrings = {
promptRequestModes: 'How much of the request to show',
promptWholeRequest: 'Whole request',
promptWholeBody: 'The body',
- promptChanges: 'What it added',
- promptNoPrevious: 'The request before this one is not among the loaded bodies, so there is nothing to compare with.',
- promptNoPreviousNamed: 'This request names no request before it, so there is nothing to compare with.',
+ promptChanges: 'What changed',
promptSystem: 'System prompt',
promptTools: 'Tools ({count})',
promptMessages: 'Messages ({count})',
@@ -621,12 +642,37 @@ export const ENGLISH: ViewStrings = {
promptMessagesNote: '{bytes} bytes as sent',
promptSettings: 'Settings',
promptBlocks: '{count} block(s), {bytes} bytes',
- promptShared: 'The {count} message(s) before are as the call before sent them, {bytes} bytes.',
- promptRewritten: 'The history before this point was rewritten, and not by a compaction.',
- promptCompacted: 'The context was replaced by a summary here, so the list starts again: {before} message(s) became {after}.',
promptAlsoChanged: 'Also changed: {what}.',
promptAdded: 'Added by this call ({count})',
promptNothingAdded: 'This request adds no message.',
+ historyRole: 'History',
+ historyChanged: 'History changed · cause unavailable',
+ historyCounts: '{kept} kept, {changed} changed, {dropped} dropped, {added} added',
+ historyOrderChanged: 'the order changed',
+ historyOrderUnknown: 'whether the order changed is not known',
+ historySystemChanged: 'the system prompt changed',
+ historyReplyBack: 'the previous reply is included unchanged',
+ historyReplyBackChanged: 'the previous reply is included with changes',
+ historyReplyNotFound: 'the previous reply was not found in this history',
+ historyReplyUnknown: 'whether the previous reply is included is not known',
+ promptHistoryFirst: 'This is the first call of its stream since the context began, so there is nothing to compare with.',
+ promptReset: 'The context was reset here, so there is nothing before this call to compare with.',
+ promptResetSummary: 'The context was reset here and replaced by a summary, so there is nothing before this call to compare with.',
+ promptHistoryAuxiliary: 'A call of an auxiliary stream is not compared with the calls around it.',
+ promptHistoryInternal: 'The framework made this call for its own purpose, so it is not compared with the calls around it.',
+ promptHistoryUnavailable: 'This history cannot be compared with the call before it: {why}.',
+ promptHistoryNone: 'This request does not record its history, so there is nothing to compare with.',
+ promptHistoryKept: 'The history of the call before is kept whole: its {count} message(s) come first, as it sent them.',
+ promptHistoryKeptAll: 'The history of the call before is kept whole.',
+ promptHistoryChanged: 'The history of the call before changed:',
+ historySystemUnknown: 'whether the system prompt changed is not known',
+ promptToolsWord: 'Tools',
+ promptThreadHeld: 'This request continues a provider thread: it holds only its new messages, and the provider keeps the rest.',
+ promptDropped: 'Dropped from the call before ({count})',
+ promptMarkKept: 'kept',
+ promptMarkChanged: 'changed',
+ promptMarkAdded: 'added',
+ promptMarkDropped: 'dropped',
promptStopReason: 'stopped: {reason}',
promptThinking: 'Thinking',
promptReminder: 'Injected by the runtime',
diff --git a/packages/conversation-view/src/styles.css b/packages/conversation-view/src/styles.css
index 711f664b..72b5db28 100644
--- a/packages/conversation-view/src/styles.css
+++ b/packages/conversation-view/src/styles.css
@@ -49,6 +49,11 @@
--acv-kind-agent: var(--sw-series-5);
--acv-kind-instruction: var(--sw-series-6);
--acv-kind-annotation: var(--sw-series-7);
+ /* Where a call's history changed is no reset, so it takes no reset's colour. Every series colour is
+ some kind's, and the eighth is the error colour in every theme, so this is a hue between the
+ first and the fourth that no kind uses; its card is dashed as well, so it does not rest on
+ colour alone. */
+ --acv-kind-history: color-mix(in srgb, var(--sw-series-1) 50%, var(--sw-series-4));
--acv-kind-error: var(--sw-err);
--acv-edge: var(--sw-fg-2);
--acv-owns: var(--sw-fg-3);
@@ -214,6 +219,7 @@
.acv-kind-agent { color: var(--acv-kind-agent); }
.acv-kind-instruction { color: var(--acv-kind-instruction); }
.acv-kind-annotation { color: var(--acv-kind-annotation); }
+.acv-kind-history { color: var(--acv-kind-history); }
.acv-kind-error { color: var(--acv-kind-error); }
.acv-clip.nested { height: 32px; border-width: 2px; border-radius: 7px; background: linear-gradient(180deg, color-mix(in srgb, var(--acv-kind-agent) 28%, var(--acv-surface)), color-mix(in srgb, var(--acv-kind-agent) 13%, var(--acv-surface))); }
.acv-clip.nested::before { width: 9px; height: 7px; border-radius: 2px 2px 1px 1px; box-shadow: 3px -3px 0 -1px currentColor; }
@@ -228,6 +234,7 @@
.acv-clip.acv-kind-agent { color: var(--acv-kind-agent); }
.acv-clip.acv-kind-instruction { color: var(--acv-kind-instruction); }
.acv-clip.acv-kind-annotation { color: var(--acv-kind-annotation); }
+.acv-clip.acv-kind-history { color: var(--acv-kind-history); border-style: dashed; }
.acv-clip.acv-kind-error { color: var(--acv-kind-error); }
/* Selection is the outline: the clip keeps its own colour, because the colour
says what kind of step it is and that does not change by being looked at. */
@@ -537,3 +544,12 @@ select.acv-stream-btn { border: 1px solid var(--acv-line); background: var(--acv
.acv-prompt-tool:last-child { border-bottom: 0; }
.acv-prompt-tool-name { font-weight: 600; }
.acv-prompt-facts { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
+
+/* A history.change card: dashed in its own colour, with what changed on one line beneath its title. */
+.acv-card.acv-history { border-style: dashed; border-color: color-mix(in srgb, var(--acv-kind-history) 60%, transparent); }
+.acv-history-line { display: block; margin-top: 4px; color: var(--acv-faint); font-size: 12px; }
+/* What the Prompt tab says of each message against the request before it. */
+.acv-history-mark { margin-left: 8px; padding: 0 6px; border-radius: var(--acv-radius); border: 1px solid currentColor; font-size: 10px; font-weight: 650; }
+.acv-history-mark.added { color: var(--acv-kind-user); }
+.acv-history-mark.changed, .acv-history-mark.dropped { color: var(--acv-kind-history); }
+.acv-history-mark.kept { color: var(--acv-faint); }
diff --git a/packages/conversation-view/src/view/history.ts b/packages/conversation-view/src/view/history.ts
new file mode 100644
index 00000000..a883033a
--- /dev/null
+++ b/packages/conversation-view/src/view/history.ts
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/** What the page says of where a call's history changed: the card's line, and the earlier reply's fate. */
+
+import type { Step } from '../model.js';
+import { fill } from '../strings.js';
+import type { ViewContext } from './context.js';
+
+/** What a history.change card says beneath its title: what was kept, changed, dropped and added, and
+ * what else changed with them. */
+export function historyLine(ctx: ViewContext, e: Step): string {
+ const { s } = ctx;
+ const a = e.attrs ?? {};
+ // The counts are said only when the card has all four; a count it does not carry is not zero.
+ const keys = ['kept', 'changed', 'dropped', 'added'] as const;
+ const counts = keys.every((k) => typeof a[k] === 'number')
+ ? [fill(s.historyCounts, Object.fromEntries(keys.map((k) => [k, String(a[k])])))]
+ : [];
+ return [...counts, ...historyNotes(ctx, a, 'reply')].join(' · ');
+}
+
+/** What else a comparison found, from a card's attributes or a call's: whether the order and the
+ * system prompt changed, and what became of the earlier call's reply, named by replyKey. */
+export function historyNotes(ctx: ViewContext, a: Record<string, unknown>, replyKey: string): string[] {
+ const { s } = ctx;
+ const out: string[] = [];
+ if (a['order_changed'] === 'yes') out.push(s.historyOrderChanged);
+ if (a['order_changed'] === 'unavailable') out.push(s.historyOrderUnknown);
+ if (a['system_changed'] === 'yes') out.push(s.historySystemChanged);
+ if (a['system_changed'] === 'unavailable') out.push(s.historySystemUnknown);
+ const reply = replyText(ctx, a[replyKey]);
+ if (reply) out.push(reply);
+ return out;
+}
+
+/** What became of the earlier call's reply, as a call or a card says it. */
+export function replyText(ctx: ViewContext, status: unknown): string {
+ const { s } = ctx;
+ switch (status) {
+ case 'back':
+ return s.historyReplyBack;
+ case 'back_changed':
+ return s.historyReplyBackChanged;
+ case 'not_found':
+ return s.historyReplyNotFound;
+ case 'unavailable':
+ return s.historyReplyUnknown;
+ }
+ return '';
+}
diff --git a/packages/conversation-view/src/view/prompt.ts b/packages/conversation-view/src/view/prompt.ts
index 168cad3f..056b23b6 100644
--- a/packages/conversation-view/src/view/prompt.ts
+++ b/packages/conversation-view/src/view/prompt.ts
@@ -22,28 +22,36 @@
*
* The document says only where the bodies landed. This tab loads the session's provider files up to
* that position when the reader asks, rebuilds the two bodies, and shows them: the request whole or as
- * what it added to the call before it, and the response plainly. Nothing is loaded before the reader
+ * what changed against the call before it, and the response plainly. Nothing is loaded before the reader
* presses the button, and what is loaded is kept, so the next call on the same session costs only the
* files that landed after it.
*/
import { esc } from '../dom.js';
-import type { Step } from '../model.js';
+import { cardCall, type Step } from '../model.js';
import { fill } from '../strings.js';
import type { AszProviderBody, AszRef } from '../types.js';
import {
- deltaOf,
+ outsideOf,
readBody,
type PromptBlock,
- type PromptDelta,
type PromptMessage,
type ReadBody,
type ReadRequest,
type ReadResponse,
} from '../prompt/messages.js';
-import { PromptError, ROLE_REQUEST, ROLE_RESPONSE, STATE_REMOVED, STATE_TOO_LARGE, type PromptManifest } from '../prompt/store.js';
+import {
+ PromptError,
+ ROLE_REQUEST,
+ ROLE_RESPONSE,
+ STATE_REMOVED,
+ STATE_TOO_LARGE,
+ type HistoryEntry,
+ type PromptManifest,
+} from '../prompt/store.js';
import type { ViewContext } from './context.js';
import { copyButton, copyField } from './structured.js';
+import { historyLine, historyNotes } from './history.js';
/** Seqs asked for in one request, the OAP route's own limit. */
const BATCH = 32;
@@ -251,19 +259,14 @@ function drawUnloaded(ctx: ViewContext, body: HTMLElement, sides: Sides, failed?
};
}
-function drawRequest(ctx: ViewContext, e: Step, read: ReadRequest, sides: Sides, store: ReturnType<ViewContext['prompts']['store']>): string {
+function drawRequest(ctx: ViewContext, e: Step, read: ReadRequest, sides: Sides, store: Store): string {
const { s, f, state } = ctx;
- const previous = state.promptWhole ? null : previousRequest(ctx, e, sides, store);
const modes = `
<div class="acv-prompt-modes" role="group" aria-label="${esc(s.promptRequestModes)}">
<button type="button" class="acv-chip${state.promptWhole ? ' on' : ''}" data-prompt-whole="1" aria-pressed="${state.promptWhole}">${esc(s.promptWholeRequest)}</button>
<button type="button" class="acv-chip${state.promptWhole ? '' : ' on'}" data-prompt-whole="0" aria-pressed="${!state.promptWhole}">${esc(s.promptChanges)}</button>
</div>`;
- if (!state.promptWhole) {
- if (previous === UNNAMED) return `${modes}<div class="acv-empty">${esc(s.promptNoPreviousNamed)}</div>`;
- if (!previous) return `${modes}<div class="acv-empty">${esc(s.promptNoPrevious)}</div>`;
- return `${modes}${drawDelta(ctx, e, deltaOf(previous, read), read, previous.messages.length)}`;
- }
+ if (!state.promptWhole) return `${modes}${drawHistory(ctx, e, read, sides, store)}`;
const system = read.system.length
? section(ctx, e, 'system', s.promptSystem, blockSummary(ctx, read.system), read.system.map((b, i) => block(ctx, b, `${e.id}|req|sys|${i}`)).join(''))
: '';
@@ -297,68 +300,192 @@ function drawRequest(ctx: ViewContext, e: Step, read: ReadRequest, sides: Sides,
return `${modes}${system}${tools}${messages}${settings}${whole}`;
}
-/** A request that names no request before it: the first of its chain, or one whose runtime does not
- * say, as a LangChain agent's does not. Nothing is missing then, and the panel must not say so. */
-const UNNAMED = 'unnamed';
+type Store = ReturnType<ViewContext['prompts']['store']>;
-/** The request of the call before this one in the same chain, found by the ids the bodies carry:
- * this request names the request before it, the response of that request names its call, and the
- * document says where that call's request landed. A chain that cannot be followed gives nothing,
- * because a copy segment is storage, not a relationship. */
-function previousRequest(
- ctx: ViewContext,
- e: Step,
- sides: Sides,
- store: ReturnType<ViewContext['prompts']['store']>,
-): ReadRequest | typeof UNNAMED | null {
- if (!sides.request) return null;
- const mine = store.manifestAt(sides.request.seq, sides.request.row);
- if (mine && !mine.previous_request) return UNNAMED;
- if (!mine?.previous_request) return null;
- const response = store.responseOfRequestId(mine.previous_request);
- if (!response?.manifest.call) return null;
- const call = response.manifest.call;
- for (const step of ctx.model.stepById.values()) {
- const bodies = bodiesOf(step);
- const theirResponse = bodies.find((b) => b.role === ROLE_RESPONSE)?.ref;
- const theirRequest = bodies.find((b) => b.role === ROLE_REQUEST)?.ref;
- if (!theirResponse || !theirRequest || step.id === e.id) continue;
- if (store.manifestAt(theirResponse.seq, theirResponse.row)?.call !== call) continue;
- try {
- const read = readBody(store.bodyAt(theirRequest.seq, theirRequest.row), ROLE_REQUEST);
- return read.kind === 'request' ? read : null;
- } catch {
- return null;
- }
+/** What one message of a request is against the history before it. */
+type Mark = 'kept' | 'changed' | 'added';
+
+/**
+ * What this request's history is against the call before it, as the call says it: the document
+ * compared the two histories from the manifests, so this tab says what it found and never guesses
+ * from where messages sit. A request that continues a provider thread holds only its new messages,
+ * so a list read by position from the body alone would call every such request rewritten.
+ */
+function drawHistory(ctx: ViewContext, e: Step, read: ReadRequest, sides: Sides, store: Store): string {
+ const { s } = ctx;
+ const a = e.attrs ?? {};
+ const history = a['history'];
+ const reason = typeof a['history_reason'] === 'string' ? a['history_reason'] : '';
+ const note = (text: string) => `<div class="acv-empty">${esc(text)}</div>`;
+ switch (history) {
+ case 'kept':
+ case 'changed':
+ break;
+ case 'first':
+ return note(resetBefore(ctx, e) ?? s.promptHistoryFirst);
+ case 'not_compared':
+ if (reason === 'auxiliary_stream') return note(s.promptHistoryAuxiliary);
+ if (reason === 'internal_call') return note(s.promptHistoryInternal);
+ return note(fill(s.promptHistoryUnavailable, { why: reason || 'not_compared' }));
+ case 'unavailable':
+ return note(fill(s.promptHistoryUnavailable, { why: reason || 'unavailable' }));
+ default:
+ return note(s.promptHistoryNone);
+ }
+ const before = ctx.model.step(typeof a['history_from'] === 'string' ? a['history_from'] : null);
+ const ref = sides.request;
+ const own = ref ? store.idAt(ref.seq, ref.row) : null;
+ const mine = ref ? store.manifestAt(ref.seq, ref.row) : null;
+ const theirs = before ? requestOf(store, before) : null;
+
+ const lines: string[] = [];
+ const card = history === 'changed' ? cardOf(ctx, e) : null;
+ if (history === 'kept') {
+ const kept = before?.attrs?.['history_messages'];
+ lines.push(typeof kept === 'number' ? fill(s.promptHistoryKept, { count: String(kept) }) : s.promptHistoryKeptAll);
+ } else {
+ lines.push(card ? `${s.promptHistoryChanged} ${historyLine(ctx, card)}` : s.promptHistoryChanged);
}
+ // The card's line says what else changed; a kept history has no card, and the call says it.
+ const notes = card ? [] : historyNotes(ctx, a, 'history_reply');
+ if (notes.length) lines.push(notes.join(' · '));
+ const continues = threadOf(mine) === 'continue';
+ if (theirs?.read) {
+ const outside = outsideOf(theirs.read, read, continues || theirs.continues);
+ const what = [outside.tools ? s.promptToolsWord : '', outside.settings ? s.promptSettings : ''].filter(Boolean);
+ if (what.length) lines.push(fill(s.promptAlsoChanged, { what: what.join(', ') }));
+ }
+ if (continues) lines.push(s.promptThreadHeld);
+ const said = lines.map((l) => `<div class="acv-faint">${esc(l)}</div>`).join('');
+
+ const total = read.messages.length;
+ const drawn = (marks: (Mark | null)[], only?: Mark[]) =>
+ read.messages
+ .map((m, i) => ({ m, i, mark: marks[i] ?? null }))
+ .filter((x) => !only || (x.mark && only.includes(x.mark)))
+ .map((x) => message(ctx, x.m, x.i + 1, total, `${e.id}|req|msg|${x.i}`, x.mark ?? undefined))
+ .join('');
+
+ const ownList = own ? store.listOf(own) : null;
+ if (history === 'kept') {
+ const marks = keptMarks(a['history_messages'], before?.attrs?.['history_messages'], total, ownList?.length ?? null, continues);
+ if (!marks) return `${said}${drawn([])}`;
+ const added = marks.filter((m) => m === 'added').length;
+ const list = added ? drawn(marks, ['added']) : `<div class="acv-empty">${esc(s.promptNothingAdded)}</div>`;
+ return `${said}<div class="acv-kicker" style="margin-top:12px">${esc(fill(s.promptAdded, { count: String(added) }))}</div>${list}`;
+ }
+ // A changed history is marked message by message only when both lists are whole in their bodies;
+ // with a thread the bodies hold a part of each history, and the card's counts say the rest.
+ const N = continues ? null : ownList;
+ const P = theirs && !theirs.continues ? store.listOf(theirs.id) : null;
+ const found = N && P && N.length === total ? changedMarks(P, N) : null;
+ if (!found || !P) return `${said}${drawn([])}`;
+ const { marks, dropped } = found;
+ const gone =
+ theirs?.read && theirs.read.messages.length === P.length
+ ? dropped.map((i) => message(ctx, theirs.read!.messages[i]!, i + 1, P.length, `${e.id}|req|was|${i}`, 'dropped')).join('')
+ : '';
+ return `${said}${drawn(marks)}${gone ? `<div class="acv-kicker" style="margin-top:12px">${esc(fill(s.promptDropped, { count: String(dropped.length) }))}</div>${gone}` : ''}`;
+}
+
+/** The card drawn before a call, which names the call as the one it changed to. */
+function cardOf(ctx: ViewContext, e: Step): Step | null {
+ for (const x of ctx.model.steps(e.stream)) if (x.kind === 'history.change' && cardCall(x) === e.id) return x;
return null;
}
-function drawDelta(ctx: ViewContext, e: Step, delta: PromptDelta, read: ReadRequest, previousCount: number): string {
- const { s, f } = ctx;
- const changed = [
- delta.systemChanged ? s.promptSystem : '',
- delta.toolsChanged ? fill(s.promptTools, { count: String(read.tools.length) }) : '',
- delta.settingsChanged ? s.promptSettings : '',
- ].filter(Boolean);
- const notes = [
- `<div class="acv-faint">${esc(fill(s.promptShared, { count: String(delta.sharedMessages), bytes: f.number(delta.sharedBytes) }))}</div>`,
- // A compaction is not a fault: it is the runtime replacing the context with a summary, which the
- // conversation records as its own step. Saying which of the two happened is the whole value of
- // the note -- a warning on every ordinary growth would say nothing.
- delta.replaced
- ? `<div class="acv-faint">${esc(fill(s.promptCompacted, { before: String(previousCount), after: String(read.messages.length) }))}</div>`
- : delta.rewritten
- ? `<div class="acv-warning">${esc(s.promptRewritten)}</div>`
- : '',
- changed.length ? `<div class="acv-faint">${esc(fill(s.promptAlsoChanged, { what: changed.join(', ') }))}</div>` : '',
- ].join('');
- const added = delta.added.length
- ? delta.added
- .map((m, i) => message(ctx, m, delta.sharedMessages + i + 1, read.messages.length, `${e.id}|req|msg|${delta.sharedMessages + i}`))
- .join('')
- : `<div class="acv-empty">${esc(s.promptNothingAdded)}</div>`;
- return `${notes}<div class="acv-kicker" style="margin-top:12px">${esc(fill(s.promptAdded, { count: String(delta.added.length) }))}</div>${added}`;
+/** The request body of a call, as this tab reads it, its record id, and whether it continues a
+ * provider thread; null when it has none held. */
+function requestOf(store: Store, step: Step): { id: string; read: ReadRequest | null; continues: boolean } | null {
+ const ref = bodiesOf(step).find((b) => b.role === ROLE_REQUEST)?.ref;
+ const id = ref ? store.idAt(ref.seq, ref.row) : null;
+ if (!ref || !id) return null;
+ let read: ReadRequest | null = null;
+ try {
+ const r = readBody(store.bodyAt(ref.seq, ref.row), ROLE_REQUEST);
+ if (r.kind === 'request') read = r;
+ } catch {
+ // a body that does not rebuild compares nothing outside its messages
+ }
+ return { id, read, continues: threadOf(store.manifestAt(ref.seq, ref.row)) === 'continue' };
+}
+
+function threadOf(m: PromptManifest | null): string {
+ const t = m?.thread;
+ return t && typeof t === 'object' && typeof (t as { type?: unknown }).type === 'string' ? (t as { type: string }).type : '';
+}
+
+/**
+ * Each message of a kept history, by where it sits: the history is the one before it with more after it,
+ * so a message whose place is before the earlier history's length is kept and any other is added. A
+ * request's messages are the last of its history: all of it for a whole list, its new messages for one
+ * that continues a thread. The body must hold what its manifest lists, one message an entry, or a
+ * message's place is not known and nothing is marked.
+ *
+ * @param n the call's history length, and p the earlier call's
+ * @param total the messages the body holds, and own the entries its manifest lists
+ */
+export function keptMarks(n: unknown, p: unknown, total: number, own: number | null, continues: boolean): Mark[] | null {
+ if (typeof n !== 'number' || typeof p !== 'number' || p > n || own !== total) return null;
+ if (continues ? total > n : total !== n) return null;
+ const offset = n - total;
+ return Array.from({ length: total }, (_, i) => (offset + i < p ? 'kept' : 'added'));
+}
+
+/**
+ * Each message of a changed history against the one before, by the same counts the card gives: a
+ * message the earlier history holds as it is is kept; one that shares an id with an earlier message
+ * left over is changed; any other is added. The earlier messages left over are dropped. Each message
+ * is marked only when the pairing is certain: with an id twice in a list, or two messages of one
+ * digest and no id, which earlier message became which is not known, and only the counts hold.
+ */
+export function changedMarks(P: HistoryEntry[], N: HistoryEntry[]): { marks: Mark[]; dropped: number[] } | null {
+ const key = (x: HistoryEntry) => (x.id ? `i${x.id}|${x.digest}` : `d${x.digest}`);
+ const index = (list: HistoryEntry[]) => {
+ const byKey = new Map<string, number>();
+ const byId = new Map<string, number>();
+ for (const [i, x] of list.entries()) {
+ if (x.id ? byId.has(x.id) : byKey.has(key(x))) return null;
+ byKey.set(key(x), i);
+ if (x.id) byId.set(x.id, i);
+ }
+ return { byKey, byId };
+ };
+ const p = index(P);
+ if (!p || !index(N)) return null;
+ const used = new Set<number>();
+ const marks: (Mark | null)[] = N.map((x) => {
+ const at = p.byKey.get(key(x));
+ if (at === undefined) return null;
+ used.add(at);
+ return 'kept';
+ });
+ N.forEach((x, j) => {
+ const at = x.id ? p.byId.get(x.id) : undefined;
+ if (marks[j] || at === undefined || used.has(at)) return;
+ used.add(at);
+ marks[j] = 'changed';
+ });
+ const dropped = P.map((_, i) => i).filter((i) => !used.has(i));
+ return { marks: marks.map((m) => m ?? 'added'), dropped };
+}
+
+/**
+ * What to say of a first call after a reset, from the reset itself, and a summary only when the reset
+ * has one. A history that starts again without one is never called a reset here. A first call has no
+ * predecessor in its epoch, so any call between it and the epoch's start is one the framework made for
+ * its own purpose, recorded with its class or not: the nearest boundary before it is where its context
+ * began, and with none it is the conversation's first context.
+ */
+function resetBefore(ctx: ViewContext, e: Step): string | null {
+ const steps = ctx.model.steps(e.stream);
+ for (let i = steps.findIndex((x) => x.id === e.id) - 1; i >= 0; i--) {
+ const x = steps[i]!;
+ if (x.kind !== 'epoch.boundary') continue;
+ const summary = x.edges.some((g) => g.type === 'summarizes' && g.dir === 'in');
+ return summary ? ctx.s.promptResetSummary : ctx.s.promptReset;
+ }
+ return null;
}
function drawResponse(ctx: ViewContext, e: Step, read: ReadResponse): string {
@@ -433,8 +560,9 @@ function documentSection(ctx: ViewContext, e: Step, key: string, title: string,
* it then used - and without the box a reader counts the blocks and finds more of them than the
* section says there are messages.
*/
-function message(ctx: ViewContext, m: PromptMessage, n: number, total: number, key: string): string {
+function message(ctx: ViewContext, m: PromptMessage, n: number, total: number, key: string, mark?: Mark | 'dropped'): string {
const { s } = ctx;
+ const marked = mark ? `<span class="acv-history-mark ${mark}">${esc(markText(ctx, mark))}</span>` : '';
// A message that is one text with no label of its own has no title but the message's, so its copy
// button goes there rather than on a title row of its own.
const only = m.blocks.length === 1 && m.blocks[0]!.kind === 'text' && !m.blocks[0]!.reminder ? m.blocks[0]! : null;
@@ -442,12 +570,17 @@ function message(ctx: ViewContext, m: PromptMessage, n: number, total: number, k
<div class="acv-prompt-message"${only ? ' data-copy-scope' : ''}>
<div class="acv-prompt-message-head">
<span><span class="acv-prompt-role">${esc(m.role || s.promptUnknownRole)}</span>${only ? copyOf(ctx, only.text ?? '') : ''}</span>
- <span class="acv-faint">${esc(fill(s.promptMessageOf, { n: String(n), total: String(total) }))}</span>
+ <span class="acv-faint">${esc(fill(s.promptMessageOf, { n: String(n), total: String(total) }))}${marked}</span>
</div>
<div class="acv-prompt-message-body">${m.blocks.map((b, i) => block(ctx, b, `${key}|${i}`, b === only)).join('')}</div>
</div>`;
}
+function markText(ctx: ViewContext, mark: Mark | 'dropped'): string {
+ const { s } = ctx;
+ return { kept: s.promptMarkKept, changed: s.promptMarkChanged, added: s.promptMarkAdded, dropped: s.promptMarkDropped }[mark];
+}
+
/**
* One block of a message.
*
diff --git a/packages/conversation-view/src/view/timeline.ts b/packages/conversation-view/src/view/timeline.ts
index d4830812..82cd4b34 100644
--- a/packages/conversation-view/src/view/timeline.ts
+++ b/packages/conversation-view/src/view/timeline.ts
@@ -526,7 +526,7 @@ export function bindTimeline(ctx: ViewContext): void {
ctx.state.openTalks.add(tid);
ctx.state.autoOpen.add(tid);
}
- ctx.select(node.dataset.node!, true);
+ ctx.select(ctx.model.target(node.dataset.node!), true);
return;
}
const folder = target.closest<HTMLElement>('[data-folder]');
diff --git a/packages/conversation-view/src/view/transcript.ts b/packages/conversation-view/src/view/transcript.ts
index 0d9e254c..8f3c8a52 100644
--- a/packages/conversation-view/src/view/transcript.ts
+++ b/packages/conversation-view/src/view/transcript.ts
@@ -30,6 +30,7 @@ import { injectionSays, kindTitle, QUIET_MS } from '../vocabulary.js';
import { changePill, inlineChanges, redrawBoth } from './changes.js';
import { streamName, type ViewContext } from './context.js';
import { executionPill } from './executions.js';
+import { historyLine } from './history.js';
import { clipNote, copyButton, copyField, textBody } from './structured.js';
/** Characters past which a card clamps a text with a fade and offers the rest. */
@@ -102,6 +103,8 @@ function present(ctx: ViewContext, e: Step): Presentation {
return { cls: `acv-activity${child}`, role: `${agent} · ${s.modelCall}`, color: 'model' };
case 'thinking':
return { cls: `acv-activity${child}`, role: `${agent} · ${s.reasoning}`, color: 'model' };
+ case 'history.change':
+ return { cls: 'acv-activity acv-history', role: `${agent} · ${s.historyRole}`, color: 'history' };
case 'tool':
// A call to an MCP server names the server; its tool is the card's title.
return e.mcp
@@ -140,7 +143,7 @@ export function stepCard(ctx: ViewContext, e: Step, prev: Step | undefined, near
// key handler gives it Enter and Space.
return `${sep}<div class="acv-card ${p.cls}${e.id === state.sel ? ' selected' : ''}${
near && !near.has(e.id) ? ' dim' : ''
- }" role="button" tabindex="0" data-card="${esc(e.id)}" title="${esc(s.locateInTimeline)}"${
+ }" role="button" tabindex="0" data-card="${esc(m.target(e.id))}" title="${esc(s.locateInTimeline)}"${
indent ? ` style="--indent:${indent};margin-left:${indent * 22}px;max-width:calc(100% - ${indent * 22}px)"` : ''
}>
<span class="acv-time"><strong>${esc(f.time(e.at))}</strong>${esc(e.kind)}</span>
@@ -155,6 +158,7 @@ export function stepCard(ctx: ViewContext, e: Step, prev: Step | undefined, near
: ''
}
${e.result ? resultBlock(ctx, e) : ''}
+ ${e.kind === 'history.change' ? `<span class="acv-history-line">${esc(historyLine(ctx, e))}</span>` : ''}
${inlineChanges(ctx, e)}
</span></div>${link}`;
}
diff --git a/packages/conversation-view/src/vocabulary.ts b/packages/conversation-view/src/vocabulary.ts
index c17e3f9f..ca620e66 100644
--- a/packages/conversation-view/src/vocabulary.ts
+++ b/packages/conversation-view/src/vocabulary.ts
@@ -25,7 +25,7 @@ import type { ViewStrings } from './strings.js';
* plain-English name.
*/
export type Track = 'input' | 'messages' | 'context' | 'model' | 'tools' | 'mcp' | 'agents' | 'annotation';
-export type KindType = 'user' | 'assistant' | 'subagent-response' | 'model' | 'tool' | 'agent' | 'instruction' | 'annotation' | 'error';
+export type KindType = 'user' | 'assistant' | 'subagent-response' | 'model' | 'tool' | 'agent' | 'instruction' | 'annotation' | 'history' | 'error';
export interface KindMeta {
track: Track;
@@ -48,6 +48,8 @@ const KIND: Record<string, KindMeta> = {
'agent.launch_ack': { track: 'agents', type: 'agent', title: 'launchAcknowledged' },
'runtime.notification': { track: 'agents', type: 'agent', title: 'notificationFromChild' },
'epoch.boundary': { track: 'annotation', type: 'annotation', title: null, raw: 'Context reset' },
+ // Where a call's history changed with no reset: a type of its own, so its colour is not a reset's.
+ 'history.change': { track: 'annotation', type: 'history', title: 'historyChanged' },
'epoch.summary': { track: 'annotation', type: 'annotation', title: null, raw: 'Carried-forward summary' },
'turn.duration': { track: 'annotation', type: 'annotation', title: null, raw: 'Turn duration' },
'error.api': { track: 'annotation', type: 'error', title: null, raw: 'Provider error' },
diff --git a/packages/conversation-view/test/fixtures/history/forget.json b/packages/conversation-view/test/fixtures/history/forget.json
new file mode 100644
index 00000000..8c7e6675
--- /dev/null
+++ b/packages/conversation-view/test/fixtures/history/forget.json
@@ -0,0 +1,746 @@
+{
+ "format": "asz.view",
+ "version": "1.0",
+ "conversation": "5c9d8f2c-3d7a-4e93-8042-37270bc84c03",
+ "sessions": [
+ "5c9d8f2c-3d7a-4e93-8042-37270bc84c03"
+ ],
+ "head": {
+ "round": 1,
+ "digest": "9511df04f75c2f649bcafb3a95d2db3f7f749fd0f72d479f42e80b56b29bb918"
+ },
+ "parser": "v1",
+ "policy": "v1+idle=10m0s",
+ "summary": {
+ "title": "a history trimmed with no mark",
+ "state": "verified",
+ "problems": [],
+ "talks": 4,
+ "steps": 13,
+ "streams": 1,
+ "segments": 1,
+ "rounds": 1,
+ "unresolved": 0,
+ "changes": 0,
+ "provider_bodies": 8,
+ "captured_prompts": 4,
+ "from": 1767225600000,
+ "to": 1767225607000,
+ "kinds": {
+ "epoch": 1,
+ "history.change": 1,
+ "llm.call": 4,
+ "message.assistant": 4,
+ "message.external": 4,
+ "run": 4,
+ "segment": 1,
+ "session": 1,
+ "stream": 1,
+ "talk": 4
+ },
+ "relation_types": {
+ "in_segment": 4
+ },
+ "quality": {
+ "exact_unique": 4
+ },
+ "withheld": {}
+ },
+ "rounds": [
+ {
+ "round": 1,
+ "digest": "9511df04f75c2f649bcafb3a95d2db3f7f749fd0f72d479f42e80b56b29bb918",
+ "previous": null,
+ "from_seq": 1,
+ "through_seq": 2,
+ "input_digest": "2d411de23ae277904431aa8b9cac5a8636f86ae36ceae831cc982d24a9b6510e",
+ "from_time": 1767225600000,
+ "through_time": 1767225607000,
+ "verified": true
+ }
+ ],
+ "files": [
+ {
+ "file": "5c9d8f2c-3d7a-4e93-8042-37270bc84c03/streams/main/transcript-20260101T000000.000000000Z-000001.sd",
+ "format": "sd",
+ "kind": "transcript",
+ "seq": 1,
+ "round": null,
+ "stream": "main",
+ "run": null,
+ "lines": 11,
+ "bytes": 3132,
+ "digest": "2bdbe0bd36d3fe0203cb7b77d1ea636e42d6ba7536e8e988f6295aefaf4589fb",
+ "from_time": 1767225600000,
+ "through_time": 1767225607000
+ },
+ {
+ "file": "5c9d8f2c-3d7a-4e93-8042-37270bc84c03/provider_body/provider_body-20260101T000000.000000000Z-000002.sd",
+ "format": "sd",
+ "kind": "provider_body",
+ "seq": 2,
+ "round": null,
+ "stream": null,
+ "run": null,
+ "lines": 10,
+ "bytes": 19588,
+ "digest": "731ec4b7f5332a7c09aaaaac5f9076efa1ad495143f93b137557d98db309ca31",
+ "from_time": null,
+ "through_time": null
+ },
+ {
+ "file": "_conversations/5c9d8f2c-3d7a-4e93-8042-37270bc84c03/rounds/r000001-9511df04f75c.sf",
+ "format": "sf",
+ "kind": "round",
+ "seq": null,
+ "round": 1,
+ "stream": null,
+ "run": null,
+ "lines": 31,
+ "bytes": 7282,
+ "digest": "212f18c2027136f5141088677817b9e0f8d019f351aa11887fbedfe229eccf03",
+ "from_time": 1767225600000,
+ "through_time": 1767225607000
+ }
+ ],
+ "streams": [
+ {
+ "id": "stream/main",
+ "name": "main",
+ "role": "main",
+ "label": "",
+ "parent": "",
+ "records": 9,
+ "steps": 13,
+ "talk": "talk/main/s1-cycle",
+ "named_by": "",
+ "opened_by": []
+ }
+ ],
+ "segments": [
+ {
+ "id": "segment/at_1_2",
+ "talks": 4,
+ "from": 1767225600000,
+ "to": 1767225607000
+ }
+ ],
+ "talks": [
+ {
+ "id": "talk/main/s1-cycle",
+ "kind": "talk",
+ "parent": "epoch/main/0",
+ "stream": "main",
+ "at": 1767225600000,
+ "ref": {
+ "seq": 1,
+ "row": 2
+ },
+ "label": "what is the timeout?",
+ "reply": "It is 30 seconds.",
+ "runs": 1,
+ "steps": 3,
+ "from": 1767225600000,
+ "to": 1767225601000,
+ "segment": "segment/at_1_2",
+ "children": [
+ {
+ "id": "run/talk_main_s1-cycle/s1-cycle",
+ "kind": "run",
+ "parent": "talk/main/s1-cycle",
+ "stream": "main",
+ "at": 1767225600000,
+ "ref": {
+ "seq": 1,
+ "row": 2
+ },
+ "children": [
+ {
+ "id": "input/1/2",
+ "kind": "message.external",
+ "parent": "run/talk_main_s1-cycle/s1-cycle",
+ "stream": "main",
+ "at": 1767225600000,
+ "ref": {
+ "seq": 1,
+ "row": 2
+ },
+ "text": "what is the timeout?",
+ "state": "available",
+ "bytes": 20,
+ "flags": [
+ "external_input"
+ ]
+ },
+ {
+ "id": "call/s2-call-2d0e5ed6b2ef",
+ "kind": "llm.call",
+ "parent": "run/talk_main_s1-cycle/s1-cycle",
+ "stream": "main",
+ "at": 1767225601000,
+ "ref": {
+ "seq": 1,
+ "row": 3
+ },
+ "refs": [
+ {
+ "seq": 1,
+ "row": 3
+ }
+ ],
+ "attrs": {
+ "history": "first",
+ "history_messages": 1,
+ "usage": "observed_replayable",
+ "usage_at": {
+ "row": 3,
+ "seq": 1
+ },
+ "usage_from": "last_fragment_in_line_order"
+ },
+ "usage": {
+ "in": 2,
+ "out": 40,
+ "cache_read": 900,
+ "cache_write": 100
+ },
+ "provider_bodies": [
+ {
+ "role": "request",
+ "ref": {
+ "seq": 2,
+ "row": 1
+ }
+ },
+ {
+ "role": "response",
+ "ref": {
+ "seq": 2,
+ "row": 2
+ }
+ }
+ ],
+ "children": [
+ {
+ "id": "msg/1/3:0",
+ "kind": "message.assistant",
+ "parent": "call/s2-call-2d0e5ed6b2ef",
+ "stream": "main",
+ "at": 1767225601000,
+ "ref": {
+ "seq": 1,
+ "row": 3,
+ "block": 0
+ },
+ "text": "It is 30 seconds.",
+ "state": "available",
+ "bytes": 17,
+ "flags": [
+ "finished"
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "edges": [
+ {
+ "type": "in_segment",
+ "other": "segment/at_1_2",
+ "dir": "out",
+ "quality": "exact_unique",
+ "via": "activity window"
+ }
+ ]
+ },
+ {
+ "id": "talk/main/s3-cycle",
+ "kind": "talk",
+ "parent": "epoch/main/0",
+ "stream": "main",
+ "at": 1767225602000,
+ "ref": {
+ "seq": 1,
+ "row": 4
+ },
+ "label": "and the retries?",
+ "reply": "There are 3 retries.",
+ "runs": 1,
+ "steps": 3,
+ "from": 1767225602000,
+ "to": 1767225603000,
+ "segment": "segment/at_1_2",
+ "children": [
+ {
+ "id": "run/talk_main_s3-cycle/s3-cycle",
+ "kind": "run",
+ "parent": "talk/main/s3-cycle",
+ "stream": "main",
+ "at": 1767225602000,
+ "ref": {
+ "seq": 1,
+ "row": 4
+ },
+ "children": [
+ {
+ "id": "input/1/4",
+ "kind": "message.external",
+ "parent": "run/talk_main_s3-cycle/s3-cycle",
+ "stream": "main",
+ "at": 1767225602000,
+ "ref": {
+ "seq": 1,
+ "row": 4
+ },
+ "text": "and the retries?",
+ "state": "available",
+ "bytes": 16,
+ "flags": [
+ "external_input"
+ ]
+ },
+ {
+ "id": "call/s4-call-2d0e5ed6b2ef",
+ "kind": "llm.call",
+ "parent": "run/talk_main_s3-cycle/s3-cycle",
+ "stream": "main",
+ "at": 1767225603000,
+ "ref": {
+ "seq": 1,
+ "row": 5
+ },
+ "refs": [
+ {
+ "seq": 1,
+ "row": 5
+ }
+ ],
+ "attrs": {
+ "history": "kept",
+ "history_from": "call/s2-call-2d0e5ed6b2ef",
+ "history_messages": 3,
+ "history_reply": "back",
+ "system_changed": "no",
+ "usage": "observed_replayable",
+ "usage_at": {
+ "row": 5,
+ "seq": 1
+ },
+ "usage_from": "last_fragment_in_line_order"
+ },
+ "usage": {
+ "in": 2,
+ "out": 40,
+ "cache_read": 900,
+ "cache_write": 100
+ },
+ "provider_bodies": [
+ {
+ "role": "request",
+ "ref": {
+ "seq": 2,
+ "row": 3
+ }
+ },
+ {
+ "role": "response",
+ "ref": {
+ "seq": 2,
+ "row": 4
+ }
+ }
+ ],
+ "children": [
+ {
+ "id": "msg/1/5:0",
+ "kind": "message.assistant",
+ "parent": "call/s4-call-2d0e5ed6b2ef",
+ "stream": "main",
+ "at": 1767225603000,
+ "ref": {
+ "seq": 1,
+ "row": 5,
+ "block": 0
+ },
+ "text": "There are 3 retries.",
+ "state": "available",
+ "bytes": 20,
+ "flags": [
+ "finished"
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "edges": [
+ {
+ "type": "in_segment",
+ "other": "segment/at_1_2",
+ "dir": "out",
+ "quality": "exact_unique",
+ "via": "activity window"
+ }
+ ]
+ },
+ {
+ "id": "talk/main/s5-cycle",
+ "kind": "talk",
+ "parent": "epoch/main/0",
+ "stream": "main",
+ "at": 1767225604000,
+ "ref": {
+ "seq": 1,
+ "row": 6
+ },
+ "label": "and the backoff?",
+ "reply": "It doubles each time.",
+ "runs": 1,
+ "steps": 3,
+ "from": 1767225604000,
+ "to": 1767225605000,
+ "segment": "segment/at_1_2",
+ "children": [
+ {
+ "id": "run/talk_main_s5-cycle/s5-cycle",
+ "kind": "run",
+ "parent": "talk/main/s5-cycle",
+ "stream": "main",
+ "at": 1767225604000,
+ "ref": {
+ "seq": 1,
+ "row": 6
+ },
+ "children": [
+ {
+ "id": "input/1/6",
+ "kind": "message.external",
+ "parent": "run/talk_main_s5-cycle/s5-cycle",
+ "stream": "main",
+ "at": 1767225604000,
+ "ref": {
+ "seq": 1,
+ "row": 6
+ },
+ "text": "and the backoff?",
+ "state": "available",
+ "bytes": 16,
+ "flags": [
+ "external_input"
+ ]
+ },
+ {
+ "id": "call/s6-call-2d0e5ed6b2ef",
+ "kind": "llm.call",
+ "parent": "run/talk_main_s5-cycle/s5-cycle",
+ "stream": "main",
+ "at": 1767225605000,
+ "ref": {
+ "seq": 1,
+ "row": 7
+ },
+ "refs": [
+ {
+ "seq": 1,
+ "row": 7
+ }
+ ],
+ "attrs": {
+ "history": "kept",
+ "history_from": "call/s4-call-2d0e5ed6b2ef",
+ "history_messages": 5,
+ "history_reply": "back",
+ "system_changed": "no",
+ "usage": "observed_replayable",
+ "usage_at": {
+ "row": 7,
+ "seq": 1
+ },
+ "usage_from": "last_fragment_in_line_order"
+ },
+ "usage": {
+ "in": 2,
+ "out": 40,
+ "cache_read": 900,
+ "cache_write": 100
+ },
+ "provider_bodies": [
+ {
+ "role": "request",
+ "ref": {
+ "seq": 2,
+ "row": 5
+ }
+ },
+ {
+ "role": "response",
+ "ref": {
+ "seq": 2,
+ "row": 6
+ }
+ }
+ ],
+ "children": [
+ {
+ "id": "msg/1/7:0",
+ "kind": "message.assistant",
+ "parent": "call/s6-call-2d0e5ed6b2ef",
+ "stream": "main",
+ "at": 1767225605000,
+ "ref": {
+ "seq": 1,
+ "row": 7,
+ "block": 0
+ },
+ "text": "It doubles each time.",
+ "state": "available",
+ "bytes": 21,
+ "flags": [
+ "finished"
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "edges": [
+ {
+ "type": "in_segment",
+ "other": "segment/at_1_2",
+ "dir": "out",
+ "quality": "exact_unique",
+ "via": "activity window"
+ }
+ ]
+ },
+ {
+ "id": "talk/main/s8-cycle",
+ "kind": "talk",
+ "parent": "epoch/main/0",
+ "stream": "main",
+ "at": 1767225606000,
+ "ref": {
+ "seq": 1,
+ "row": 8
+ },
+ "label": "summarise the three",
+ "reply": "30 seconds, 3 retries, doubling backoff.",
+ "runs": 1,
+ "steps": 4,
+ "from": 1767225606000,
+ "to": 1767225607000,
+ "segment": "segment/at_1_2",
+ "children": [
+ {
+ "id": "run/talk_main_s8-cycle/s8-cycle",
+ "kind": "run",
+ "parent": "talk/main/s8-cycle",
+ "stream": "main",
+ "at": 1767225606000,
+ "ref": {
+ "seq": 1,
+ "row": 8
+ },
+ "children": [
+ {
+ "id": "input/1/8",
+ "kind": "message.external",
+ "parent": "run/talk_main_s8-cycle/s8-cycle",
+ "stream": "main",
+ "at": 1767225606000,
+ "ref": {
+ "seq": 1,
+ "row": 8
+ },
+ "text": "summarise the three",
+ "state": "available",
+ "bytes": 19,
+ "flags": [
+ "external_input"
+ ]
+ },
+ {
+ "id": "history/s9-call-2d0e5ed6b2ef",
+ "kind": "history.change",
+ "parent": "run/talk_main_s8-cycle/s8-cycle",
+ "stream": "main",
+ "at": 1767225607000,
+ "ref": {
+ "seq": 1,
+ "row": 9
+ },
+ "refs": [
+ {
+ "seq": 2,
+ "row": 5
+ },
+ {
+ "seq": 2,
+ "row": 7
+ }
+ ],
+ "attrs": {
+ "added": 2,
+ "cause": "unavailable",
+ "changed": 0,
+ "dropped": 2,
+ "from_call": "call/s6-call-2d0e5ed6b2ef",
+ "kept": 3,
+ "order_changed": "no",
+ "reply": "back",
+ "system_changed": "no",
+ "to_call": "call/s9-call-2d0e5ed6b2ef"
+ }
+ },
+ {
+ "id": "call/s9-call-2d0e5ed6b2ef",
+ "kind": "llm.call",
+ "parent": "run/talk_main_s8-cycle/s8-cycle",
+ "stream": "main",
+ "at": 1767225607000,
+ "ref": {
+ "seq": 1,
+ "row": 9
+ },
+ "refs": [
+ {
+ "seq": 1,
+ "row": 9
+ }
+ ],
+ "attrs": {
+ "history": "changed",
+ "history_from": "call/s6-call-2d0e5ed6b2ef",
+ "history_messages": 5,
+ "history_reply": "back",
+ "system_changed": "no",
+ "usage": "observed_replayable",
+ "usage_at": {
+ "row": 9,
+ "seq": 1
+ },
+ "usage_from": "last_fragment_in_line_order"
+ },
+ "usage": {
+ "in": 2,
+ "out": 40,
+ "cache_read": 900,
+ "cache_write": 100
+ },
+ "provider_bodies": [
+ {
+ "role": "request",
+ "ref": {
+ "seq": 2,
+ "row": 7
+ }
+ },
+ {
+ "role": "response",
+ "ref": {
+ "seq": 2,
+ "row": 8
+ }
+ }
+ ],
+ "children": [
+ {
+ "id": "msg/1/9:0",
+ "kind": "message.assistant",
+ "parent": "call/s9-call-2d0e5ed6b2ef",
+ "stream": "main",
+ "at": 1767225607000,
+ "ref": {
+ "seq": 1,
+ "row": 9,
+ "block": 0
+ },
+ "text": "30 seconds, 3 retries, doubling backoff.",
+ "state": "available",
+ "bytes": 40,
+ "flags": [
+ "finished"
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "edges": [
+ {
+ "type": "in_segment",
+ "other": "segment/at_1_2",
+ "dir": "out",
+ "quality": "exact_unique",
+ "via": "activity window"
+ }
+ ]
+ }
+ ],
+ "loose": [],
+ "relations": [
+ {
+ "id": "rel/in_segment/talk_main_s1-cycle/segment_at_1_2",
+ "type": "in_segment",
+ "from": "talk/main/s1-cycle",
+ "to": "segment/at_1_2",
+ "quality": "exact_unique",
+ "via": "activity window",
+ "evidence": [
+ {
+ "seq": 1,
+ "row": 2
+ }
+ ]
+ },
+ {
+ "id": "rel/in_segment/talk_main_s3-cycle/segment_at_1_2",
+ "type": "in_segment",
+ "from": "talk/main/s3-cycle",
+ "to": "segment/at_1_2",
+ "quality": "exact_unique",
+ "via": "activity window",
+ "evidence": [
+ {
+ "seq": 1,
+ "row": 4
+ }
+ ]
+ },
+ {
+ "id": "rel/in_segment/talk_main_s5-cycle/segment_at_1_2",
+ "type": "in_segment",
+ "from": "talk/main/s5-cycle",
+ "to": "segment/at_1_2",
+ "quality": "exact_unique",
+ "via": "activity window",
+ "evidence": [
+ {
+ "seq": 1,
+ "row": 6
+ }
+ ]
+ },
+ {
+ "id": "rel/in_segment/talk_main_s8-cycle/segment_at_1_2",
+ "type": "in_segment",
+ "from": "talk/main/s8-cycle",
+ "to": "segment/at_1_2",
+ "quality": "exact_unique",
+ "via": "activity window",
+ "evidence": [
+ {
+ "seq": 1,
+ "row": 8
+ }
+ ]
+ }
+ ],
+ "unresolved": [],
+ "workspace_changes": [],
+ "tool_executions": []
+}
diff --git a/packages/conversation-view/test/fixtures/history/forget.sd b/packages/conversation-view/test/fixtures/history/forget.sd
new file mode 100644
index 00000000..a1546b2c
--- /dev/null
+++ b/packages/conversation-view/test/fixtures/history/forget.sd
@@ -0,0 +1,10 @@
+{"h":1,"schema":"sd/1","seq":2,"at":"2026-01-01T00:00:00Z","kind":"provider_body","adapter":"mock/0.2.0","dialect":"mock/1","src":".","session":"5c9d8f2c-3d7a-4e93-8042-37270bc84c03"}
+{"ord":1,"off":0,"sha":"210a12657259","bytes":8136,"id":"d3353b92-0eaf-4bd3-83f8-bf2a1418f18a.request","run":"s1-cycle","model":"claude-opus-5","parts":[{"k":"data","data":"<system-reminder>\nCodebase and user instructions are shown below.\nFollow the project's rules. Follow the project's rules. Follow the project's rules. Follow the project's rules. Follow the project's rules. Follow the project's rules. Follow the project's rules. Follow the project's rules. Follow the project's rules. [...]
+{"ord":1,"off":0,"sha":"4776e539bf04","bytes":379,"id":"s2-req-2d0e5ed6b2ef.response","call":"s2-call-2d0e5ed6b2ef","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"response","src":"s2-req-2d0e5ed6b2ef.response.json","sha256":"4776e539bf04d47c4195c1516174bb0224bb26ef9242a86640a2ee78b767e488","bytes":379,"depth":0,"model":"claude-opus-5","call":"s2-call-2d0e5ed6b2ef","request":"s2-req-2d0e5ed6b2ef","history_form":"claude-code/1","reply":{"digest":"9d [...]
+{"ord":1,"off":0,"sha":"db4befa83ada","bytes":8290,"id":"51e8e674-f123-450e-8146-87d3538f7f21.request","run":"s3-cycle","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"request","src":"51e8e674-f123-450e-8146-87d3538f7f21.request.json","sha256":"db4befa83ada8ed361e57c0eaaf652c9f9e0de5ebb613985d9c0bed29145f48b","bytes":8290,"depth":0,"chain":"19106624255a5fc2","model":"claude-opus-5","session":"5c9d8f2c-3d7a-4e93-8042-37270bc84c03","previous_request" [...]
+{"ord":1,"off":0,"sha":"a998ee755090","bytes":382,"id":"s4-req-2d0e5ed6b2ef.response","call":"s4-call-2d0e5ed6b2ef","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"response","src":"s4-req-2d0e5ed6b2ef.response.json","sha256":"a998ee755090da54d00fd2569b5f0c221db124012cddefc3a47a62dc81335da0","bytes":382,"depth":0,"model":"claude-opus-5","call":"s4-call-2d0e5ed6b2ef","request":"s4-req-2d0e5ed6b2ef","history_form":"claude-code/1","reply":{"digest":"dc [...]
+{"ord":1,"off":0,"sha":"f279f5d0f9c5","bytes":8389,"id":"813d51fc-c6ec-4a45-812a-8ed96695983a.request","run":"s5-cycle","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"request","src":"813d51fc-c6ec-4a45-812a-8ed96695983a.request.json","sha256":"f279f5d0f9c51e60150d25093a0f528f988c719d28ad4669899da3f1abad1666","bytes":8389,"depth":0,"chain":"19106624255a5fc2","model":"claude-opus-5","session":"5c9d8f2c-3d7a-4e93-8042-37270bc84c03","previous_request" [...]
+{"ord":1,"off":0,"sha":"3c7c574c1c24","bytes":383,"id":"s6-req-2d0e5ed6b2ef.response","call":"s6-call-2d0e5ed6b2ef","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"response","src":"s6-req-2d0e5ed6b2ef.response.json","sha256":"3c7c574c1c2475b1cc1de30ab0c81c78dc867a476b3239f9ff53e3df6e8d9668","bytes":383,"depth":0,"model":"claude-opus-5","call":"s6-call-2d0e5ed6b2ef","request":"s6-req-2d0e5ed6b2ef","history_form":"claude-code/1","reply":{"digest":"e8 [...]
+{"ord":1,"off":0,"sha":"3114fab0003e","bytes":8396,"id":"7fbee812-bc4b-40b8-8107-23de3be3700d.request","run":"s8-cycle","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"request","src":"7fbee812-bc4b-40b8-8107-23de3be3700d.request.json","sha256":"3114fab0003e74260e2c3ee93d04f5f4ad5e16c41cbc7392cb26a8427c953a32","bytes":8396,"depth":0,"chain":"19106624255a5fc2","model":"claude-opus-5","session":"5c9d8f2c-3d7a-4e93-8042-37270bc84c03","previous_request" [...]
+{"ord":1,"off":0,"sha":"57e83a2403cb","bytes":402,"id":"s9-req-2d0e5ed6b2ef.response","call":"s9-call-2d0e5ed6b2ef","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"response","src":"s9-req-2d0e5ed6b2ef.response.json","sha256":"57e83a2403cb80eb14767932f3de7e47c09583ca046a4e2f275093915da3676d","bytes":402,"depth":0,"model":"claude-opus-5","call":"s9-call-2d0e5ed6b2ef","request":"s9-req-2d0e5ed6b2ef","history_form":"claude-code/1","reply":{"digest":"da [...]
+{"t":"end","records":8,"digest":"64ae9f2c1a5dfe8deebe41b9d837bbf4d825072ed8a339472415b746cf5ec891"}
diff --git a/packages/conversation-view/test/fixtures/history/reset.json b/packages/conversation-view/test/fixtures/history/reset.json
new file mode 100644
index 00000000..378d3c02
--- /dev/null
+++ b/packages/conversation-view/test/fixtures/history/reset.json
@@ -0,0 +1,1294 @@
+{
+ "format": "asz.view",
+ "version": "1.0",
+ "conversation": "6b7a6063-8714-4f6b-87cd-6c2da3a5094d",
+ "sessions": [
+ "6b7a6063-8714-4f6b-87cd-6c2da3a5094d"
+ ],
+ "head": {
+ "round": 1,
+ "digest": "91e07e6cb6d41a9c331a1ba103571eed4cb008e9fa3b20610b18b5f51a7b3974"
+ },
+ "parser": "v1",
+ "policy": "v1+idle=10m0s",
+ "summary": {
+ "title": "provider bodies beside the calls",
+ "state": "verified",
+ "problems": [],
+ "talks": 5,
+ "steps": 23,
+ "streams": 2,
+ "segments": 1,
+ "rounds": 1,
+ "unresolved": 0,
+ "changes": 0,
+ "provider_bodies": 14,
+ "captured_prompts": 7,
+ "from": 1767225600000,
+ "to": 1767225608400,
+ "kinds": {
+ "agent.call": 1,
+ "agent.launch_ack": 1,
+ "agent.output": 1,
+ "epoch": 3,
+ "epoch.boundary": 1,
+ "epoch.summary": 1,
+ "llm.call": 7,
+ "message.assistant": 6,
+ "message.external": 3,
+ "run": 5,
+ "segment": 1,
+ "session": 1,
+ "stream": 2,
+ "talk": 5,
+ "tool": 2
+ },
+ "relation_types": {
+ "ends_with": 1,
+ "follows": 1,
+ "in_segment": 5,
+ "starts": 1,
+ "summarizes": 1
+ },
+ "quality": {
+ "exact_unique": 8,
+ "strong_inference": 1
+ },
+ "withheld": {}
+ },
+ "rounds": [
+ {
+ "round": 1,
+ "digest": "91e07e6cb6d41a9c331a1ba103571eed4cb008e9fa3b20610b18b5f51a7b3974",
+ "previous": null,
+ "from_seq": 1,
+ "through_seq": 4,
+ "input_digest": "f99807b106a643dd74ae5f91a8f87ebc5d0d0212900d354029331cbd038db840",
+ "from_time": 1767225600000,
+ "through_time": 1767225608400,
+ "verified": true
+ }
+ ],
+ "files": [
+ {
+ "file": "6b7a6063-8714-4f6b-87cd-6c2da3a5094d/streams/main/transcript-20260101T000000.000000000Z-000001.sd",
+ "format": "sd",
+ "kind": "transcript",
+ "seq": 1,
+ "round": null,
+ "stream": "main",
+ "run": null,
+ "lines": 16,
+ "bytes": 5242,
+ "digest": "293e8d9afbcf0746496e84ad5ce6edc5e7ba5a41c49c015e2294566c337b6a9b",
+ "from_time": 1767225600000,
+ "through_time": 1767225608400
+ },
+ {
+ "file": "6b7a6063-8714-4f6b-87cd-6c2da3a5094d/streams/a02ba01b82410e9e3/transcript-20260101T000000.000000000Z-000002.sd",
+ "format": "sd",
+ "kind": "transcript",
+ "seq": 2,
+ "round": null,
+ "stream": "a02ba01b82410e9e3",
+ "run": null,
+ "lines": 7,
+ "bytes": 2220,
+ "digest": "b86dbc3bb6b8aaaaa5beaaa4b2226a63ba442fdc0dafa3d0ffe5fd10d941445d",
+ "from_time": 1767225605400,
+ "through_time": 1767225607800
+ },
+ {
+ "file": "6b7a6063-8714-4f6b-87cd-6c2da3a5094d/streams/a02ba01b82410e9e3/meta-20260101T000000.000000000Z-000003.sd",
+ "format": "sd",
+ "kind": "agent_meta",
+ "seq": 3,
+ "round": null,
+ "stream": "a02ba01b82410e9e3",
+ "run": null,
+ "lines": 3,
+ "bytes": 666,
+ "digest": "ad1b164dea912697af058c40edcb855838ace434a26a675c3feae499056a66e0",
+ "from_time": null,
+ "through_time": null
+ },
+ {
+ "file": "6b7a6063-8714-4f6b-87cd-6c2da3a5094d/provider_body/provider_body-20260101T000000.000000000Z-000004.sd",
+ "format": "sd",
+ "kind": "provider_body",
+ "seq": 4,
+ "round": null,
+ "stream": null,
+ "run": null,
+ "lines": 16,
+ "bytes": 31108,
+ "digest": "8f6d4411fc671e7e0dbc6751cfede6ba4caa5d2098823f75e6dcd08b1828e3fa",
+ "from_time": null,
+ "through_time": null
+ },
+ {
+ "file": "_conversations/6b7a6063-8714-4f6b-87cd-6c2da3a5094d/rounds/r000001-91e07e6cb6d4.sf",
+ "format": "sf",
+ "kind": "round",
+ "seq": null,
+ "round": 1,
+ "stream": null,
+ "run": null,
+ "lines": 51,
+ "bytes": 12638,
+ "digest": "3256f9df6e5b70a21f975bf9cda8624f04471595e81d513aef834060815a6cdf",
+ "from_time": 1767225600000,
+ "through_time": 1767225608400
+ }
+ ],
+ "streams": [
+ {
+ "id": "stream/main",
+ "name": "main",
+ "role": "main",
+ "label": "",
+ "parent": "",
+ "records": 14,
+ "steps": 15,
+ "talk": "talk/main/s1-cycle",
+ "named_by": "",
+ "opened_by": []
+ },
+ {
+ "id": "stream/a02ba01b82410e9e3",
+ "name": "a02ba01b82410e9e3",
+ "role": "child",
+ "label": "searcher",
+ "parent": "main",
+ "records": 6,
+ "steps": 6,
+ "talk": "talk/a02ba01b82410e9e3",
+ "named_by": "",
+ "opened_by": [
+ {
+ "step": "tool/s5-tool",
+ "stream": "main",
+ "talk": "talk/main/s4-cycle",
+ "quality": "exact_unique"
+ }
+ ]
+ }
+ ],
+ "segments": [
+ {
+ "id": "segment/at_1_2",
+ "talks": 5,
+ "from": 1767225600000,
+ "to": 1767225608400
+ }
+ ],
+ "talks": [
+ {
+ "id": "talk/main/s1-cycle",
+ "kind": "talk",
+ "parent": "epoch/main/0",
+ "stream": "main",
+ "at": 1767225600000,
+ "ref": {
+ "seq": 1,
+ "row": 2
+ },
+ "label": "read the configuration and summarise it",
+ "reply": "The timeout is 30 seconds, with 3 retries.",
+ "runs": 1,
+ "steps": 6,
+ "tools": 1,
+ "from": 1767225600000,
+ "to": 1767225602300,
+ "segment": "segment/at_1_2",
+ "children": [
+ {
+ "id": "run/talk_main_s1-cycle/s1-cycle",
+ "kind": "run",
+ "parent": "talk/main/s1-cycle",
+ "stream": "main",
+ "at": 1767225600000,
+ "ref": {
+ "seq": 1,
+ "row": 2
+ },
+ "children": [
+ {
+ "id": "input/1/2",
+ "kind": "message.external",
+ "parent": "run/talk_main_s1-cycle/s1-cycle",
+ "stream": "main",
+ "at": 1767225600000,
+ "ref": {
+ "seq": 1,
+ "row": 2
+ },
+ "text": "read the configuration and summarise it",
+ "state": "available",
+ "bytes": 39,
+ "flags": [
+ "external_input"
+ ]
+ },
+ {
+ "id": "call/s2-call-fdae022ac306",
+ "kind": "llm.call",
+ "parent": "run/talk_main_s1-cycle/s1-cycle",
+ "stream": "main",
+ "at": 1767225601000,
+ "ref": {
+ "seq": 1,
+ "row": 3
+ },
+ "refs": [
+ {
+ "seq": 1,
+ "row": 3
+ },
+ {
+ "seq": 1,
+ "row": 4
+ }
+ ],
+ "attrs": {
+ "history": "first",
+ "history_messages": 1,
+ "usage": "observed_replayable",
+ "usage_at": {
+ "row": 4,
+ "seq": 1
+ },
+ "usage_from": "last_fragment_in_line_order"
+ },
+ "usage": {
+ "in": 2,
+ "out": 40,
+ "cache_read": 900,
+ "cache_write": 100
+ },
+ "provider_bodies": [
+ {
+ "role": "request",
+ "ref": {
+ "seq": 4,
+ "row": 1
+ }
+ },
+ {
+ "role": "response",
+ "ref": {
+ "seq": 4,
+ "row": 2
+ }
+ }
+ ],
+ "children": [
+ {
+ "id": "msg/1/3:0",
+ "kind": "message.assistant",
+ "parent": "call/s2-call-fdae022ac306",
+ "stream": "main",
+ "at": 1767225601000,
+ "ref": {
+ "seq": 1,
+ "row": 3,
+ "block": 0
+ },
+ "text": "Reading it.",
+ "state": "available",
+ "bytes": 11
+ },
+ {
+ "id": "tool/s2-tool",
+ "kind": "tool",
+ "parent": "call/s2-call-fdae022ac306",
+ "stream": "main",
+ "at": 1767225601100,
+ "ref": {
+ "seq": 1,
+ "row": 4,
+ "block": 0
+ },
+ "refs": [
+ {
+ "seq": 1,
+ "row": 4,
+ "block": 0
+ },
+ {
+ "seq": 1,
+ "row": 5,
+ "block": 0
+ }
+ ],
+ "attrs": {
+ "result": "available",
+ "result_join": "exact_unique",
+ "timing": "unavailable"
+ },
+ "text": "{\"file_path\":\"/Users/dev/scenario/config.yaml\"}",
+ "state": "available",
+ "bytes": 47,
+ "flags": [
+ "finished"
+ ],
+ "name": "Read",
+ "result": "timeout: 30\nretries: 3\n",
+ "result_state": "available",
+ "result_bytes": 23,
+ "request_to_result_ms": 200,
+ "request_to_result_join": "exact_unique"
+ }
+ ]
+ },
+ {
+ "id": "call/s3-call-fdae022ac306",
+ "kind": "llm.call",
+ "parent": "run/talk_main_s1-cycle/s1-cycle",
+ "stream": "main",
+ "at": 1767225602300,
+ "ref": {
+ "seq": 1,
+ "row": 6
+ },
+ "refs": [
+ {
+ "seq": 1,
+ "row": 6
+ }
+ ],
+ "attrs": {
+ "history": "kept",
+ "history_from": "call/s2-call-fdae022ac306",
+ "history_messages": 3,
+ "history_reply": "back",
+ "system_changed": "no",
+ "usage": "observed_replayable",
+ "usage_at": {
+ "row": 6,
+ "seq": 1
+ },
+ "usage_from": "last_fragment_in_line_order"
+ },
+ "usage": {
+ "in": 2,
+ "out": 40,
+ "cache_read": 900,
+ "cache_write": 100
+ },
+ "provider_bodies": [
+ {
+ "role": "request",
+ "ref": {
+ "seq": 4,
+ "row": 3
+ }
+ },
+ {
+ "role": "response",
+ "ref": {
+ "seq": 4,
+ "row": 4
+ }
+ }
+ ],
+ "children": [
+ {
+ "id": "msg/1/6:0",
+ "kind": "message.assistant",
+ "parent": "call/s3-call-fdae022ac306",
+ "stream": "main",
+ "at": 1767225602300,
+ "ref": {
+ "seq": 1,
+ "row": 6,
+ "block": 0
+ },
+ "text": "The timeout is 30 seconds, with 3 retries.",
+ "state": "available",
+ "bytes": 42,
+ "flags": [
+ "finished"
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "edges": [
+ {
+ "type": "in_segment",
+ "other": "segment/at_1_2",
+ "dir": "out",
+ "quality": "exact_unique",
+ "via": "activity window"
+ }
+ ]
+ },
+ {
+ "id": "talk/main/s4-cycle",
+ "kind": "talk",
+ "parent": "epoch/main/0",
+ "stream": "main",
+ "at": 1767225603300,
+ "ref": {
+ "seq": 1,
+ "row": 7
+ },
+ "label": "find where the timeout is used",
+ "reply": "The searcher found it in server.go.",
+ "runs": 1,
+ "steps": 6,
+ "tools": 1,
+ "from": 1767225603300,
+ "to": 1767225605400,
+ "segment": "segment/at_1_2",
+ "children": [
+ {
+ "id": "run/talk_main_s4-cycle/s4-cycle",
+ "kind": "run",
+ "parent": "talk/main/s4-cycle",
+ "stream": "main",
+ "at": 1767225603300,
+ "ref": {
+ "seq": 1,
+ "row": 7
+ },
+ "children": [
+ {
+ "id": "input/1/7",
+ "kind": "message.external",
+ "parent": "run/talk_main_s4-cycle/s4-cycle",
+ "stream": "main",
+ "at": 1767225603300,
+ "ref": {
+ "seq": 1,
+ "row": 7
+ },
+ "text": "find where the timeout is used",
+ "state": "available",
+ "bytes": 30,
+ "flags": [
+ "external_input"
+ ]
+ },
+ {
+ "id": "call/s5-call-fdae022ac306",
+ "kind": "llm.call",
+ "parent": "run/talk_main_s4-cycle/s4-cycle",
+ "stream": "main",
+ "at": 1767225604300,
+ "ref": {
+ "seq": 1,
+ "row": 8
+ },
+ "refs": [
+ {
+ "seq": 1,
+ "row": 8
+ }
+ ],
+ "attrs": {
+ "history": "kept",
+ "history_from": "call/s3-call-fdae022ac306",
+ "history_messages": 5,
+ "history_reply": "back",
+ "system_changed": "no",
+ "usage": "observed_replayable",
+ "usage_at": {
+ "row": 8,
+ "seq": 1
+ },
+ "usage_from": "last_fragment_in_line_order"
+ },
+ "usage": {
+ "in": 2,
+ "out": 40,
+ "cache_read": 900,
+ "cache_write": 100
+ },
+ "provider_bodies": [
+ {
+ "role": "request",
+ "ref": {
+ "seq": 4,
+ "row": 5
+ }
+ },
+ {
+ "role": "response",
+ "ref": {
+ "seq": 4,
+ "row": 6
+ }
+ }
+ ],
+ "children": [
+ {
+ "id": "tool/s5-tool",
+ "kind": "agent.call",
+ "parent": "call/s5-call-fdae022ac306",
+ "stream": "main",
+ "at": 1767225604300,
+ "ref": {
+ "seq": 1,
+ "row": 8,
+ "block": 0
+ },
+ "refs": [
+ {
+ "seq": 1,
+ "row": 8,
+ "block": 0
+ },
+ {
+ "seq": 1,
+ "row": 9,
+ "block": 0
+ }
+ ],
+ "attrs": {
+ "result": "available",
+ "result_join": "exact_unique",
+ "timing": "unavailable"
+ },
+ "text": "{\"description\":\"searcher\",\"prompt\":\"find every use of the timeout\"}",
+ "state": "available",
+ "bytes": 67,
+ "flags": [
+ "finished"
+ ],
+ "name": "Agent",
+ "result": "launched",
+ "result_state": "available",
+ "result_bytes": 8,
+ "request_to_result_ms": 100,
+ "request_to_result_join": "exact_unique",
+ "edges": [
+ {
+ "type": "starts",
+ "other": "stream/a02ba01b82410e9e3",
+ "dir": "out",
+ "quality": "exact_unique",
+ "via": "parent tool result"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "id": "ack/1/9",
+ "kind": "agent.launch_ack",
+ "parent": "run/talk_main_s4-cycle/s4-cycle",
+ "stream": "main",
+ "at": 1767225604400,
+ "ref": {
+ "seq": 1,
+ "row": 9
+ },
+ "text": "launched",
+ "state": "available",
+ "bytes": 8,
+ "flags": [
+ "launch_ack"
+ ]
+ },
+ {
+ "id": "call/s6-call-fdae022ac306",
+ "kind": "llm.call",
+ "parent": "run/talk_main_s4-cycle/s4-cycle",
+ "stream": "main",
+ "at": 1767225605400,
+ "ref": {
+ "seq": 1,
+ "row": 10
+ },
+ "refs": [
+ {
+ "seq": 1,
+ "row": 10
+ }
+ ],
+ "attrs": {
+ "history": "kept",
+ "history_from": "call/s5-call-fdae022ac306",
+ "history_messages": 7,
+ "history_reply": "back",
+ "system_changed": "no",
+ "usage": "observed_replayable",
+ "usage_at": {
+ "row": 10,
+ "seq": 1
+ },
+ "usage_from": "last_fragment_in_line_order"
+ },
+ "usage": {
+ "in": 2,
+ "out": 40,
+ "cache_read": 900,
+ "cache_write": 100
+ },
+ "provider_bodies": [
+ {
+ "role": "request",
+ "ref": {
+ "seq": 4,
+ "row": 7
+ }
+ },
+ {
+ "role": "response",
+ "ref": {
+ "seq": 4,
+ "row": 8
+ }
+ }
+ ],
+ "children": [
+ {
+ "id": "msg/1/10:0",
+ "kind": "message.assistant",
+ "parent": "call/s6-call-fdae022ac306",
+ "stream": "main",
+ "at": 1767225605400,
+ "ref": {
+ "seq": 1,
+ "row": 10,
+ "block": 0
+ },
+ "text": "The searcher found it in server.go.",
+ "state": "available",
+ "bytes": 35,
+ "flags": [
+ "finished"
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "edges": [
+ {
+ "type": "in_segment",
+ "other": "segment/at_1_2",
+ "dir": "out",
+ "quality": "exact_unique",
+ "via": "activity window"
+ }
+ ]
+ },
+ {
+ "id": "talk/a02ba01b82410e9e3",
+ "kind": "talk",
+ "parent": "epoch/a02ba01b82410e9e3/0",
+ "stream": "a02ba01b82410e9e3",
+ "at": 1767225605400,
+ "ref": {
+ "seq": 2,
+ "row": 1
+ },
+ "reply": "It is used in server.go.",
+ "runs": 1,
+ "steps": 6,
+ "tools": 1,
+ "from": 1767225605400,
+ "to": 1767225607800,
+ "child": true,
+ "segment": "segment/at_1_2",
+ "children": [
+ {
+ "id": "run/talk_a02ba01b82410e9e3/a02ba01b82410e9e3-cycle",
+ "kind": "run",
+ "parent": "talk/a02ba01b82410e9e3",
+ "stream": "a02ba01b82410e9e3",
+ "at": 1767225605400,
+ "ref": {
+ "seq": 2,
+ "row": 1
+ },
+ "children": [
+ {
+ "id": "call/searcher-s1-call-fdae022ac306",
+ "kind": "llm.call",
+ "parent": "run/talk_a02ba01b82410e9e3/a02ba01b82410e9e3-cycle",
+ "stream": "a02ba01b82410e9e3",
+ "at": 1767225606400,
+ "ref": {
+ "seq": 2,
+ "row": 2
+ },
+ "refs": [
+ {
+ "seq": 2,
+ "row": 2
+ },
+ {
+ "seq": 2,
+ "row": 3
+ }
+ ],
+ "attrs": {
+ "history": "first",
+ "history_messages": 1,
+ "usage": "observed_replayable",
+ "usage_at": {
+ "row": 3,
+ "seq": 2
+ },
+ "usage_from": "last_fragment_in_line_order"
+ },
+ "usage": {
+ "in": 2,
+ "out": 40,
+ "cache_read": 900,
+ "cache_write": 100
+ },
+ "provider_bodies": [
+ {
+ "role": "request",
+ "ref": {
+ "seq": 4,
+ "row": 9
+ }
+ },
+ {
+ "role": "response",
+ "ref": {
+ "seq": 4,
+ "row": 10
+ }
+ }
+ ],
+ "children": [
+ {
+ "id": "msg/2/2:0",
+ "kind": "message.assistant",
+ "parent": "call/searcher-s1-call-fdae022ac306",
+ "stream": "a02ba01b82410e9e3",
+ "at": 1767225606400,
+ "ref": {
+ "seq": 2,
+ "row": 2,
+ "block": 0
+ },
+ "text": "Searching.",
+ "state": "available",
+ "bytes": 10
+ },
+ {
+ "id": "tool/searcher-s1-tool",
+ "kind": "tool",
+ "parent": "call/searcher-s1-call-fdae022ac306",
+ "stream": "a02ba01b82410e9e3",
+ "at": 1767225606500,
+ "ref": {
+ "seq": 2,
+ "row": 3,
+ "block": 0
+ },
+ "refs": [
+ {
+ "seq": 2,
+ "row": 3,
+ "block": 0
+ },
+ {
+ "seq": 2,
+ "row": 4,
+ "block": 0
+ }
+ ],
+ "attrs": {
+ "result": "available",
+ "result_join": "exact_unique",
+ "timing": "unavailable"
+ },
+ "text": "{\"command\":\"grep -rn timeout .\"}",
+ "state": "available",
+ "bytes": 32,
+ "flags": [
+ "finished"
+ ],
+ "name": "Bash",
+ "result": "server.go:3: var timeout = 30",
+ "result_state": "available",
+ "result_bytes": 29,
+ "request_to_result_ms": 300,
+ "request_to_result_join": "exact_unique"
+ }
+ ]
+ },
+ {
+ "id": "call/searcher-s2-call-fdae022ac306",
+ "kind": "llm.call",
+ "parent": "run/talk_a02ba01b82410e9e3/a02ba01b82410e9e3-cycle",
+ "stream": "a02ba01b82410e9e3",
+ "at": 1767225607800,
+ "ref": {
+ "seq": 2,
+ "row": 5
+ },
+ "refs": [
+ {
+ "seq": 2,
+ "row": 5
+ }
+ ],
+ "attrs": {
+ "history": "kept",
+ "history_from": "call/searcher-s1-call-fdae022ac306",
+ "history_messages": 3,
+ "history_reply": "back",
+ "system_changed": "no",
+ "usage": "observed_replayable",
+ "usage_at": {
+ "row": 5,
+ "seq": 2
+ },
+ "usage_from": "last_fragment_in_line_order"
+ },
+ "usage": {
+ "in": 2,
+ "out": 40,
+ "cache_read": 900,
+ "cache_write": 100
+ },
+ "provider_bodies": [
+ {
+ "role": "request",
+ "ref": {
+ "seq": 4,
+ "row": 11
+ }
+ },
+ {
+ "role": "response",
+ "ref": {
+ "seq": 4,
+ "row": 12
+ }
+ }
+ ],
+ "children": [
+ {
+ "id": "msg/2/5:0",
+ "kind": "message.assistant",
+ "parent": "call/searcher-s2-call-fdae022ac306",
+ "stream": "a02ba01b82410e9e3",
+ "at": 1767225607800,
+ "ref": {
+ "seq": 2,
+ "row": 5,
+ "block": 0
+ },
+ "text": "It is used in server.go.",
+ "state": "available",
+ "bytes": 24,
+ "flags": [
+ "finished"
+ ]
+ }
+ ]
+ },
+ {
+ "id": "output/a02ba01b82410e9e3",
+ "kind": "agent.output",
+ "parent": "run/talk_a02ba01b82410e9e3/a02ba01b82410e9e3-cycle",
+ "stream": "a02ba01b82410e9e3",
+ "at": 1767225607800,
+ "ref": {
+ "seq": 2,
+ "row": 5
+ },
+ "refs": [
+ {
+ "seq": 2,
+ "row": 5
+ }
+ ],
+ "attrs": {
+ "returned_value": "unavailable"
+ },
+ "text": "It is used in server.go.",
+ "state": "available",
+ "bytes": 24,
+ "flags": [
+ "finished"
+ ],
+ "edges": [
+ {
+ "type": "ends_with",
+ "other": "stream/a02ba01b82410e9e3",
+ "dir": "in",
+ "quality": "exact_unique",
+ "via": "the last response in the child stream, and what it returned"
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "edges": [
+ {
+ "type": "in_segment",
+ "other": "segment/at_1_2",
+ "dir": "out",
+ "quality": "strong_inference",
+ "via": "inside the window of the talk that delegated it"
+ }
+ ]
+ },
+ {
+ "id": "talk/main/s7-cycle-compact",
+ "kind": "talk",
+ "parent": "epoch/main/s7-boundary",
+ "stream": "main",
+ "at": 1767225606000,
+ "ref": {
+ "seq": 1,
+ "row": 12
+ },
+ "runs": 1,
+ "from": 1767225606000,
+ "to": 1767225606000,
+ "segment": "segment/at_1_2",
+ "children": [
+ {
+ "id": "run/talk_main_s7-cycle-compact/s7-cycle-compact",
+ "kind": "run",
+ "parent": "talk/main/s7-cycle-compact",
+ "stream": "main",
+ "at": 1767225606000,
+ "ref": {
+ "seq": 1,
+ "row": 12
+ }
+ }
+ ],
+ "edges": [
+ {
+ "type": "in_segment",
+ "other": "segment/at_1_2",
+ "dir": "out",
+ "quality": "exact_unique",
+ "via": "activity window"
+ }
+ ]
+ },
+ {
+ "id": "talk/main/s8-cycle",
+ "kind": "talk",
+ "parent": "epoch/main/s7-boundary",
+ "stream": "main",
+ "at": 1767225607400,
+ "ref": {
+ "seq": 1,
+ "row": 13
+ },
+ "label": "and the retries?",
+ "reply": "There are 3 retries.",
+ "runs": 1,
+ "steps": 3,
+ "from": 1767225607400,
+ "to": 1767225608400,
+ "segment": "segment/at_1_2",
+ "children": [
+ {
+ "id": "run/talk_main_s8-cycle/s8-cycle",
+ "kind": "run",
+ "parent": "talk/main/s8-cycle",
+ "stream": "main",
+ "at": 1767225607400,
+ "ref": {
+ "seq": 1,
+ "row": 13
+ },
+ "children": [
+ {
+ "id": "input/1/13",
+ "kind": "message.external",
+ "parent": "run/talk_main_s8-cycle/s8-cycle",
+ "stream": "main",
+ "at": 1767225607400,
+ "ref": {
+ "seq": 1,
+ "row": 13
+ },
+ "text": "and the retries?",
+ "state": "available",
+ "bytes": 16,
+ "flags": [
+ "external_input"
+ ]
+ },
+ {
+ "id": "call/s9-call-fdae022ac306",
+ "kind": "llm.call",
+ "parent": "run/talk_main_s8-cycle/s8-cycle",
+ "stream": "main",
+ "at": 1767225608400,
+ "ref": {
+ "seq": 1,
+ "row": 14
+ },
+ "refs": [
+ {
+ "seq": 1,
+ "row": 14
+ }
+ ],
+ "attrs": {
+ "history": "first",
+ "history_messages": 2,
+ "usage": "observed_replayable",
+ "usage_at": {
+ "row": 14,
+ "seq": 1
+ },
+ "usage_from": "last_fragment_in_line_order"
+ },
+ "usage": {
+ "in": 2,
+ "out": 40,
+ "cache_read": 900,
+ "cache_write": 100
+ },
+ "provider_bodies": [
+ {
+ "role": "request",
+ "ref": {
+ "seq": 4,
+ "row": 13
+ }
+ },
+ {
+ "role": "response",
+ "ref": {
+ "seq": 4,
+ "row": 14
+ }
+ }
+ ],
+ "children": [
+ {
+ "id": "msg/1/14:0",
+ "kind": "message.assistant",
+ "parent": "call/s9-call-fdae022ac306",
+ "stream": "main",
+ "at": 1767225608400,
+ "ref": {
+ "seq": 1,
+ "row": 14,
+ "block": 0
+ },
+ "text": "There are 3 retries.",
+ "state": "available",
+ "bytes": 20,
+ "flags": [
+ "finished"
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "edges": [
+ {
+ "type": "in_segment",
+ "other": "segment/at_1_2",
+ "dir": "out",
+ "quality": "exact_unique",
+ "via": "activity window"
+ }
+ ]
+ }
+ ],
+ "loose": [
+ {
+ "id": "boundary/1/11",
+ "kind": "epoch.boundary",
+ "parent": "epoch/main/s7-boundary",
+ "stream": "main",
+ "at": 1767225606400,
+ "ref": {
+ "seq": 1,
+ "row": 11
+ },
+ "text": "{\"compactMetadata\":{\"preservedMessages\":{\"allUuids\":[\"s6-call-f1\"]},\"trigger\":\"auto\"},\"logicalParentUuid\":\"s6-call-f1\",\"subtype\":\"compact_boundary\",\"type\":\"system\"}",
+ "state": "available",
+ "bytes": 164,
+ "flags": [
+ "context_reset"
+ ],
+ "edges": [
+ {
+ "type": "summarizes",
+ "other": "summary/1/12",
+ "dir": "in",
+ "quality": "exact_unique",
+ "via": "containment parent"
+ }
+ ]
+ },
+ {
+ "id": "summary/1/12",
+ "kind": "epoch.summary",
+ "parent": "epoch/main/s7-boundary",
+ "stream": "main",
+ "at": 1767225606000,
+ "ref": {
+ "seq": 1,
+ "row": 12
+ },
+ "text": "The configuration sets a 30 second timeout, used in server.go.",
+ "state": "available",
+ "bytes": 62,
+ "flags": [
+ "reset_summary"
+ ],
+ "edges": [
+ {
+ "type": "summarizes",
+ "other": "boundary/1/11",
+ "dir": "out",
+ "quality": "exact_unique",
+ "via": "containment parent"
+ }
+ ]
+ }
+ ],
+ "relations": [
+ {
+ "id": "rel/in_segment/talk_main_s1-cycle/segment_at_1_2",
+ "type": "in_segment",
+ "from": "talk/main/s1-cycle",
+ "to": "segment/at_1_2",
+ "quality": "exact_unique",
+ "via": "activity window",
+ "evidence": [
+ {
+ "seq": 1,
+ "row": 2
+ }
+ ]
+ },
+ {
+ "id": "rel/in_segment/talk_main_s4-cycle/segment_at_1_2",
+ "type": "in_segment",
+ "from": "talk/main/s4-cycle",
+ "to": "segment/at_1_2",
+ "quality": "exact_unique",
+ "via": "activity window",
+ "evidence": [
+ {
+ "seq": 1,
+ "row": 7
+ }
+ ]
+ },
+ {
+ "id": "rel/starts/tool_s5-tool/stream_a02ba01b82410e9e3",
+ "type": "starts",
+ "from": "tool/s5-tool",
+ "to": "stream/a02ba01b82410e9e3",
+ "quality": "exact_unique",
+ "via": "parent tool result",
+ "evidence": [
+ {
+ "seq": 1,
+ "row": 9
+ }
+ ]
+ },
+ {
+ "id": "rel/in_segment/talk_a02ba01b82410e9e3/segment_at_1_2",
+ "type": "in_segment",
+ "from": "talk/a02ba01b82410e9e3",
+ "to": "segment/at_1_2",
+ "quality": "strong_inference",
+ "via": "inside the window of the talk that delegated it",
+ "evidence": [
+ {
+ "seq": 2,
+ "row": 1
+ }
+ ]
+ },
+ {
+ "id": "rel/follows/epoch_main_s7-boundary/epoch_main_0",
+ "type": "follows",
+ "from": "epoch/main/s7-boundary",
+ "to": "epoch/main/0",
+ "quality": "exact_unique",
+ "via": "explicit context reset",
+ "evidence": [
+ {
+ "seq": 1,
+ "row": 11
+ }
+ ]
+ },
+ {
+ "id": "rel/in_segment/talk_main_s7-cycle-compact/segment_at_1_2",
+ "type": "in_segment",
+ "from": "talk/main/s7-cycle-compact",
+ "to": "segment/at_1_2",
+ "quality": "exact_unique",
+ "via": "activity window",
+ "evidence": [
+ {
+ "seq": 1,
+ "row": 12
+ }
+ ]
+ },
+ {
+ "id": "rel/summarizes/summary_1_12/boundary_1_11",
+ "type": "summarizes",
+ "from": "summary/1/12",
+ "to": "boundary/1/11",
+ "quality": "exact_unique",
+ "via": "containment parent",
+ "evidence": [
+ {
+ "seq": 1,
+ "row": 12
+ }
+ ]
+ },
+ {
+ "id": "rel/in_segment/talk_main_s8-cycle/segment_at_1_2",
+ "type": "in_segment",
+ "from": "talk/main/s8-cycle",
+ "to": "segment/at_1_2",
+ "quality": "exact_unique",
+ "via": "activity window",
+ "evidence": [
+ {
+ "seq": 1,
+ "row": 13
+ }
+ ]
+ },
+ {
+ "id": "rel/ends_with/stream_a02ba01b82410e9e3/output_a02ba01b82410e9e3",
+ "type": "ends_with",
+ "from": "stream/a02ba01b82410e9e3",
+ "to": "output/a02ba01b82410e9e3",
+ "quality": "exact_unique",
+ "via": "the last response in the child stream, and what it returned",
+ "evidence": [
+ {
+ "seq": 2,
+ "row": 5
+ }
+ ]
+ }
+ ],
+ "unresolved": [],
+ "workspace_changes": [],
+ "tool_executions": []
+}
diff --git a/packages/conversation-view/test/fixtures/history/reset.sd b/packages/conversation-view/test/fixtures/history/reset.sd
new file mode 100644
index 00000000..66f15352
--- /dev/null
+++ b/packages/conversation-view/test/fixtures/history/reset.sd
@@ -0,0 +1,16 @@
+{"h":1,"schema":"sd/1","seq":4,"at":"2026-01-01T00:00:00Z","kind":"provider_body","adapter":"mock/0.2.0","dialect":"mock/1","src":".","session":"6b7a6063-8714-4f6b-87cd-6c2da3a5094d"}
+{"ord":1,"off":0,"sha":"25a4cf0c2c2a","bytes":8155,"id":"62c5142f-0b52-4b3d-8f5b-5ba0a44cb6b7.request","run":"s1-cycle","model":"claude-opus-5","parts":[{"k":"data","data":"<system-reminder>\nCodebase and user instructions are shown below.\nFollow the project's rules. Follow the project's rules. Follow the project's rules. Follow the project's rules. Follow the project's rules. Follow the project's rules. Follow the project's rules. Follow the project's rules. Follow the project's rules. [...]
+{"ord":1,"off":0,"sha":"cc832e08f39e","bytes":478,"id":"s2-req-fdae022ac306.response","call":"s2-call-fdae022ac306","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"response","src":"s2-req-fdae022ac306.response.json","sha256":"cc832e08f39eab4f17ae9d6d50ed260b1512dd6f4e3787bbac5e65124219d9f9","bytes":478,"depth":0,"model":"claude-opus-5","call":"s2-call-fdae022ac306","request":"s2-req-fdae022ac306","history_form":"claude-code/1","reply":{"digest":"79 [...]
+{"ord":1,"off":0,"sha":"60c205135751","bytes":8476,"id":"e6250647-cc72-4db4-87f8-35d5d8532118.request","run":"s1-cycle","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"request","src":"e6250647-cc72-4db4-87f8-35d5d8532118.request.json","sha256":"60c20513575143a9f0166a04f236954c6d0831eb62418ff105c6f30f86151505","bytes":8476,"depth":0,"chain":"f48484e6a7a8135e","model":"claude-opus-5","session":"6b7a6063-8714-4f6b-87cd-6c2da3a5094d","previous_request" [...]
+{"ord":1,"off":0,"sha":"daa95af2ce9d","bytes":404,"id":"s3-req-fdae022ac306.response","call":"s3-call-fdae022ac306","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"response","src":"s3-req-fdae022ac306.response.json","sha256":"daa95af2ce9db8f574cc41f80c47dbad74745dfdeb50d8afe0832324e076089f","bytes":404,"depth":0,"model":"claude-opus-5","call":"s3-call-fdae022ac306","request":"s3-req-fdae022ac306","history_form":"claude-code/1","reply":{"digest":"f1 [...]
+{"ord":1,"off":0,"sha":"fcf4469b068b","bytes":8636,"id":"2e0ed3d7-b6d2-46eb-8c3f-c06a030dd7d5.request","run":"s4-cycle","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"request","src":"2e0ed3d7-b6d2-46eb-8c3f-c06a030dd7d5.request.json","sha256":"fcf4469b068bc21e97d6e4754a3b2454c0876da594b6f0fb8b00e3c7eb056eab","bytes":8636,"depth":0,"chain":"f48484e6a7a8135e","model":"claude-opus-5","session":"6b7a6063-8714-4f6b-87cd-6c2da3a5094d","previous_request" [...]
+{"ord":1,"off":0,"sha":"3302e4ad65c8","bytes":462,"id":"s5-req-fdae022ac306.response","call":"s5-call-fdae022ac306","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"response","src":"s5-req-fdae022ac306.response.json","sha256":"3302e4ad65c8c541777325d4c593dd7ab9166a9e6694319dc3fd84012256e32d","bytes":462,"depth":0,"model":"claude-opus-5","call":"s5-call-fdae022ac306","request":"s5-req-fdae022ac306","history_form":"claude-code/1","reply":{"digest":"a5 [...]
+{"ord":1,"off":0,"sha":"faa5ca836651","bytes":8866,"id":"935833f9-330c-4a2f-84e7-90072ac2f4db.request","run":"s4-cycle","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"request","src":"935833f9-330c-4a2f-84e7-90072ac2f4db.request.json","sha256":"faa5ca836651fe57bf3b41d154a72d46560bba35dfc15d872cf86606ad195b27","bytes":8866,"depth":0,"chain":"f48484e6a7a8135e","model":"claude-opus-5","session":"6b7a6063-8714-4f6b-87cd-6c2da3a5094d","previous_request" [...]
+{"ord":1,"off":0,"sha":"4d391a1e56cf","bytes":397,"id":"s6-req-fdae022ac306.response","call":"s6-call-fdae022ac306","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"response","src":"s6-req-fdae022ac306.response.json","sha256":"4d391a1e56cfe89148d7b51fe229021a818bd8b49dd95d4e5237c62f44ae366c","bytes":397,"depth":0,"model":"claude-opus-5","call":"s6-call-fdae022ac306","request":"s6-req-fdae022ac306","history_form":"claude-code/1","reply":{"digest":"13 [...]
+{"ord":1,"off":0,"sha":"a564142b6ea8","bytes":3753,"id":"32c40efc-db2a-4811-85e8-0d40b51c6fe7.request","run":"a02ba01b82410e9e3-cycle","model":"claude-opus-5","parts":[{"k":"data","data":"You are an agent that searches a repository. Report what you find. Report what you find. Report what you find. Report what you find. Report what you find. Report what you find. Report what you find. Report what you find. Report what you find. Report what you find. Report what you find. Report what you f [...]
+{"ord":1,"off":0,"sha":"190d3f2154d2","bytes":480,"id":"searcher-s1-req-fdae022ac306.response","call":"searcher-s1-call-fdae022ac306","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"response","src":"searcher-s1-req-fdae022ac306.response.json","sha256":"190d3f2154d23f758f1534de81f58e488520c0d00f4b06f850f777c17b0e33c1","bytes":480,"depth":0,"model":"claude-opus-5","call":"searcher-s1-call-fdae022ac306","request":"searcher-s1-req-fdae022ac306","histor [...]
+{"ord":1,"off":0,"sha":"0047b6fad9bb","bytes":4089,"id":"c58ece40-0a74-4e25-8426-53f9ccca9203.request","run":"a02ba01b82410e9e3-cycle","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"request","src":"c58ece40-0a74-4e25-8426-53f9ccca9203.request.json","sha256":"0047b6fad9bbe463e67ed5ed18a023e62959433c12d427b14cce04b8de492248","bytes":4089,"depth":0,"chain":"13f2eed00f2e44d1","model":"claude-opus-5","session":"6b7a6063-8714-4f6b-87cd-6c2da3a5094d","pr [...]
+{"ord":1,"off":0,"sha":"bc2a644b6278","bytes":395,"id":"searcher-s2-req-fdae022ac306.response","call":"searcher-s2-call-fdae022ac306","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"response","src":"searcher-s2-req-fdae022ac306.response.json","sha256":"bc2a644b6278c5c10577e04d30e47a6a9eddbf569ab98c5057837193da25c3ae","bytes":395,"depth":0,"model":"claude-opus-5","call":"searcher-s2-call-fdae022ac306","request":"searcher-s2-req-fdae022ac306","histor [...]
+{"ord":1,"off":0,"sha":"c98fdf59718d","bytes":8281,"id":"89c950ad-d61b-47bb-84da-bf0f39990473.request","run":"s8-cycle","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"request","src":"89c950ad-d61b-47bb-84da-bf0f39990473.request.json","sha256":"c98fdf59718dda1877f1107a8a3eae19ec0c55d0989ce6d03d6b33aaf20758ff","bytes":8281,"depth":0,"chain":"d4550b67cba4cf93","model":"claude-opus-5","session":"6b7a6063-8714-4f6b-87cd-6c2da3a5094d","previous_request" [...]
+{"ord":1,"off":0,"sha":"0648149a433f","bytes":382,"id":"s9-req-fdae022ac306.response","call":"s9-call-fdae022ac306","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"response","src":"s9-req-fdae022ac306.response.json","sha256":"0648149a433f8492e907edff0db377ad242df73482509659252f8ee14f8160fd","bytes":382,"depth":0,"model":"claude-opus-5","call":"s9-call-fdae022ac306","request":"s9-req-fdae022ac306","history_form":"claude-code/1","reply":{"digest":"dc [...]
+{"t":"end","records":14,"digest":"81eca170866e45acea937558bab487a7eb257dbd96405346ba3828ad0b2d5c4f"}
diff --git a/packages/conversation-view/test/fixtures/history/threads.json b/packages/conversation-view/test/fixtures/history/threads.json
new file mode 100644
index 00000000..75fb94ee
--- /dev/null
+++ b/packages/conversation-view/test/fixtures/history/threads.json
@@ -0,0 +1,1016 @@
+{
+ "format": "asz.view",
+ "version": "1.0",
+ "conversation": "cf008d64-bccc-4d8f-8597-8501e4cb1734",
+ "sessions": [
+ "cf008d64-bccc-4d8f-8597-8501e4cb1734"
+ ],
+ "head": {
+ "round": 1,
+ "digest": "2fd11200be4068d9576ad865467bd2adfe82fe40cbb350b21edfe4197e402087"
+ },
+ "parser": "v1",
+ "policy": "v1+idle=10m0s",
+ "summary": {
+ "title": "provider threads across a resume",
+ "state": "verified",
+ "problems": [],
+ "talks": 3,
+ "steps": 18,
+ "streams": 2,
+ "segments": 1,
+ "rounds": 1,
+ "unresolved": 0,
+ "changes": 0,
+ "provider_bodies": 12,
+ "captured_prompts": 6,
+ "from": 1767225600000,
+ "to": 1767225607800,
+ "kinds": {
+ "agent.call": 1,
+ "agent.launch_ack": 1,
+ "agent.output": 1,
+ "epoch": 2,
+ "llm.call": 6,
+ "message.assistant": 5,
+ "message.external": 2,
+ "run": 3,
+ "segment": 1,
+ "session": 1,
+ "stream": 2,
+ "talk": 3,
+ "tool": 2
+ },
+ "relation_types": {
+ "ends_with": 1,
+ "in_segment": 3,
+ "starts": 1
+ },
+ "quality": {
+ "exact_unique": 4,
+ "strong_inference": 1
+ },
+ "withheld": {}
+ },
+ "rounds": [
+ {
+ "round": 1,
+ "digest": "2fd11200be4068d9576ad865467bd2adfe82fe40cbb350b21edfe4197e402087",
+ "previous": null,
+ "from_seq": 1,
+ "through_seq": 4,
+ "input_digest": "3f442ca4c155048e8a9b3bb1cf84cd8025caf9ec8763677c179fcd7e26f9e56e",
+ "from_time": 1767225600000,
+ "through_time": 1767225607800,
+ "verified": true
+ }
+ ],
+ "files": [
+ {
+ "file": "cf008d64-bccc-4d8f-8597-8501e4cb1734/streams/main/transcript-20260101T000000.000000000Z-000001.sd",
+ "format": "sd",
+ "kind": "transcript",
+ "seq": 1,
+ "round": null,
+ "stream": "main",
+ "run": null,
+ "lines": 12,
+ "bytes": 3884,
+ "digest": "802a8f69b7c75ca3109ea7a44ae8c4d1d54902714e47800120d9b790d37618ab",
+ "from_time": 1767225600000,
+ "through_time": 1767225605400
+ },
+ {
+ "file": "cf008d64-bccc-4d8f-8597-8501e4cb1734/streams/a02ba01b82410e9e3/transcript-20260101T000000.000000000Z-000002.sd",
+ "format": "sd",
+ "kind": "transcript",
+ "seq": 2,
+ "round": null,
+ "stream": "a02ba01b82410e9e3",
+ "run": null,
+ "lines": 7,
+ "bytes": 2220,
+ "digest": "2bef9ab217f89fb7af2b2f31863209910adaa5367dc1a554d77e83615cb2dda9",
+ "from_time": 1767225605400,
+ "through_time": 1767225607800
+ },
+ {
+ "file": "cf008d64-bccc-4d8f-8597-8501e4cb1734/streams/a02ba01b82410e9e3/meta-20260101T000000.000000000Z-000003.sd",
+ "format": "sd",
+ "kind": "agent_meta",
+ "seq": 3,
+ "round": null,
+ "stream": "a02ba01b82410e9e3",
+ "run": null,
+ "lines": 3,
+ "bytes": 666,
+ "digest": "138fcadbb65b435d573bb7c703f6457686c0d9cf1220d58ec7c0f90650d78db7",
+ "from_time": null,
+ "through_time": null
+ },
+ {
+ "file": "cf008d64-bccc-4d8f-8597-8501e4cb1734/provider_body/provider_body-20260101T000000.000000000Z-000004.sd",
+ "format": "sd",
+ "kind": "provider_body",
+ "seq": 4,
+ "round": null,
+ "stream": null,
+ "run": null,
+ "lines": 14,
+ "bytes": 25748,
+ "digest": "24fa0271b384828e351e59dbdb5e9962f3c1f38664f61b95399786c019e39fbb",
+ "from_time": null,
+ "through_time": null
+ },
+ {
+ "file": "_conversations/cf008d64-bccc-4d8f-8597-8501e4cb1734/rounds/r000001-2fd11200be40.sf",
+ "format": "sf",
+ "kind": "round",
+ "seq": null,
+ "round": 1,
+ "stream": null,
+ "run": null,
+ "lines": 37,
+ "bytes": 9782,
+ "digest": "3a7810deb658db4bd15af20f58f55c0efaad5aaca3a0a16deabb6bf62b97929a",
+ "from_time": 1767225600000,
+ "through_time": 1767225607800
+ }
+ ],
+ "streams": [
+ {
+ "id": "stream/main",
+ "name": "main",
+ "role": "main",
+ "label": "",
+ "parent": "",
+ "records": 10,
+ "steps": 12,
+ "talk": "talk/main/s1-cycle",
+ "named_by": "",
+ "opened_by": []
+ },
+ {
+ "id": "stream/a02ba01b82410e9e3",
+ "name": "a02ba01b82410e9e3",
+ "role": "child",
+ "label": "searcher",
+ "parent": "main",
+ "records": 6,
+ "steps": 6,
+ "talk": "talk/a02ba01b82410e9e3",
+ "named_by": "",
+ "opened_by": [
+ {
+ "step": "tool/s6-tool",
+ "stream": "main",
+ "talk": "talk/main/s5-cycle",
+ "quality": "exact_unique"
+ }
+ ]
+ }
+ ],
+ "segments": [
+ {
+ "id": "segment/at_1_2",
+ "talks": 3,
+ "from": 1767225600000,
+ "to": 1767225607800
+ }
+ ],
+ "talks": [
+ {
+ "id": "talk/main/s1-cycle",
+ "kind": "talk",
+ "parent": "epoch/main/0",
+ "stream": "main",
+ "at": 1767225600000,
+ "ref": {
+ "seq": 1,
+ "row": 2
+ },
+ "label": "read the configuration and summarise it",
+ "reply": "The timeout is 30 seconds, with 3 retries.",
+ "runs": 1,
+ "steps": 6,
+ "tools": 1,
+ "from": 1767225600000,
+ "to": 1767225602300,
+ "segment": "segment/at_1_2",
+ "children": [
+ {
+ "id": "run/talk_main_s1-cycle/s1-cycle",
+ "kind": "run",
+ "parent": "talk/main/s1-cycle",
+ "stream": "main",
+ "at": 1767225600000,
+ "ref": {
+ "seq": 1,
+ "row": 2
+ },
+ "children": [
+ {
+ "id": "input/1/2",
+ "kind": "message.external",
+ "parent": "run/talk_main_s1-cycle/s1-cycle",
+ "stream": "main",
+ "at": 1767225600000,
+ "ref": {
+ "seq": 1,
+ "row": 2
+ },
+ "text": "read the configuration and summarise it",
+ "state": "available",
+ "bytes": 39,
+ "flags": [
+ "external_input"
+ ]
+ },
+ {
+ "id": "call/s2-call-0b51c11a1403",
+ "kind": "llm.call",
+ "parent": "run/talk_main_s1-cycle/s1-cycle",
+ "stream": "main",
+ "at": 1767225601000,
+ "ref": {
+ "seq": 1,
+ "row": 3
+ },
+ "refs": [
+ {
+ "seq": 1,
+ "row": 3
+ },
+ {
+ "seq": 1,
+ "row": 4
+ }
+ ],
+ "attrs": {
+ "history": "first",
+ "history_messages": 1,
+ "usage": "observed_replayable",
+ "usage_at": {
+ "row": 4,
+ "seq": 1
+ },
+ "usage_from": "last_fragment_in_line_order"
+ },
+ "usage": {
+ "in": 2,
+ "out": 40,
+ "cache_read": 900,
+ "cache_write": 100
+ },
+ "provider_bodies": [
+ {
+ "role": "request",
+ "ref": {
+ "seq": 4,
+ "row": 1
+ }
+ },
+ {
+ "role": "response",
+ "ref": {
+ "seq": 4,
+ "row": 2
+ }
+ }
+ ],
+ "children": [
+ {
+ "id": "msg/1/3:0",
+ "kind": "message.assistant",
+ "parent": "call/s2-call-0b51c11a1403",
+ "stream": "main",
+ "at": 1767225601000,
+ "ref": {
+ "seq": 1,
+ "row": 3,
+ "block": 0
+ },
+ "text": "Reading it.",
+ "state": "available",
+ "bytes": 11
+ },
+ {
+ "id": "tool/s2-tool",
+ "kind": "tool",
+ "parent": "call/s2-call-0b51c11a1403",
+ "stream": "main",
+ "at": 1767225601100,
+ "ref": {
+ "seq": 1,
+ "row": 4,
+ "block": 0
+ },
+ "refs": [
+ {
+ "seq": 1,
+ "row": 4,
+ "block": 0
+ },
+ {
+ "seq": 1,
+ "row": 5,
+ "block": 0
+ }
+ ],
+ "attrs": {
+ "result": "available",
+ "result_join": "exact_unique",
+ "timing": "unavailable"
+ },
+ "text": "{\"file_path\":\"/Users/dev/scenario/config.yaml\"}",
+ "state": "available",
+ "bytes": 47,
+ "flags": [
+ "finished"
+ ],
+ "name": "Read",
+ "result": "timeout: 30\nretries: 3\n",
+ "result_state": "available",
+ "result_bytes": 23,
+ "request_to_result_ms": 200,
+ "request_to_result_join": "exact_unique"
+ }
+ ]
+ },
+ {
+ "id": "call/s3-call-0b51c11a1403",
+ "kind": "llm.call",
+ "parent": "run/talk_main_s1-cycle/s1-cycle",
+ "stream": "main",
+ "at": 1767225602300,
+ "ref": {
+ "seq": 1,
+ "row": 6
+ },
+ "refs": [
+ {
+ "seq": 1,
+ "row": 6
+ }
+ ],
+ "attrs": {
+ "history": "kept",
+ "history_from": "call/s2-call-0b51c11a1403",
+ "history_messages": 3,
+ "history_reply": "back",
+ "system_changed": "no",
+ "usage": "observed_replayable",
+ "usage_at": {
+ "row": 6,
+ "seq": 1
+ },
+ "usage_from": "last_fragment_in_line_order"
+ },
+ "usage": {
+ "in": 2,
+ "out": 40,
+ "cache_read": 900,
+ "cache_write": 100
+ },
+ "provider_bodies": [
+ {
+ "role": "request",
+ "ref": {
+ "seq": 4,
+ "row": 3
+ }
+ },
+ {
+ "role": "response",
+ "ref": {
+ "seq": 4,
+ "row": 4
+ }
+ }
+ ],
+ "children": [
+ {
+ "id": "msg/1/6:0",
+ "kind": "message.assistant",
+ "parent": "call/s3-call-0b51c11a1403",
+ "stream": "main",
+ "at": 1767225602300,
+ "ref": {
+ "seq": 1,
+ "row": 6,
+ "block": 0
+ },
+ "text": "The timeout is 30 seconds, with 3 retries.",
+ "state": "available",
+ "bytes": 42,
+ "flags": [
+ "finished"
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "edges": [
+ {
+ "type": "in_segment",
+ "other": "segment/at_1_2",
+ "dir": "out",
+ "quality": "exact_unique",
+ "via": "activity window"
+ }
+ ]
+ },
+ {
+ "id": "talk/main/s5-cycle",
+ "kind": "talk",
+ "parent": "epoch/main/0",
+ "stream": "main",
+ "at": 1767225603300,
+ "ref": {
+ "seq": 1,
+ "row": 7
+ },
+ "label": "find where the timeout is used",
+ "reply": "The searcher found it in server.go.",
+ "runs": 1,
+ "steps": 6,
+ "tools": 1,
+ "from": 1767225603300,
+ "to": 1767225605400,
+ "segment": "segment/at_1_2",
+ "children": [
+ {
+ "id": "run/talk_main_s5-cycle/s5-cycle",
+ "kind": "run",
+ "parent": "talk/main/s5-cycle",
+ "stream": "main",
+ "at": 1767225603300,
+ "ref": {
+ "seq": 1,
+ "row": 7
+ },
+ "children": [
+ {
+ "id": "input/1/7",
+ "kind": "message.external",
+ "parent": "run/talk_main_s5-cycle/s5-cycle",
+ "stream": "main",
+ "at": 1767225603300,
+ "ref": {
+ "seq": 1,
+ "row": 7
+ },
+ "text": "find where the timeout is used",
+ "state": "available",
+ "bytes": 30,
+ "flags": [
+ "external_input"
+ ]
+ },
+ {
+ "id": "call/s6-call-0b51c11a1403",
+ "kind": "llm.call",
+ "parent": "run/talk_main_s5-cycle/s5-cycle",
+ "stream": "main",
+ "at": 1767225604300,
+ "ref": {
+ "seq": 1,
+ "row": 8
+ },
+ "refs": [
+ {
+ "seq": 1,
+ "row": 8
+ }
+ ],
+ "attrs": {
+ "history": "kept",
+ "history_from": "call/s3-call-0b51c11a1403",
+ "history_messages": 5,
+ "history_reply": "back",
+ "system_changed": "no",
+ "usage": "observed_replayable",
+ "usage_at": {
+ "row": 8,
+ "seq": 1
+ },
+ "usage_from": "last_fragment_in_line_order"
+ },
+ "usage": {
+ "in": 2,
+ "out": 40,
+ "cache_read": 900,
+ "cache_write": 100
+ },
+ "provider_bodies": [
+ {
+ "role": "request",
+ "ref": {
+ "seq": 4,
+ "row": 5
+ }
+ },
+ {
+ "role": "response",
+ "ref": {
+ "seq": 4,
+ "row": 6
+ }
+ }
+ ],
+ "children": [
+ {
+ "id": "tool/s6-tool",
+ "kind": "agent.call",
+ "parent": "call/s6-call-0b51c11a1403",
+ "stream": "main",
+ "at": 1767225604300,
+ "ref": {
+ "seq": 1,
+ "row": 8,
+ "block": 0
+ },
+ "refs": [
+ {
+ "seq": 1,
+ "row": 8,
+ "block": 0
+ },
+ {
+ "seq": 1,
+ "row": 9,
+ "block": 0
+ }
+ ],
+ "attrs": {
+ "result": "available",
+ "result_join": "exact_unique",
+ "timing": "unavailable"
+ },
+ "text": "{\"description\":\"searcher\",\"prompt\":\"find every use of the timeout\"}",
+ "state": "available",
+ "bytes": 67,
+ "flags": [
+ "finished"
+ ],
+ "name": "Agent",
+ "result": "launched",
+ "result_state": "available",
+ "result_bytes": 8,
+ "request_to_result_ms": 100,
+ "request_to_result_join": "exact_unique",
+ "edges": [
+ {
+ "type": "starts",
+ "other": "stream/a02ba01b82410e9e3",
+ "dir": "out",
+ "quality": "exact_unique",
+ "via": "parent tool result"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ "id": "ack/1/9",
+ "kind": "agent.launch_ack",
+ "parent": "run/talk_main_s5-cycle/s5-cycle",
+ "stream": "main",
+ "at": 1767225604400,
+ "ref": {
+ "seq": 1,
+ "row": 9
+ },
+ "text": "launched",
+ "state": "available",
+ "bytes": 8,
+ "flags": [
+ "launch_ack"
+ ]
+ },
+ {
+ "id": "call/s7-call-0b51c11a1403",
+ "kind": "llm.call",
+ "parent": "run/talk_main_s5-cycle/s5-cycle",
+ "stream": "main",
+ "at": 1767225605400,
+ "ref": {
+ "seq": 1,
+ "row": 10
+ },
+ "refs": [
+ {
+ "seq": 1,
+ "row": 10
+ }
+ ],
+ "attrs": {
+ "history": "kept",
+ "history_from": "call/s6-call-0b51c11a1403",
+ "history_messages": 7,
+ "history_reply": "back",
+ "system_changed": "no",
+ "usage": "observed_replayable",
+ "usage_at": {
+ "row": 10,
+ "seq": 1
+ },
+ "usage_from": "last_fragment_in_line_order"
+ },
+ "usage": {
+ "in": 2,
+ "out": 40,
+ "cache_read": 900,
+ "cache_write": 100
+ },
+ "provider_bodies": [
+ {
+ "role": "request",
+ "ref": {
+ "seq": 4,
+ "row": 7
+ }
+ },
+ {
+ "role": "response",
+ "ref": {
+ "seq": 4,
+ "row": 8
+ }
+ }
+ ],
+ "children": [
+ {
+ "id": "msg/1/10:0",
+ "kind": "message.assistant",
+ "parent": "call/s7-call-0b51c11a1403",
+ "stream": "main",
+ "at": 1767225605400,
+ "ref": {
+ "seq": 1,
+ "row": 10,
+ "block": 0
+ },
+ "text": "The searcher found it in server.go.",
+ "state": "available",
+ "bytes": 35,
+ "flags": [
+ "finished"
+ ]
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "edges": [
+ {
+ "type": "in_segment",
+ "other": "segment/at_1_2",
+ "dir": "out",
+ "quality": "exact_unique",
+ "via": "activity window"
+ }
+ ]
+ },
+ {
+ "id": "talk/a02ba01b82410e9e3",
+ "kind": "talk",
+ "parent": "epoch/a02ba01b82410e9e3/0",
+ "stream": "a02ba01b82410e9e3",
+ "at": 1767225605400,
+ "ref": {
+ "seq": 2,
+ "row": 1
+ },
+ "reply": "It is used in server.go.",
+ "runs": 1,
+ "steps": 6,
+ "tools": 1,
+ "from": 1767225605400,
+ "to": 1767225607800,
+ "child": true,
+ "segment": "segment/at_1_2",
+ "children": [
+ {
+ "id": "run/talk_a02ba01b82410e9e3/a02ba01b82410e9e3-cycle",
+ "kind": "run",
+ "parent": "talk/a02ba01b82410e9e3",
+ "stream": "a02ba01b82410e9e3",
+ "at": 1767225605400,
+ "ref": {
+ "seq": 2,
+ "row": 1
+ },
+ "children": [
+ {
+ "id": "call/searcher-s1-call-0b51c11a1403",
+ "kind": "llm.call",
+ "parent": "run/talk_a02ba01b82410e9e3/a02ba01b82410e9e3-cycle",
+ "stream": "a02ba01b82410e9e3",
+ "at": 1767225606400,
+ "ref": {
+ "seq": 2,
+ "row": 2
+ },
+ "refs": [
+ {
+ "seq": 2,
+ "row": 2
+ },
+ {
+ "seq": 2,
+ "row": 3
+ }
+ ],
+ "attrs": {
+ "history": "first",
+ "history_messages": 1,
+ "usage": "observed_replayable",
+ "usage_at": {
+ "row": 3,
+ "seq": 2
+ },
+ "usage_from": "last_fragment_in_line_order"
+ },
+ "usage": {
+ "in": 2,
+ "out": 40,
+ "cache_read": 900,
+ "cache_write": 100
+ },
+ "provider_bodies": [
+ {
+ "role": "request",
+ "ref": {
+ "seq": 4,
+ "row": 9
+ }
+ },
+ {
+ "role": "response",
+ "ref": {
+ "seq": 4,
+ "row": 10
+ }
+ }
+ ],
+ "children": [
+ {
+ "id": "msg/2/2:0",
+ "kind": "message.assistant",
+ "parent": "call/searcher-s1-call-0b51c11a1403",
+ "stream": "a02ba01b82410e9e3",
+ "at": 1767225606400,
+ "ref": {
+ "seq": 2,
+ "row": 2,
+ "block": 0
+ },
+ "text": "Searching.",
+ "state": "available",
+ "bytes": 10
+ },
+ {
+ "id": "tool/searcher-s1-tool",
+ "kind": "tool",
+ "parent": "call/searcher-s1-call-0b51c11a1403",
+ "stream": "a02ba01b82410e9e3",
+ "at": 1767225606500,
+ "ref": {
+ "seq": 2,
+ "row": 3,
+ "block": 0
+ },
+ "refs": [
+ {
+ "seq": 2,
+ "row": 3,
+ "block": 0
+ },
+ {
+ "seq": 2,
+ "row": 4,
+ "block": 0
+ }
+ ],
+ "attrs": {
+ "result": "available",
+ "result_join": "exact_unique",
+ "timing": "unavailable"
+ },
+ "text": "{\"command\":\"grep -rn timeout .\"}",
+ "state": "available",
+ "bytes": 32,
+ "flags": [
+ "finished"
+ ],
+ "name": "Bash",
+ "result": "server.go:3: var timeout = 30",
+ "result_state": "available",
+ "result_bytes": 29,
+ "request_to_result_ms": 300,
+ "request_to_result_join": "exact_unique"
+ }
+ ]
+ },
+ {
+ "id": "call/searcher-s2-call-0b51c11a1403",
+ "kind": "llm.call",
+ "parent": "run/talk_a02ba01b82410e9e3/a02ba01b82410e9e3-cycle",
+ "stream": "a02ba01b82410e9e3",
+ "at": 1767225607800,
+ "ref": {
+ "seq": 2,
+ "row": 5
+ },
+ "refs": [
+ {
+ "seq": 2,
+ "row": 5
+ }
+ ],
+ "attrs": {
+ "history": "kept",
+ "history_from": "call/searcher-s1-call-0b51c11a1403",
+ "history_messages": 3,
+ "history_reply": "back",
+ "system_changed": "no",
+ "usage": "observed_replayable",
+ "usage_at": {
+ "row": 5,
+ "seq": 2
+ },
+ "usage_from": "last_fragment_in_line_order"
+ },
+ "usage": {
+ "in": 2,
+ "out": 40,
+ "cache_read": 900,
+ "cache_write": 100
+ },
+ "provider_bodies": [
+ {
+ "role": "request",
+ "ref": {
+ "seq": 4,
+ "row": 11
+ }
+ },
+ {
+ "role": "response",
+ "ref": {
+ "seq": 4,
+ "row": 12
+ }
+ }
+ ],
+ "children": [
+ {
+ "id": "msg/2/5:0",
+ "kind": "message.assistant",
+ "parent": "call/searcher-s2-call-0b51c11a1403",
+ "stream": "a02ba01b82410e9e3",
+ "at": 1767225607800,
+ "ref": {
+ "seq": 2,
+ "row": 5,
+ "block": 0
+ },
+ "text": "It is used in server.go.",
+ "state": "available",
+ "bytes": 24,
+ "flags": [
+ "finished"
+ ]
+ }
+ ]
+ },
+ {
+ "id": "output/a02ba01b82410e9e3",
+ "kind": "agent.output",
+ "parent": "run/talk_a02ba01b82410e9e3/a02ba01b82410e9e3-cycle",
+ "stream": "a02ba01b82410e9e3",
+ "at": 1767225607800,
+ "ref": {
+ "seq": 2,
+ "row": 5
+ },
+ "refs": [
+ {
+ "seq": 2,
+ "row": 5
+ }
+ ],
+ "attrs": {
+ "returned_value": "unavailable"
+ },
+ "text": "It is used in server.go.",
+ "state": "available",
+ "bytes": 24,
+ "flags": [
+ "finished"
+ ],
+ "edges": [
+ {
+ "type": "ends_with",
+ "other": "stream/a02ba01b82410e9e3",
+ "dir": "in",
+ "quality": "exact_unique",
+ "via": "the last response in the child stream, and what it returned"
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ "edges": [
+ {
+ "type": "in_segment",
+ "other": "segment/at_1_2",
+ "dir": "out",
+ "quality": "strong_inference",
+ "via": "inside the window of the talk that delegated it"
+ }
+ ]
+ }
+ ],
+ "loose": [],
+ "relations": [
+ {
+ "id": "rel/in_segment/talk_main_s1-cycle/segment_at_1_2",
+ "type": "in_segment",
+ "from": "talk/main/s1-cycle",
+ "to": "segment/at_1_2",
+ "quality": "exact_unique",
+ "via": "activity window",
+ "evidence": [
+ {
+ "seq": 1,
+ "row": 2
+ }
+ ]
+ },
+ {
+ "id": "rel/in_segment/talk_main_s5-cycle/segment_at_1_2",
+ "type": "in_segment",
+ "from": "talk/main/s5-cycle",
+ "to": "segment/at_1_2",
+ "quality": "exact_unique",
+ "via": "activity window",
+ "evidence": [
+ {
+ "seq": 1,
+ "row": 7
+ }
+ ]
+ },
+ {
+ "id": "rel/starts/tool_s6-tool/stream_a02ba01b82410e9e3",
+ "type": "starts",
+ "from": "tool/s6-tool",
+ "to": "stream/a02ba01b82410e9e3",
+ "quality": "exact_unique",
+ "via": "parent tool result",
+ "evidence": [
+ {
+ "seq": 1,
+ "row": 9
+ }
+ ]
+ },
+ {
+ "id": "rel/in_segment/talk_a02ba01b82410e9e3/segment_at_1_2",
+ "type": "in_segment",
+ "from": "talk/a02ba01b82410e9e3",
+ "to": "segment/at_1_2",
+ "quality": "strong_inference",
+ "via": "inside the window of the talk that delegated it",
+ "evidence": [
+ {
+ "seq": 2,
+ "row": 1
+ }
+ ]
+ },
+ {
+ "id": "rel/ends_with/stream_a02ba01b82410e9e3/output_a02ba01b82410e9e3",
+ "type": "ends_with",
+ "from": "stream/a02ba01b82410e9e3",
+ "to": "output/a02ba01b82410e9e3",
+ "quality": "exact_unique",
+ "via": "the last response in the child stream, and what it returned",
+ "evidence": [
+ {
+ "seq": 2,
+ "row": 5
+ }
+ ]
+ }
+ ],
+ "unresolved": [],
+ "workspace_changes": [],
+ "tool_executions": []
+}
diff --git a/packages/conversation-view/test/fixtures/history/threads.sd b/packages/conversation-view/test/fixtures/history/threads.sd
new file mode 100644
index 00000000..8e6f49fe
--- /dev/null
+++ b/packages/conversation-view/test/fixtures/history/threads.sd
@@ -0,0 +1,14 @@
+{"h":1,"schema":"sd/1","seq":4,"at":"2026-01-01T00:00:00Z","kind":"provider_body","adapter":"mock/0.2.0","dialect":"mock/1","src":".","session":"cf008d64-bccc-4d8f-8597-8501e4cb1734"}
+{"ord":1,"off":0,"sha":"c7df92cc2d04","bytes":8182,"id":"fc8d92be-d3c8-4006-8525-9cdb3923e90a.request","run":"s1-cycle","model":"claude-opus-5","parts":[{"k":"data","data":"<system-reminder>\nCodebase and user instructions are shown below.\nFollow the project's rules. Follow the project's rules. Follow the project's rules. Follow the project's rules. Follow the project's rules. Follow the project's rules. Follow the project's rules. Follow the project's rules. Follow the project's rules. [...]
+{"ord":1,"off":0,"sha":"b298d379109a","bytes":478,"id":"s2-req-0b51c11a1403.response","call":"s2-call-0b51c11a1403","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"response","src":"s2-req-0b51c11a1403.response.json","sha256":"b298d379109ac9380cb4a1b350db616a6918b32918b4b5054008837530ba05ba","bytes":478,"depth":0,"model":"claude-opus-5","call":"s2-call-0b51c11a1403","request":"s2-req-0b51c11a1403","history_form":"claude-code/1","reply":{"digest":"79 [...]
+{"ord":1,"off":0,"sha":"c2d3281fe0b8","bytes":591,"id":"c7bb9498-f609-4bcd-80f7-76c4dbb74364.request","run":"s1-cycle","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"request","src":"c7bb9498-f609-4bcd-80f7-76c4dbb74364.request.json","sha256":"c2d3281fe0b86ae20c37e64e57c2978aa618c69d6c2f67fb9558eb39e13a612e","bytes":591,"depth":0,"chain":"dd1f3bf3020ec039","model":"claude-opus-5","session":"cf008d64-bccc-4d8f-8597-8501e4cb1734","previous_request":" [...]
+{"ord":1,"off":0,"sha":"6f17b3713d1c","bytes":404,"id":"s3-req-0b51c11a1403.response","call":"s3-call-0b51c11a1403","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"response","src":"s3-req-0b51c11a1403.response.json","sha256":"6f17b3713d1c38540548537a92ec734720a4ab662119e7d2c266a0182b5c4828","bytes":404,"depth":0,"model":"claude-opus-5","call":"s3-call-0b51c11a1403","request":"s3-req-0b51c11a1403","history_form":"claude-code/1","reply":{"digest":"f1 [...]
+{"ord":1,"off":0,"sha":"bd8e54bf8f64","bytes":8663,"id":"8bda46ef-9f7d-40fd-8ff9-7821cf6b8838.request","run":"s5-cycle","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"request","src":"8bda46ef-9f7d-40fd-8ff9-7821cf6b8838.request.json","sha256":"bd8e54bf8f6486af20e9d8a63eeee232b8c611e1e64a259ae818643365614e9d","bytes":8663,"depth":0,"chain":"f48484e6a7a8135e","model":"claude-opus-5","session":"cf008d64-bccc-4d8f-8597-8501e4cb1734","previous_request" [...]
+{"ord":1,"off":0,"sha":"58813cd3f569","bytes":462,"id":"s6-req-0b51c11a1403.response","call":"s6-call-0b51c11a1403","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"response","src":"s6-req-0b51c11a1403.response.json","sha256":"58813cd3f569f08f153f629a628afcbb18c73fc2f1b3f543321ddc01a1023abc","bytes":462,"depth":0,"model":"claude-opus-5","call":"s6-call-0b51c11a1403","request":"s6-req-0b51c11a1403","history_form":"claude-code/1","reply":{"digest":"c7 [...]
+{"ord":1,"off":0,"sha":"d4e4c80f9883","bytes":574,"id":"72f68fb3-8af4-4c84-8309-995a03c2f740.request","run":"s5-cycle","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"request","src":"72f68fb3-8af4-4c84-8309-995a03c2f740.request.json","sha256":"d4e4c80f9883d14f9cb5ad1f147cf966f57c11694a195983096003c836a77abe","bytes":574,"depth":0,"chain":"35dbf7f54a139916","model":"claude-opus-5","session":"cf008d64-bccc-4d8f-8597-8501e4cb1734","previous_request":" [...]
+{"ord":1,"off":0,"sha":"0e4b52468a57","bytes":397,"id":"s7-req-0b51c11a1403.response","call":"s7-call-0b51c11a1403","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"response","src":"s7-req-0b51c11a1403.response.json","sha256":"0e4b52468a579d4b476b0a1a701c21d0ce9df02b14a9261138b25a06d875b806","bytes":397,"depth":0,"model":"claude-opus-5","call":"s7-call-0b51c11a1403","request":"s7-req-0b51c11a1403","history_form":"claude-code/1","reply":{"digest":"13 [...]
+{"ord":1,"off":0,"sha":"bcc85db523c7","bytes":3780,"id":"dbe4070f-cd9d-4717-8d5e-702b28481765.request","run":"a02ba01b82410e9e3-cycle","model":"claude-opus-5","parts":[{"k":"data","data":"You are an agent that searches a repository. Report what you find. Report what you find. Report what you find. Report what you find. Report what you find. Report what you find. Report what you find. Report what you find. Report what you find. Report what you find. Report what you find. Report what you f [...]
+{"ord":1,"off":0,"sha":"752555849be5","bytes":480,"id":"searcher-s1-req-0b51c11a1403.response","call":"searcher-s1-call-0b51c11a1403","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"response","src":"searcher-s1-req-0b51c11a1403.response.json","sha256":"752555849be5e67847c2df964ae234c36cdf34daea3655a6a4b43ac1dda0a840","bytes":480,"depth":0,"model":"claude-opus-5","call":"searcher-s1-call-0b51c11a1403","request":"searcher-s1-req-0b51c11a1403","histor [...]
+{"ord":1,"off":0,"sha":"4349c2a8ca08","bytes":637,"id":"e01308f7-8b0e-4173-89c2-5445066982a6.request","run":"a02ba01b82410e9e3-cycle","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"request","src":"e01308f7-8b0e-4173-89c2-5445066982a6.request.json","sha256":"4349c2a8ca0805f1562586579c40b6a298c04809fd5801baf6059c38aa361aed","bytes":637,"depth":0,"chain":"1c54e9a0c97800eb","model":"claude-opus-5","session":"cf008d64-bccc-4d8f-8597-8501e4cb1734","prev [...]
+{"ord":1,"off":0,"sha":"18e24e10235b","bytes":395,"id":"searcher-s2-req-0b51c11a1403.response","call":"searcher-s2-call-0b51c11a1403","model":"claude-opus-5","parts":[{"k":"data","data":{"schema":"provider_body/1","role":"response","src":"searcher-s2-req-0b51c11a1403.response.json","sha256":"18e24e10235b89b09ec5491af16a63fb5118f7dcca1e74fcf595b085c0e54bb4","bytes":395,"depth":0,"model":"claude-opus-5","call":"searcher-s2-call-0b51c11a1403","request":"searcher-s2-req-0b51c11a1403","histor [...]
+{"t":"end","records":12,"digest":"986aa81a48fe4a851d483d8d016d33d16fa6d0a0d499c719ce5bc4f2661016f6"}
diff --git a/packages/conversation-view/test/prompt-guards.test.ts b/packages/conversation-view/test/prompt-guards.test.ts
index c9efcf60..d1ae2e59 100644
--- a/packages/conversation-view/test/prompt-guards.test.ts
+++ b/packages/conversation-view/test/prompt-guards.test.ts
@@ -22,7 +22,7 @@
import { describe, expect, it } from 'vitest';
import { PromptError, PromptStore, readProviderFile } from '../src/prompt/store.js';
-import { deltaOf, readBody, type ReadRequest } from '../src/prompt/messages.js';
+import { outsideOf, readBody, type ReadRequest } from '../src/prompt/messages.js';
const HEADER = '{"h":1,"schema":"sd/1","seq":1,"at":"2026-01-01T00:00:00Z","kind":"provider_body","adapter":"mock/0.2.0","dialect":"mock/1","src":".","session":"s"}';
const END = '{"t":"end"}';
@@ -130,80 +130,46 @@ describe('what the body reader refuses', () => {
});
});
-describe('what the delta compares', () => {
- const request = (messages: unknown[]): ReadRequest =>
- readBody(new TextEncoder().encode(JSON.stringify({ model: 'm', messages })), 'request') as ReadRequest;
-
- it('leaves out the cache marker the runtime moves, and nothing else named like it', () => {
- const before = request([{ role: 'user', content: [{ type: 'text', text: 'hi', cache_control: { type: 'ephemeral' } }] }]);
- const after = request([{ role: 'user', content: [{ type: 'text', text: 'hi' }] }]);
- expect(deltaOf(before, after).sharedMessages).toBe(1);
- // the same name inside a tool's own input is the agent's data, and two calls that differ there differ
- const one = request([{ role: 'assistant', content: [{ type: 'tool_use', name: 'Run', input: { cache_control: 'a' } }] }]);
- const two = request([{ role: 'assistant', content: [{ type: 'tool_use', name: 'Run', input: { cache_control: 'b' } }] }]);
- expect(deltaOf(one, two).sharedMessages).toBe(0);
+describe('what is compared outside the messages', () => {
+ const request = (fields: Record<string, unknown>): ReadRequest =>
+ readBody(new TextEncoder().encode(JSON.stringify({ model: 'm', messages: [], ...fields })), 'request') as ReadRequest;
+ const tool = (extra: Record<string, unknown> = {}) => ({ name: 'Run', description: 'runs', input_schema: { type: 'object' }, ...extra });
+
+ it('leaves out the cache marker the runtime moves on a tool, and nothing else named like it', () => {
+ const marked = request({ tools: [tool({ cache_control: { type: 'ephemeral' } })] });
+ expect(outsideOf(marked, request({ tools: [tool()] }), false).tools).toBe(false);
+ // the same name inside a tool's own schema is the agent's data, and two tools that differ there differ
+ const one = request({ tools: [tool({ input_schema: { cache_control: 'a' } })] });
+ const two = request({ tools: [tool({ input_schema: { cache_control: 'b' } })] });
+ expect(outsideOf(one, two, false).tools).toBe(true);
});
- it('reads a one-block message and its plain string as the same message', () => {
- // A message of one text block is sent as a list while it is the newest, and as a plain string
- // once the cache marker has left it. Both spellings are the same message, and before this every
- // message compared unequal the moment it stopped being newest: on one real 94-call conversation
- // 60 of 62 growth steps were reported as a rewritten history.
- const newest = request([{ role: 'user', content: [{ type: 'text', text: 'which four?', cache_control: { type: 'ephemeral' } }] }]);
- const passed = request([{ role: 'user', content: 'which four?' }]);
- const d = deltaOf(newest, passed);
- expect(d.sharedMessages).toBe(1);
- expect(d.rewritten).toBe(false);
- expect(d.replaced).toBe(false);
- // and a message of several blocks never takes the short spelling, so it is not folded away
- const many = request([{ role: 'user', content: [{ type: 'text', text: 'a' }, { type: 'text', text: 'b' }] }]);
- const one = request([{ role: 'user', content: 'ab' }]);
- expect(deltaOf(many, one).sharedMessages).toBe(0);
- // nor does a lone block that is not text
- const tool = request([{ role: 'user', content: [{ type: 'tool_result', tool_use_id: 't', content: 'x' }] }]);
- expect(deltaOf(tool, request([{ role: 'user', content: 'x' }])).sharedMessages).toBe(0);
+ it('leaves the tools out only where a request continues a provider thread', () => {
+ // such a request sends no tools, and that is not a change
+ expect(outsideOf(request({ tools: [tool()] }), request({}), true).tools).toBe(false);
+ // between two other requests, a tool list taken away or added is one
+ expect(outsideOf(request({ tools: [tool()] }), request({}), false).tools).toBe(true);
+ expect(outsideOf(request({}), request({ tools: [tool()] }), false).tools).toBe(true);
+ expect(outsideOf(request({ tools: [tool()] }), request({ tools: [] }), false).tools).toBe(true);
});
- it('calls a compaction a compaction, and an unexplained rewrite a rewrite', () => {
- const before = request([
- { role: 'user', content: 'find the loaders' },
- { role: 'assistant', content: 'here they are' },
- { role: 'user', content: 'and the callers?' },
- ]);
- // a compaction replaces the context with a summary: the list is shorter and starts again
- const compacted = request([{ role: 'user', content: 'Summary: two loaders, callers pending.' }]);
- const c = deltaOf(before, compacted);
- expect(c.rewritten).toBe(true);
- expect(c.replaced).toBe(true);
- expect(c.sharedMessages).toBe(0);
- // a history edited in place is not a compaction: same length, different text
- const edited = request([
- { role: 'user', content: 'find the loaders' },
- { role: 'assistant', content: 'here they are NOT' },
- { role: 'user', content: 'and the callers?' },
- ]);
- const e = deltaOf(before, edited);
- expect(e.rewritten).toBe(true);
- expect(e.replaced).toBe(false);
- });
-
- it('reports a request that adds nothing', () => {
- const one = request([{ role: 'user', content: 'go' }]);
- const d = deltaOf(one, request([{ role: 'user', content: 'go' }]));
- expect(d.added).toHaveLength(0);
- expect(d.rewritten).toBe(false);
+ it('leaves out what a request says about itself rather than about the call', () => {
+ const one = request({ max_tokens: 10, metadata: { user_id: 'a' }, thread: { type: 'create' } });
+ const two = request({ max_tokens: 10, metadata: { user_id: 'b' }, thread: { type: 'continue' }, diagnostics: {} });
+ expect(outsideOf(one, two, false).settings).toBe(false);
+ expect(outsideOf(one, request({ max_tokens: 20 }), false).settings).toBe(true);
});
it('sees a difference under a top-level __proto__, not only a nested one', () => {
const one = readBody(new TextEncoder().encode('{"model":"m","messages":[],"__proto__":{"x":1}}'), 'request') as ReadRequest;
const two = readBody(new TextEncoder().encode('{"model":"m","messages":[],"__proto__":{"x":2}}'), 'request') as ReadRequest;
expect(Object.keys(one.rest)).toContain('__proto__');
- expect(deltaOf(one, two).settingsChanged).toBe(true);
+ expect(outsideOf(one, two, false).settings).toBe(true);
});
it('sees a difference under a key named __proto__', () => {
- const one = request([JSON.parse('{"role":"user","content":[{"type":"tool_use","name":"R","input":{"__proto__":{"x":1}}}]}') as unknown]);
- const two = request([JSON.parse('{"role":"user","content":[{"type":"tool_use","name":"R","input":{"__proto__":{"x":2}}}]}') as unknown]);
- expect(deltaOf(one, two).sharedMessages).toBe(0);
+ const one = request({ tools: [JSON.parse('{"name":"R","input_schema":{"__proto__":{"x":1}}}') as unknown] });
+ const two = request({ tools: [JSON.parse('{"name":"R","input_schema":{"__proto__":{"x":2}}}') as unknown] });
+ expect(outsideOf(one, two, false).tools).toBe(true);
});
});
diff --git a/packages/conversation-view/test/prompt-history.test.ts b/packages/conversation-view/test/prompt-history.test.ts
new file mode 100644
index 00000000..acf882a4
--- /dev/null
+++ b/packages/conversation-view/test/prompt-history.test.ts
@@ -0,0 +1,429 @@
+/*
+ * Licensed to Apache Software Foundation (ASF) under one or more contributor
+ * license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright
+ * ownership. Apache Software Foundation (ASF) licenses this file to you under
+ * the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+
+/**
+ * Where a call's history changed, as the page shows it: the card the Sessionizer draws before the
+ * call, and the Prompt tab's "What changed", which says what the document found rather than reading a
+ * history from where messages sit in two bodies.
+ *
+ * The fixtures are three Sessionizer scenarios, built and parsed by asz with `asz scenario build
+ * tests/scenarios/<name>.yaml --format sd --at 2026-01-01T00:00:00Z`, `asz parse` and `asz
+ * conversation -json`: `history-forget` (an application trims its history, so the last call's history
+ * changed), `history-threads` (Claude Code continues a provider thread, so a request holds only its new
+ * messages), and `provider-bodies` (a reset with a summary). Each `.sd` is the session's one provider
+ * file.
+ */
+
+import { readFileSync } from 'node:fs';
+import { resolve } from 'node:path';
+import { afterEach, describe, expect, it } from 'vitest';
+import { mountConversationView, type AszViewDocument, type ConversationView, type StoredFile } from '../src/index.js';
+import { PromptStore } from '../src/prompt/store.js';
+import { changedMarks, keptMarks } from '../src/view/prompt.js';
+
+function fixture(name: string): { doc: AszViewDocument; file: Uint8Array } {
+ return {
+ doc: JSON.parse(readFileSync(resolve(`test/fixtures/history/${name}.json`), 'utf8')) as AszViewDocument,
+ file: new Uint8Array(readFileSync(resolve(`test/fixtures/history/${name}.sd`))),
+ };
+}
+
+let view: ConversationView | null = null;
+let host: HTMLElement | null = null;
+
+function mount(name: string, step: string): HTMLElement {
+ const { doc, file } = fixture(name);
+ host = document.createElement('div');
+ document.body.appendChild(host);
+ view = mountConversationView(host, {
+ document: doc,
+ loadFiles: async (request: { session: string; seqs: number[] }, onFile: (f: StoredFile) => void) => {
+ for (const seq of request.seqs) onFile({ seq, file: `${request.session}/provider_body/x.sd`, bytes: file });
+ },
+ state: { step },
+ });
+ return host;
+}
+
+function mountDoc(doc: AszViewDocument, file: Uint8Array, step: string): HTMLElement {
+ host = document.createElement('div');
+ document.body.appendChild(host);
+ view = mountConversationView(host, {
+ document: doc,
+ loadFiles: async (request: { session: string; seqs: number[] }, onFile: (f: StoredFile) => void) => {
+ for (const seq of request.seqs) onFile({ seq, file: `${request.session}/provider_body/x.sd`, bytes: file });
+ },
+ state: { step },
+ });
+ return host;
+}
+
+/** Every node of a document, so a test can change one. */
+function nodesOf(doc: AszViewDocument): Array<Record<string, unknown> & { id: string; children?: unknown[] }> {
+ const out: Array<Record<string, unknown> & { id: string; children?: unknown[] }> = [];
+ const walk = (nodes: unknown[]): void => {
+ for (const n of nodes as Array<Record<string, unknown> & { id: string; children?: unknown[] }>) {
+ out.push(n);
+ walk(n.children ?? []);
+ }
+ };
+ walk(doc.talks);
+ walk(doc.loose ?? []);
+ return out;
+}
+
+function panel(root: HTMLElement): HTMLElement {
+ return root.querySelector<HTMLElement>('.acv-inspector-body')!;
+}
+
+/** The Prompt tab of the selected call, loaded, in its "What changed" mode. */
+async function changes(root: HTMLElement): Promise<HTMLElement> {
+ root.querySelector<HTMLButtonElement>('[data-tab="prompt"]')!.click();
+ panel(root).querySelector<HTMLButtonElement>('[data-load-prompt]')!.click();
+ await new Promise((r) => setTimeout(r, 0));
+ panel(root).querySelector<HTMLButtonElement>('[data-prompt-whole="0"]')!.click();
+ return panel(root);
+}
+
+function marks(body: HTMLElement): string[] {
+ return [...body.querySelectorAll('.acv-history-mark')].map((m) => m.textContent ?? '');
+}
+
+afterEach(() => {
+ view?.destroy();
+ view = null;
+ host?.remove();
+ host = null;
+});
+
+const TRIMMED = 'call/s9-call-2d0e5ed6b2ef';
+
+describe('the history.change card', () => {
+ it('stands just before its call, in its own colour, and says what changed', () => {
+ const root = mount('forget', TRIMMED);
+ // the timeline draws it too, in the same colour, just before the call
+ const clips = [...root.querySelectorAll<HTMLElement>('.acv-clip[data-node]')].map((c) => c.dataset['node']);
+ expect(clips[clips.indexOf(TRIMMED) - 1]).toBe('history/s9-call-2d0e5ed6b2ef');
+ expect(root.querySelector('.acv-clip[data-node="history/s9-call-2d0e5ed6b2ef"]')!.classList.contains('acv-kind-history')).toBe(true);
+ root.querySelector<HTMLButtonElement>('.acv-fold[data-work="talk/main/s8-cycle"]')!.click();
+ const cards = [...root.querySelectorAll<HTMLElement>('.acv-card[data-card]')];
+ const card = cards.find((c) => c.classList.contains('acv-history'));
+ expect(card).toBeDefined();
+ expect(card!.textContent).toContain('History changed · cause unavailable');
+ expect(card!.querySelector('.acv-history-line')!.textContent).toBe(
+ '3 kept, 0 changed, 2 dropped, 2 added · the previous reply is included unchanged',
+ );
+ expect(card!.querySelector('.acv-title')!.classList.contains('acv-kind-history')).toBe(true);
+ // the card selects the call it stands before, and is drawn right before that call's card
+ expect(card!.dataset['card']).toBe(TRIMMED);
+ const at = cards.indexOf(card!);
+ expect(cards[at + 1]!.dataset['card']).toBe(TRIMMED);
+ expect(cards[at + 1]!.classList.contains('acv-history')).toBe(false);
+ // a history that only grew draws no card
+ expect(cards.filter((c) => c.classList.contains('acv-history'))).toHaveLength(1);
+ });
+
+ it('comes before its call however the document lists the two, which share a record', () => {
+ const { doc, file } = fixture('forget');
+ const swap = (nodes: AszViewDocument['talks']): void => {
+ for (const n of nodes) {
+ const kids = n.children ?? [];
+ const at = kids.findIndex((k) => k.id === 'history/s9-call-2d0e5ed6b2ef');
+ if (at >= 0) kids.splice(at, 2, kids[at + 1]!, kids[at]!);
+ swap(kids);
+ }
+ };
+ swap(doc.talks);
+ host = document.createElement('div');
+ document.body.appendChild(host);
+ view = mountConversationView(host, {
+ document: doc,
+ loadFiles: async (request: { session: string; seqs: number[] }, onFile: (f: StoredFile) => void) => {
+ for (const seq of request.seqs) onFile({ seq, file: `${request.session}/provider_body/x.sd`, bytes: file });
+ },
+ state: { step: TRIMMED },
+ });
+ const clips = [...host.querySelectorAll<HTMLElement>('.acv-clip[data-node]')].map((c) => c.dataset['node']);
+ expect(clips[clips.indexOf(TRIMMED) - 1]).toBe('history/s9-call-2d0e5ed6b2ef');
+ host.querySelector<HTMLButtonElement>('.acv-fold[data-work="talk/main/s8-cycle"]')!.click();
+ const cards = [...host.querySelectorAll<HTMLElement>('.acv-card[data-card]')];
+ const card = cards.findIndex((c) => c.classList.contains('acv-history'));
+ expect(cards[card + 1]!.dataset['card']).toBe(TRIMMED);
+ });
+
+ it('selects its call from the timeline as from the transcript, and itself when the call is not there', () => {
+ const root = mount('forget', 'call/s4-call-2d0e5ed6b2ef');
+ root.querySelector<HTMLElement>('.acv-clip[data-node="history/s9-call-2d0e5ed6b2ef"]')!.click();
+ expect(view!.getState().step).toBe(TRIMMED);
+ view?.destroy();
+ host?.remove();
+
+ const { doc, file } = fixture('forget');
+ for (const n of nodesOf(doc)) {
+ if (n.children) n.children = n.children.filter((k) => (k as { id: string }).id !== TRIMMED);
+ }
+ const alone = mountDoc(doc, file, 'call/s4-call-2d0e5ed6b2ef');
+ alone.querySelector<HTMLButtonElement>('.acv-fold[data-work="talk/main/s8-cycle"]')!.click();
+ expect(alone.querySelector<HTMLElement>('.acv-card.acv-history')!.dataset['card']).toBe('history/s9-call-2d0e5ed6b2ef');
+ alone.querySelector<HTMLElement>('.acv-clip[data-node="history/s9-call-2d0e5ed6b2ef"]')!.click();
+ expect(view!.getState().step).toBe('history/s9-call-2d0e5ed6b2ef');
+ });
+
+ it('says no count it does not carry', () => {
+ const { doc, file } = fixture('forget');
+ const card = nodesOf(doc).find((n) => n.id === 'history/s9-call-2d0e5ed6b2ef')!;
+ delete (card['attrs'] as Record<string, unknown>)['kept'];
+ const root = mountDoc(doc, file, TRIMMED);
+ root.querySelector<HTMLButtonElement>('.acv-fold[data-work="talk/main/s8-cycle"]')!.click();
+ expect(root.querySelector('.acv-history-line')!.textContent).toBe('the previous reply is included unchanged');
+ });
+
+ it('draws no card where a thread holds only the new messages', () => {
+ const root = mount('threads', 'call/s7-call-0b51c11a1403');
+ for (const fold of root.querySelectorAll<HTMLButtonElement>('.acv-fold[data-work]')) fold.click();
+ expect(root.querySelectorAll('.acv-card[data-card]').length).toBeGreaterThan(0);
+ expect(root.querySelectorAll('.acv-card.acv-history, .acv-clip.acv-kind-history')).toHaveLength(0);
+ });
+});
+
+describe('what changed, in the Prompt tab', () => {
+ it('marks each message of a changed history, and lists what was dropped', async () => {
+ const body = await changes(mount('forget', TRIMMED));
+ expect(body.textContent).toContain('The history of the call before changed: 3 kept, 0 changed, 2 dropped, 2 added');
+ expect(marks(body)).toEqual(['kept', 'kept', 'kept', 'added', 'added', 'dropped', 'dropped']);
+ expect(body.textContent).toContain('Dropped from the call before (2)');
+ expect(body.textContent).not.toContain('replaced by a summary');
+ });
+
+ it('shows what a kept history added after the history before it', async () => {
+ const body = await changes(mount('forget', 'call/s4-call-2d0e5ed6b2ef'));
+ expect(body.textContent).toContain('its 1 message(s) come first, as it sent them');
+ expect(body.textContent).toContain('the previous reply is included unchanged');
+ expect(body.textContent).toContain('Added by this call (2)');
+ expect(marks(body)).toEqual(['added', 'added']);
+ });
+
+ it('reads a request that continues a thread as holding only its new messages', async () => {
+ // Before, this request's one message against the five of the call before read as a context
+ // replaced by a summary: "5 message(s) became 1".
+ const body = await changes(mount('threads', 'call/s7-call-0b51c11a1403'));
+ expect(body.textContent).toContain('its 5 message(s) come first');
+ expect(body.textContent).toContain('continues a provider thread');
+ expect(body.textContent).toContain('the previous reply is included unchanged');
+ expect(marks(body)).toEqual(['added']);
+ expect(body.textContent).not.toContain('replaced by a summary');
+ expect(body.textContent).not.toContain('rewritten');
+ });
+
+ it('says a reset only where the conversation has one, and a summary only where the reset has one', async () => {
+ const reset = await changes(mount('reset', 'call/s9-call-fdae022ac306'));
+ expect(reset.textContent).toContain('The context was reset here and replaced by a summary');
+ view?.destroy();
+ host?.remove();
+ const first = await changes(mount('reset', 'call/s2-call-fdae022ac306'));
+ expect(first.textContent).toContain('This is the first call of its stream since the context began');
+ expect(first.textContent).not.toContain('reset');
+ });
+
+ it('finds the reset past a call the framework made for its own purpose', async () => {
+ const { doc, file } = fixture('reset');
+ // a summariser's calls after the reset, one with its class and one whose request carried no history,
+ // so it says nothing: neither is a predecessor, so neither hides the reset
+ (doc.loose ??= []).push(
+ {
+ id: 'call/internal', kind: 'llm.call', stream: 'main', ref: { seq: 1, row: 13 },
+ attrs: { history: 'not_compared', history_reason: 'internal_call' },
+ } as unknown as AszViewDocument['talks'][number],
+ { id: 'call/older', kind: 'llm.call', stream: 'main', ref: { seq: 1, row: 13 } } as unknown as AszViewDocument['talks'][number],
+ );
+ const body = await changes(mountDoc(doc, file, 'call/s9-call-fdae022ac306'));
+ expect(body.textContent).toContain('The context was reset here and replaced by a summary');
+ });
+
+ it('names a reason it does not know rather than taking it for the framework\'s', async () => {
+ const { doc, file } = fixture('forget');
+ const call = nodesOf(doc).find((n) => n.id === 'call/s4-call-2d0e5ed6b2ef')!;
+ Object.assign(call['attrs'] as Record<string, unknown>, { history: 'not_compared', history_reason: 'a_later_reason' });
+ const body = await changes(mountDoc(doc, file, 'call/s4-call-2d0e5ed6b2ef'));
+ expect(body.textContent).toContain('a_later_reason');
+ expect(body.textContent).not.toContain('framework');
+ });
+
+ it('marks a kept history by the call\'s own lengths, without the body of the call before', async () => {
+ const { doc } = fixture('forget');
+ const strip = (nodes: AszViewDocument['talks']): void => {
+ for (const n of nodes) {
+ if (n.id === 'call/s2-call-2d0e5ed6b2ef') delete (n as { provider_bodies?: unknown }).provider_bodies;
+ strip(n.children ?? []);
+ }
+ };
+ strip(doc.talks);
+ const { file } = fixture('forget');
+ host = document.createElement('div');
+ document.body.appendChild(host);
+ view = mountConversationView(host, {
+ document: doc,
+ loadFiles: async (request: { session: string; seqs: number[] }, onFile: (f: StoredFile) => void) => {
+ for (const seq of request.seqs) onFile({ seq, file: `${request.session}/provider_body/x.sd`, bytes: file });
+ },
+ state: { step: 'call/s4-call-2d0e5ed6b2ef' },
+ });
+ const body = await changes(host);
+ expect(marks(body)).toEqual(['added', 'added']);
+ expect(body.textContent).not.toContain('Also changed');
+ });
+});
+
+describe('the marks', () => {
+ const e = (id: string | undefined, digest: string) => (id ? { id, digest } : { digest });
+
+ it('marks a kept history by place: the earlier history first, then what was added', () => {
+ expect(keptMarks(5, 3, 5, 5, false)).toEqual(['kept', 'kept', 'kept', 'added', 'added']);
+ // a continue request holds its last messages only
+ expect(keptMarks(7, 5, 1, 1, true)).toEqual(['added']);
+ // without either length, or with lengths that do not fit, nothing is marked
+ expect(keptMarks(undefined, 3, 2, 2, false)).toBeNull();
+ expect(keptMarks(3, 4, 3, 3, false)).toBeNull();
+ expect(keptMarks(2, 1, 3, 3, true)).toBeNull();
+ // a body that holds fewer messages than its whole list, or than its manifest lists, has no places
+ expect(keptMarks(5, 3, 2, 2, false)).toBeNull();
+ expect(keptMarks(5, 3, 5, 4, false)).toBeNull();
+ expect(keptMarks(7, 5, 2, null, true)).toBeNull();
+ });
+
+ it('marks a changed history by the counts the card gives', () => {
+ const P = [e('0000000000000001', '0000000000000010'), e(undefined, '00000000000000c0'), e('0000000000000002', '0000000000000020')];
+ const N = [e(undefined, '00000000000000c0'), e('0000000000000002', '0000000000000021'), e(undefined, '00000000000000d0')];
+ expect(changedMarks(P, N)).toEqual({ marks: ['kept', 'changed', 'added'], dropped: [0] });
+ });
+
+ it('marks no message where which earlier message became which is not known', () => {
+ const a = e('000000000000000a', '0000000000000001');
+ const b = e('000000000000000a', '0000000000000002');
+ const c = e('000000000000000a', '0000000000000003');
+ // either earlier message under the id could have become the new one
+ expect(changedMarks([a, b], [c])).toBeNull();
+ expect(changedMarks([a], [b, c])).toBeNull();
+ // two messages of one digest and no id: which one was dropped is not known
+ const cont = e(undefined, '00000000000000c0');
+ expect(changedMarks([cont, e(undefined, '0000000000000005'), cont], [e(undefined, '0000000000000005'), cont])).toBeNull();
+ });
+
+ it('takes a linear walk over a long history', () => {
+ const P = Array.from({ length: 65536 }, (_, i) => e(i.toString(16).padStart(16, '0'), '0000000000000001'));
+ const N = [...P.slice(1), e('ffffffffffffffff', '0000000000000002')];
+ const started = performance.now();
+ const found = changedMarks(P, N)!;
+ expect(found.dropped).toEqual([0]);
+ expect(found.marks.filter((m) => m === 'added')).toHaveLength(1);
+ expect(performance.now() - started).toBeLessThan(1000);
+ });
+});
+
+describe('a request\'s message list, as the store reads it', () => {
+ const HEADER = '{"h":1,"schema":"sd/1","seq":1,"at":"2026-01-01T00:00:00Z","kind":"provider_body","adapter":"mock/0.2.0","dialect":"mock/1","src":".","session":"s"}';
+ const EMPTY_OBJECT = '44136fa355b3678a1146ad16f7e8649e94fb4fc21fe77e8310c060f61caaff8a';
+ const d = (n: number) => ({ digest: n.toString(16).padStart(16, '0') });
+ const line = (id: string, role: string, fields: Record<string, unknown>) =>
+ `{"ord":1,"id":"${id}","parts":[{"k":"data","data":${JSON.stringify({
+ schema: 'provider_body/1', role, sha256: EMPTY_OBJECT, bytes: 2, depth: 0, segments: [{ lit: '{}' }], history_form: 'langchain/1', ...fields,
+ })}}]}`;
+ const storeOf = (lines: string[]) => {
+ const s = new PromptStore();
+ s.addFile({ seq: 1, file: 'x.sd', bytes: new TextEncoder().encode([HEADER, ...lines, '{"t":"end"}'].join('\n') + '\n') });
+ return s;
+ };
+
+ it('builds a list against its base, and reads the scenario\'s lists as asz wrote them', () => {
+ const s = storeOf([
+ line('a', 'request', { messages: { entries: [d(1), d(2)] } }),
+ line('b', 'request', { messages: { base: 'a', keep: 2, add: [d(3)] } }),
+ ]);
+ expect(s.listOf('b')).toEqual([d(1), d(2), d(3)]);
+ const { file } = fixture('forget');
+ const forget = new PromptStore();
+ forget.addFile({ seq: 2, file: 'x.sd', bytes: file });
+ // the trimmed call's request: five messages, the history-messages its call says
+ expect(forget.listOf(forget.idAt(2, 7)!)).toHaveLength(5);
+ });
+
+ it('reads no list over a base that does not hold', () => {
+ const s = storeOf([
+ line('a', 'request', { messages: { entries: [d(1)] } }),
+ line('r', 'response', { messages: { entries: [d(1), d(2)] } }),
+ line('b', 'request', { messages: { base: 'r', keep: 2, add: [d(3)] } }),
+ line('c', 'request', { messages: { base: 'a', keep: 2, add: [d(3)] } }),
+ line('e', 'request', { messages: { base: 'c', keep: 1, add: [d(4)] } }),
+ line('f', 'request', { messages: { base: 'g', keep: 1, add: [d(4)] } }),
+ line('g', 'request', { messages: { entries: [d(1)] } }),
+ ]);
+ expect(s.listOf('b')).toBeNull(); // a response is no base
+ expect(s.listOf('c')).toBeNull(); // it keeps more than its base holds
+ expect(s.listOf('e')).toBeNull(); // nor is a list over such a list read, however little it keeps
+ expect(s.listOf('f')).toBeNull(); // a base landed after it
+ });
+
+ it('reads a list only in exactly one shape, as the Sessionizer reads it', () => {
+ const s = storeOf([
+ line('a', 'request', { messages: { entries: [d(1), d(2)] } }),
+ line('b', 'request', { messages: { entries: [d(1)], base: 'a', keep: 1, add: [] } }),
+ line('c', 'request', { messages: { entries: [d(1)], unavailable: 'too_large', count: 1 } }),
+ line('e', 'request', { messages: { base: 'a', keep: 1, add: [d(3)], unavailable: 'too_large' } }),
+ line('f', 'request', { messages: { base: 'a', keep: 1.5, add: [d(3)] } }),
+ line('g', 'request', { messages: { entries: [d(1)], base: null, keep: 9 } }),
+ line('h', 'request', { messages: { entries: [{ id: null, digest: 'ABCDEF0123456789' }, { id: '', digest: d(2).digest }] } }),
+ line('i', 'request', { messages: { entries: [{ id: 'not-a-digest', digest: d(1).digest }] } }),
+ ]);
+ for (const id of ['b', 'c', 'e', 'f', 'i']) expect(s.listOf(id), id).toBeNull();
+ // a null is no key, and a list's own keep and add beside its entries are not read
+ expect(s.listOf('g')).toEqual([d(1)]);
+ // an id that is null or empty is none, and a digest in capitals is the same digest in small letters
+ expect(s.listOf('h')).toEqual([{ digest: 'abcdef0123456789' }, d(2)]);
+ });
+
+ it('reads no list a field of another type is beside, whatever its shape', () => {
+ const s = storeOf([
+ line('a', 'request', { messages: { entries: [d(1)], keep: 1.5 } }),
+ line('b', 'request', { messages: { entries: [d(1)], add: 'not a list' } }),
+ line('c', 'request', { messages: { entries: [d(1)], count: '1' } }),
+ line('e', 'request', { messages: { entries: [d(1)], add: [5] } }),
+ line('f', 'request', { messages: { entries: [{ digest: 5 }] } }),
+ line('g', 'request', { messages: { entries: [d(1)], add: [{ digest: 'not checked beside entries' }], count: 3 } }),
+ line('j', 'request', { messages: { entries: [d(1)], count: 2 ** 63 } }),
+ ]);
+ for (const id of ['a', 'b', 'c', 'e', 'f', 'j']) expect(s.listOf(id), id).toBeNull();
+ expect(s.listOf('g')).toEqual([d(1)]);
+ });
+
+ it('matches two spellings of one digest as one message', () => {
+ const upper = (x: { digest: string }) => ({ digest: x.digest.toUpperCase() });
+ const s = storeOf([
+ line('a', 'request', { messages: { entries: [d(0xab), d(0xcd)] } }),
+ line('b', 'request', { messages: { entries: [upper(d(0xab)), upper(d(0xcd)), d(0xef)] } }),
+ ]);
+ const found = changedMarks(s.listOf('a')!, s.listOf('b')!)!;
+ expect(found).toEqual({ marks: ['kept', 'kept', 'added'], dropped: [] });
+ // an id spelled both ways is one id, so twice in a list it leaves the pairing unknown
+ const id = (n: number, digest: number) => ({ id: n.toString(16).padStart(16, '0'), digest: d(digest).digest });
+ const t = storeOf([
+ line('a', 'request', { messages: { entries: [id(0xab, 1), { ...id(0xab, 2), id: id(0xab, 2).id.toUpperCase() }] } }),
+ line('b', 'request', { messages: { entries: [id(0xab, 3)] } }),
+ ]);
+ expect(changedMarks(t.listOf('a')!, t.listOf('b')!)).toBeNull();
+ });
+});
diff --git a/packages/conversation-view/test/prompt-langchain.test.ts b/packages/conversation-view/test/prompt-langchain.test.ts
index af026602..1cfaf6d2 100644
--- a/packages/conversation-view/test/prompt-langchain.test.ts
+++ b/packages/conversation-view/test/prompt-langchain.test.ts
@@ -225,11 +225,11 @@ describe('the prompt panel on a LangChain call', () => {
expect(panel.textContent).toContain('service_health');
// nothing but messages in the body, so no empty settings section
expect(panel.textContent).not.toContain('Settings');
- // a LangChain request names no request before it, and nothing is missing
+ // these bodies landed before the Sessionizer recorded a request's history, which the tab says
+ // rather than reading one from where the messages sit
root.querySelector<HTMLButtonElement>('[data-prompt-whole="0"]')!.click();
const changes = root.querySelector<HTMLElement>('.acv-inspector-body')!.textContent;
- expect(changes).toContain('names no request before it');
- expect(changes).not.toContain('not among the loaded bodies');
+ expect(changes).toContain('does not record its history');
});
it("puts the copy button of a message that is one text on the message's head", async () => {
diff --git a/packages/conversation-view/test/prompt-panel.test.ts b/packages/conversation-view/test/prompt-panel.test.ts
index 36ebc870..3f698e1a 100644
--- a/packages/conversation-view/test/prompt-panel.test.ts
+++ b/packages/conversation-view/test/prompt-panel.test.ts
@@ -95,75 +95,24 @@ describe('the prompt panel', () => {
expect(after.textContent).toContain('read the configuration');
});
- it('shows what the call added, against the request before it', async () => {
- const root = mount();
- tab(root, 'prompt')!.click();
- panel(root).querySelector<HTMLButtonElement>('[data-load-prompt]')!.click();
- await new Promise((r) => setTimeout(r, 0));
- panel(root).querySelector<HTMLButtonElement>('[data-prompt-whole="0"]')!.click();
- const body = panel(root);
- expect(body.textContent).toContain('Added by this call');
- // the shared history is named, not repeated
- expect(body.textContent).toMatch(/message\(s\) before are as the call before sent them/);
- });
-
- it('says a first request names none before it, rather than that one is not loaded', async () => {
- // The main stream's first call: its request names no request before it, so nothing is missing.
- const root = mount(undefined, 'call/s2-call-fdae022ac306');
- tab(root, 'prompt')!.click();
- panel(root).querySelector<HTMLButtonElement>('[data-load-prompt]')!.click();
- await new Promise((r) => setTimeout(r, 0));
- panel(root).querySelector<HTMLButtonElement>('[data-prompt-whole="0"]')!.click();
- const body = panel(root);
- expect(body.textContent).toContain('names no request before it');
- expect(body.textContent).not.toContain('not among the loaded bodies');
- });
-
- it('says the request before is not loaded when it names one the tab cannot find', async () => {
- // The second call names the first call's request, but here the document lists no bodies for the
- // first call, so the one it names is nowhere the tab can read it.
- const withoutFirst = JSON.parse(JSON.stringify(doc)) as AszViewDocument;
- const strip = (nodes: AszViewDocument['talks']): void => {
- for (const n of nodes) {
- if (n.id === 'call/s2-call-fdae022ac306') delete (n as { provider_bodies?: unknown }).provider_bodies;
- strip(n.children ?? []);
- }
- };
- strip(withoutFirst.talks);
- host = document.createElement('div');
- document.body.appendChild(host);
- view = mountConversationView(host, {
- document: withoutFirst,
- loadFiles: async (request: { session: string; seqs: number[] }, onFile: (f: StoredFile) => void) => {
- for (const seq of request.seqs) onFile({ seq, file: `${request.session}/provider_body/x.sd`, bytes: file });
- },
- state: { step: CALL },
- });
- tab(host, 'prompt')!.click();
- panel(host).querySelector<HTMLButtonElement>('[data-load-prompt]')!.click();
- await new Promise((r) => setTimeout(r, 0));
- panel(host).querySelector<HTMLButtonElement>('[data-prompt-whole="0"]')!.click();
- const body = panel(host);
- expect(body.textContent).toContain('not among the loaded bodies');
- expect(body.textContent).not.toContain('names no request before it');
- });
-
- it('calls a growing history growth, however the runtime spells a message', () => {
- // This call is the first whose history holds a message that has stopped being the newest. Such a
- // message is sent as a list of one text block while it is newest and as a plain string after,
- // and reading the two spellings as different messages ended the shared prefix one message early
- // and reported an ordinary growth step as a rewritten history.
- const root = mount(undefined, 'call/s6-call-fdae022ac306');
- tab(root, 'prompt')!.click();
- panel(root).querySelector<HTMLButtonElement>('[data-load-prompt]')!.click();
- return new Promise<void>((done) => setTimeout(() => {
+ it('says a request landed before its history was recorded has nothing to compare, and guesses nothing', async () => {
+ // These bodies landed before the Sessionizer recorded a request's history, so the document says
+ // nothing of it, and the tab does not read one from where messages sit in the two bodies.
+ for (const call of [CALL, 'call/s2-call-fdae022ac306', 'call/s6-call-fdae022ac306']) {
+ const root = mount(undefined, call);
+ tab(root, 'prompt')!.click();
+ panel(root).querySelector<HTMLButtonElement>('[data-load-prompt]')!.click();
+ await new Promise((r) => setTimeout(r, 0));
panel(root).querySelector<HTMLButtonElement>('[data-prompt-whole="0"]')!.click();
const body = panel(root);
- expect(body.textContent).toContain('Added by this call');
- expect(body.textContent).not.toContain('was rewritten');
+ expect(body.textContent).toContain('does not record its history');
+ expect(body.textContent).not.toContain('rewritten');
expect(body.textContent).not.toContain('replaced by a summary');
- done();
- }, 0));
+ view?.destroy();
+ view = null;
+ host?.remove();
+ host = null;
+ }
});
it('shows the response on its own, with what stopped it', async () => {
diff --git a/packages/conversation-view/test/prompt-store.test.ts b/packages/conversation-view/test/prompt-store.test.ts
index 52041027..7b5d9e36 100644
--- a/packages/conversation-view/test/prompt-store.test.ts
+++ b/packages/conversation-view/test/prompt-store.test.ts
@@ -80,7 +80,8 @@ describe('the provider body reader', () => {
const response = s.manifestAt(SEQ, 2)!;
expect(response.role).toBe('response');
expect(response.call).toBeTruthy();
- expect(s.responseOfRequestId(response.request!)?.manifest.call).toBe(response.call);
+ expect(response.request).toBeTruthy();
+ expect(s.idAt(SEQ, 2)).toBe(readProviderFile(SEQ, file)[1]!.id);
});
it('says what it cannot rebuild, and holds nothing a reference cannot answer', () => {