@theoremjs/react 0.3.5-next.1046.g08fd205 → 0.3.5-next.1047.gb68ee87
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/README.md +4 -1
- package/package.json +3 -3
- package/ui/ChatTranscript.js +2 -1
- package/ui/index.d.ts +1 -1
- package/ui/reply-slot.d.ts +16 -0
package/README.md
CHANGED
|
@@ -866,16 +866,19 @@ These rules apply:
|
|
|
866
866
|
|
|
867
867
|
### Draw the name, the calls, and the words yourself
|
|
868
868
|
|
|
869
|
-
|
|
869
|
+
Four more `slots` stand in for parts the transcript draws. Use them to change how a part looks or moves. Each one you leave out keeps the transcript's own.
|
|
870
870
|
|
|
871
871
|
| Slot | Stands in for | Receives |
|
|
872
872
|
| --- | --- | --- |
|
|
873
873
|
| `name` | A reply's name, where the name shows (`nameAppears`). | `{ handle, streaming }` |
|
|
874
874
|
| `toolCalls` | Each list of tool calls: in a reply, in its trace, and in an agent call's detail. | `{ list, streaming }`. `list` is what the transcript gives Astryx's `ChatToolCalls`. |
|
|
875
875
|
| `markdown` | The Markdown of a reply's words and thoughts. | What the transcript gives Astryx's `Markdown`, its `children` and `isStreaming` among them. |
|
|
876
|
+
| `status` | The words of a reply's work status ("Working for 12s", then "Worked for 22s"). With a trace, they are the trigger that opens it. | `{ words, streaming }`. Its type is `ChatTurnStatus`. |
|
|
876
877
|
|
|
877
878
|
`streaming` is `true` while the reply is on its way. A call's `key` is its operation id, or its call id. It stays the same from the live reply to the saved one.
|
|
878
879
|
|
|
880
|
+
What `status` returns stays mounted from "Working" to "Worked", so you can animate the change. It mounts again in two cases: the reply gets its first thought or call while it runs, so its words move into the trace's trigger; or the reply has no status to show, as when it ends with no time and no trace.
|
|
881
|
+
|
|
879
882
|
```tsx
|
|
880
883
|
<ChatTranscript
|
|
881
884
|
blocks={blocks}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theoremjs/react",
|
|
3
|
-
"version": "0.3.5-next.
|
|
3
|
+
"version": "0.3.5-next.1047.gb68ee87",
|
|
4
4
|
"description": "React bindings for Theorem: headless hooks + transport, an Astryx chat UI, and a Web-standard server handler.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -60,8 +60,8 @@
|
|
|
60
60
|
"@stylexjs/stylex": "0.19.0",
|
|
61
61
|
"react": "^19.0.0",
|
|
62
62
|
"react-dom": "^19.0.0",
|
|
63
|
-
"@theoremjs/agents": "^0.3.5-next.
|
|
64
|
-
"@theoremjs/web": "^0.3.5-next.
|
|
63
|
+
"@theoremjs/agents": "^0.3.5-next.1047.gb68ee87",
|
|
64
|
+
"@theoremjs/web": "^0.3.5-next.1047.gb68ee87"
|
|
65
65
|
},
|
|
66
66
|
"peerDependenciesMeta": {
|
|
67
67
|
"@astryxdesign/core": {
|
package/ui/ChatTranscript.js
CHANGED
|
@@ -680,6 +680,7 @@ function useTurnElapsed(streaming, startedAt, workedMs) {
|
|
|
680
680
|
*/
|
|
681
681
|
function TurnStatus(props) {
|
|
682
682
|
const { status, streaming } = props;
|
|
683
|
+
const drawStatus = useContext(AppSlots).status;
|
|
683
684
|
const [traceOpen, setTraceOpen] = useState(streaming);
|
|
684
685
|
const [wasStreaming, setWasStreaming] = useState(streaming);
|
|
685
686
|
const [openBefore, setOpenBefore] = useState(false);
|
|
@@ -691,7 +692,7 @@ function TurnStatus(props) {
|
|
|
691
692
|
}
|
|
692
693
|
if (!status)
|
|
693
694
|
return null;
|
|
694
|
-
const label = (_jsx(Text, { size: "sm", color: "secondary", children: status }));
|
|
695
|
+
const label = drawStatus ? (drawStatus({ words: status, streaming })) : (_jsx(Text, { size: "sm", color: "secondary", children: status }));
|
|
695
696
|
if (!props.hasTrace)
|
|
696
697
|
return label;
|
|
697
698
|
return (_jsx(Collapsible, { trigger: label, isOpen: traceOpen, onOpenChange: setTraceOpen, children: _jsx(TraceList, { items: props.trace, streaming: streaming }) }));
|
package/ui/index.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export { AstryxMediaViewer, type MediaViewer, type MediaViewerItem, type MediaVi
|
|
|
31
31
|
export { PaneFailure, PaneLoading, PaneState } from './PaneState.js';
|
|
32
32
|
export { RadialBars, Sunburst, type SunburstNode } from './RadialCharts.js';
|
|
33
33
|
export { type RankedBar, RankedBars } from './RankedBars.js';
|
|
34
|
-
export type { ChatDetailsSlot, ChatMarkdownSlot, ChatMessageDetails, ChatNameSlot, ChatReply, ChatReplyName, ChatReplySlot, ChatToolCallList, ChatToolCallsSlot, ChatTranscriptSlots, } from './reply-slot.js';
|
|
34
|
+
export type { ChatDetailsSlot, ChatMarkdownSlot, ChatMessageDetails, ChatNameSlot, ChatReply, ChatReplyName, ChatReplySlot, ChatStatusSlot, ChatToolCallList, ChatToolCallsSlot, ChatTranscriptSlots, ChatTurnStatus, } from './reply-slot.js';
|
|
35
35
|
export { InPlace, PaneLayout, PanePanel, Prose, RaisedPane } from './SidePanel.js';
|
|
36
36
|
export { DEFAULT_CHAT_MAX_WIDTH, TheoremChat, TheoremChatComposer, type TheoremChatComposerProps, type TheoremChatHandle, type TheoremChatProps, TheoremChatTranscript, type TheoremChatTranscriptOptions, type TheoremChatTranscriptProps, } from './TheoremChat.js';
|
|
37
37
|
export { TheoremDecision, type TheoremDecisionProps } from './TheoremDecision.js';
|
package/ui/reply-slot.d.ts
CHANGED
|
@@ -58,6 +58,18 @@ export type ChatToolCallsSlot = (calls: ChatToolCallList) => ReactNode;
|
|
|
58
58
|
* `Markdown`. Unset draws Astryx's `Markdown`.
|
|
59
59
|
*/
|
|
60
60
|
export type ChatMarkdownSlot = (markdown: MarkdownProps<readonly MarkdownPluginEntry[]>) => ReactNode;
|
|
61
|
+
/** A reply's work status as the transcript's `status` slot is given it. */
|
|
62
|
+
export type ChatTurnStatus = {
|
|
63
|
+
/** The status's words: "Working for 12s" while the reply is on its way, then "Worked for 22s" or "Worked". */
|
|
64
|
+
words: string;
|
|
65
|
+
/** `true` while the reply is on its way. */
|
|
66
|
+
streaming: boolean;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Draws the words of a reply's work status. Unset draws them as Astryx's `Text`. What it returns
|
|
70
|
+
* stays mounted from "Working" to "Worked", so it can animate the change.
|
|
71
|
+
*/
|
|
72
|
+
export type ChatStatusSlot = (status: ChatTurnStatus) => ReactNode;
|
|
61
73
|
/** What the app draws in the transcript's slots. */
|
|
62
74
|
export type ChatTranscriptSlots<Host extends JsonObject = JsonObject> = {
|
|
63
75
|
/** Under each reply, inside its message. */
|
|
@@ -73,4 +85,8 @@ export type ChatTranscriptSlots<Host extends JsonObject = JsonObject> = {
|
|
|
73
85
|
toolCalls?: ChatToolCallsSlot;
|
|
74
86
|
/** In place of the Markdown of a reply's words and thoughts. */
|
|
75
87
|
markdown?: ChatMarkdownSlot;
|
|
88
|
+
/**
|
|
89
|
+
* In place of the words of a reply's work status. With a trace, they are the trigger that opens it.
|
|
90
|
+
*/
|
|
91
|
+
status?: ChatStatusSlot;
|
|
76
92
|
};
|