@theoremjs/react 0.3.5-next.927.g1f89ea0 → 0.3.5-next.930.gfb5cd40

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 CHANGED
@@ -381,7 +381,7 @@ const call = useLiveCall({ iface, connection: () => ({ profile: 'support.voice'
381
381
 
382
382
  This code opens `wss://<your host>/api/live/relay?profile=<id>`. To send your own message to the relay, add `openMessage`. To use your own socket, add `createSocket`.
383
383
 
384
- `LiveRunner` also accepts `theme`, `mode`, `labels`, and `trace`. Tool gates in a call appear in a dialog over the call.
384
+ `LiveRunner` also accepts `theme`, `mode`, `labels`, `media`, `resolveMedia`, and `trace`. Its captions show the media a tool returns as the chat does: see [Tool media](#tool-media). Tool gates in a call appear in a dialog over the call.
385
385
 
386
386
  ### A call across pages
387
387
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theoremjs/react",
3
- "version": "0.3.5-next.927.g1f89ea0",
3
+ "version": "0.3.5-next.930.gfb5cd40",
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.927.g1f89ea0",
64
- "@theoremjs/web": "^0.3.5-next.927.g1f89ea0"
63
+ "@theoremjs/agents": "^0.3.5-next.930.gfb5cd40",
64
+ "@theoremjs/web": "^0.3.5-next.930.gfb5cd40"
65
65
  },
66
66
  "peerDependenciesMeta": {
67
67
  "@astryxdesign/core": {
@@ -575,15 +575,19 @@ function useTurnElapsed(streaming, startedAt, workedMs) {
575
575
  /**
576
576
  * The turn's work status; with a trace, a Collapsible over its thinking and
577
577
  * tool calls, open while the turn runs so they can be followed, folded away
578
- * when it ends.
578
+ * when it ends. invariant: a run's end folds only what the run opened; a trace
579
+ * the person opened before a wake continued the turn stays open.
579
580
  */
580
581
  function TurnStatus(props) {
581
582
  const { status, streaming } = props;
582
583
  const [traceOpen, setTraceOpen] = useState(streaming);
583
584
  const [wasStreaming, setWasStreaming] = useState(streaming);
585
+ const [openBefore, setOpenBefore] = useState(false);
584
586
  if (wasStreaming !== streaming) {
585
587
  setWasStreaming(streaming);
586
- setTraceOpen(streaming);
588
+ if (streaming)
589
+ setOpenBefore(traceOpen);
590
+ setTraceOpen(streaming || (traceOpen && openBefore));
587
591
  }
588
592
  if (!status)
589
593
  return null;
@@ -1,7 +1,9 @@
1
1
  import type { DefinedTheme } from '@astryxdesign/core/theme';
2
2
  import type { LiveCall } from '../components/live/use-live-call.ts';
3
3
  import { type TheoremLabels } from './labels.ts';
4
- export type LiveRunnerProps = {
4
+ import { type TheoremChatProps } from './TheoremChat.tsx';
5
+ /** `media` and `resolveMedia` are the chat's: the captions show a tool's media as the chat does. */
6
+ export type LiveRunnerProps = Pick<TheoremChatProps, 'media' | 'resolveMedia'> & {
5
7
  /** The call to draw, from `useLiveCall`. The call outlives the runner: it ends when its owner unmounts. */
6
8
  call: LiveCall;
7
9
  /** Astryx theme, as on `TheoremChat`. Omit to inherit the host's `<Theme>` or use `theoremTheme`. */
@@ -30,4 +32,4 @@ export type LiveRunnerProps = {
30
32
  * in a toolbar, and tool gates in a dialog. Offers the trace inspector when
31
33
  * the profile records traces.
32
34
  */
33
- export declare function LiveRunner({ theme, mode, labels, ...props }: LiveRunnerProps): import("react").JSX.Element;
35
+ export declare function LiveRunner({ theme, mode, labels, media, resolveMedia, ...props }: LiveRunnerProps): import("react").JSX.Element;
package/ui/LiveRunner.js CHANGED
@@ -18,11 +18,11 @@ import { LiveCaptionsPanel } from "./LiveCaptionsPanel.js";
18
18
  import { LiveToolGateDialog } from "./LiveToolGateDialog.js";
19
19
  import { LiveVideoPreview } from "./LiveVideoPreview.js";
20
20
  import { liveStateLabel } from "./labels.js";
21
- import { TheoremLabelsProvider, useLabels } from "./labels-provider.js";
21
+ import { useLabels } from "./labels-provider.js";
22
22
  import { PANEL_EDGE, SidePanel, SidePanelHeader, SidePanelToggle, useSidePanel, } from "./SidePanel.js";
23
+ import { SurfaceProviders } from "./surface-providers.js";
23
24
  import { DEFAULT_CHAT_MAX_WIDTH } from "./TheoremChat.js";
24
25
  import { useTraceInspector, WithTrace } from "./TraceInspectorPanel.js";
25
- import { TheoremThemeProvider } from "./theme.js";
26
26
  /** The waveform's box: it rests on the stage floor rather than filling the stage. */
27
27
  const WAVE_MAX_WIDTH = 720;
28
28
  const WAVE_HEIGHT = 320;
@@ -33,8 +33,8 @@ const WAVE_HEIGHT = 320;
33
33
  * in a toolbar, and tool gates in a dialog. Offers the trace inspector when
34
34
  * the profile records traces.
35
35
  */
36
- export function LiveRunner({ theme, mode, labels, ...props }) {
37
- return (_jsx(TheoremThemeProvider, { theme: theme, mode: mode, children: _jsx(TheoremLabelsProvider, { labels: labels, children: _jsx(LiveRunnerBody, { ...props }) }) }));
36
+ export function LiveRunner({ theme, mode, labels, media, resolveMedia, ...props }) {
37
+ return (_jsx(SurfaceProviders, { theme: theme, mode: mode, labels: labels, detectCodeLanguage: undefined, media: media, resolveMedia: resolveMedia, children: _jsx(LiveRunnerBody, { ...props }) }));
38
38
  }
39
39
  function LiveRunnerBody({ call, trace, onMinimize, }) {
40
40
  const t = useLabels();