Skip to content
Source
Sign inSign up
TanStack/ai

feat(ai-harness): show tool result metadata in the session view #2259

OpenHugoPerard(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/2259/headopened View on GitHub

Showing 10 changed files with 10 additions and 1 deletion (loading 6).

x
0 of 10 viewed, 10 left
5 additions and 0 deletions.changeset/harness-view-result-metadata.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/ai-harness': minor
+---
+​
+The session view now shows tool result metadata. A `tool-call` part from `createSessionView` has `resultMetadata` when the server tool called `setResultMetadata`, live and after a reload. The value has only the app keys, as `part.resultMetadata` in `useChat`.
1 addition and 1 deletiondocs/harness/custom-ui.mdModified
View file
@@ -153,7 +153,7 @@
An assistant message has `parts`. Each part is one of these:
​
- `text` or `reasoning`: the text, which grows while it streams.
-- `tool-call`: a tool call with its `name`, `args`, and `status` (`running`, `done`, `failed`, or `needs-approval`).
+- `tool-call`: a tool call with its `name`, `args`, and `status` (`running`, `done`, `failed`, or `needs-approval`). It also has `resultMetadata` when the server tool set [result metadata](../tools/tool-result-metadata), also after a reload.
- `agent`: a child agent, with its own `parts`, its `status`, and its `result` when it gives one. See [Show subagents](#show-subagents).
- `media`: a file that an agent made. See [Show media](#show-media).
​
4 additions and 0 deletionsdocs/tools/tool-result-metadata.mdModified
View file
@@ -406,6 +406,10 @@
​
The `tool-result` part of the same call has the raw value in `part.metadata`. It has the app keys and the reserved `tanstack` key. Use `part.resultMetadata` on the `tool-call` part for your UI, because it has only the app keys and it is typed.
​
+### Harness session view
+​
+In a [harness session view](../harness/custom-ui#2-show-the-state), a `tool-call` part has `resultMetadata`, also after a reload. It is not typed. The view also removes the `harness` key, because the harness keeps its own data there. Do not use `harness` as an app key.
+​
### MCP and middleware