@theoremjs/web 0.3.5-next.1007.g0511d99 → 0.3.5-next.1008.gb45d164

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theoremjs/web",
3
- "version": "0.3.5-next.1007.g0511d99",
3
+ "version": "0.3.5-next.1008.gb45d164",
4
4
  "description": "Theorem on the web platform, with no UI framework: Web-standard server handlers that serve a profile, and the browser client that talks to them.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -25,6 +25,6 @@
25
25
  },
26
26
  "peerDependencies": {
27
27
  "zod": "^4.6.5",
28
- "@theoremjs/agents": "^0.3.5-next.1007.g0511d99"
28
+ "@theoremjs/agents": "^0.3.5-next.1008.gb45d164"
29
29
  }
30
30
  }
@@ -118,11 +118,26 @@ export async function startConversation(host, profile, blocks) {
118
118
  function foldedFor(host, events) {
119
119
  return foldTurnEvents(events.map((event) => host.forReader(event)), { showThoughts: host.showThoughts });
120
120
  }
121
+ /**
122
+ * A saved block as the host's reader reads it. A failed call saved without its failure in the
123
+ * profile's wording (saved before the chat worded every end it saves) gets that wording here.
124
+ */
125
+ function readerBlock(host, block) {
126
+ if (block.kind !== 'tool')
127
+ return block;
128
+ const { state } = block.tool;
129
+ if (state?.phase !== 'error' || state.failure.error !== undefined)
130
+ return block;
131
+ const event = host.forReader({ type: 'tool', tool: state });
132
+ return event.type === 'tool' && event.tool.phase === 'error'
133
+ ? { ...block, tool: { ...block.tool, state: event.tool } }
134
+ : block;
135
+ }
121
136
  /** The conversation as the browser draws it. */
122
137
  export function conversationView(host, conversation) {
123
138
  const { paused } = conversation;
124
139
  return {
125
- transcript: conversation.transcript,
140
+ transcript: conversation.transcript.map((block) => readerBlock(host, block)),
126
141
  ...(paused
127
142
  ? {
128
143
  paused: {