@theoremjs/react 0.3.4 → 0.3.5-next.1001.g68d8dcf
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 +136 -6
- package/client/live/use-live-caption-log.d.ts +1 -1
- package/client/trace-story.d.ts +1 -1
- package/client/transcript-groups.d.ts +27 -4
- package/client/transcript-groups.js +45 -7
- package/components/InkWaveform.d.ts +1 -1
- package/components/live/use-live-call.d.ts +3 -3
- package/components/live/use-live-runner-controls.d.ts +2 -2
- package/components/live/use-live-runner-ui.d.ts +3 -3
- package/components/live/use-live-session-client.d.ts +2 -2
- package/components/use-composer-voice.d.ts +1 -1
- package/components/use-voice-playback.d.ts +1 -1
- package/hooks/use-embedding-index.d.ts +1 -1
- package/hooks/use-theorem-chat.d.ts +45 -44
- package/hooks/use-theorem-chat.js +10 -1
- package/hooks/use-theorem-decision.d.ts +1 -1
- package/hooks/use-theorem-embedding.d.ts +1 -1
- package/hooks/use-theorem-host.d.ts +1 -1
- package/hooks/use-turn-clock.d.ts +19 -0
- package/hooks/use-turn-clock.js +71 -0
- package/index.d.ts +8 -6
- package/index.js +1 -0
- package/live.d.ts +4 -4
- package/package.json +5 -5
- package/ui/ChatComposerBar.d.ts +19 -0
- package/ui/ChatComposerBar.js +141 -50
- package/ui/ChatComposerRow.d.ts +66 -0
- package/ui/ChatComposerRow.js +196 -0
- package/ui/ChatTranscript.d.ts +31 -2
- package/ui/ChatTranscript.js +165 -90
- package/ui/ConsoleFrame.d.ts +2 -2
- package/ui/DecisionAnswers.d.ts +1 -1
- package/ui/DecisionAnswers.js +9 -6
- package/ui/DecisionImages.d.ts +4 -3
- package/ui/EmbeddingDocuments.d.ts +2 -2
- package/ui/EmbeddingQuery.d.ts +2 -2
- package/ui/EmbeddingResults.d.ts +3 -3
- package/ui/LiveCallTile.d.ts +2 -2
- package/ui/LiveCaptionsPanel.d.ts +1 -1
- package/ui/LiveRunner.d.ts +6 -4
- package/ui/LiveRunner.js +4 -4
- package/ui/LiveToolGateDialog.d.ts +1 -1
- package/ui/LiveVideoPreview.d.ts +1 -1
- package/ui/RadialCharts.d.ts +2 -2
- package/ui/RankedBars.d.ts +1 -1
- package/ui/SchemaFields.d.ts +1 -1
- package/ui/SchemaFields.js +56 -3
- package/ui/ShapedData.js +4 -4
- package/ui/StateFields.d.ts +1 -1
- package/ui/StateFields.js +3 -3
- package/ui/TheoremChat.d.ts +74 -4
- package/ui/TheoremChat.js +53 -33
- package/ui/TheoremDecision.d.ts +3 -3
- package/ui/TheoremEmbedding.d.ts +2 -2
- package/ui/TheoremHost.d.ts +16 -2
- package/ui/TheoremHost.js +6 -6
- package/ui/TheoremSurface.d.ts +22 -0
- package/ui/TheoremSurface.js +13 -0
- package/ui/ToolResult.js +8 -6
- package/ui/TraceCharts.d.ts +2 -2
- package/ui/TraceGuardrails.d.ts +2 -2
- package/ui/TraceInspectorPanel.d.ts +1 -1
- package/ui/TraceOverview.d.ts +2 -2
- package/ui/TraceSpanDetail.d.ts +1 -1
- package/ui/TraceStory.d.ts +2 -2
- package/ui/TraceValues.d.ts +2 -2
- package/ui/TraceWaterfall.d.ts +1 -1
- package/ui/approval-heading.d.ts +1 -1
- package/ui/built/theme.css +91 -41
- package/ui/built/theme.css.d.ts +2 -2
- package/ui/built/theorem.d.ts +2 -2
- package/ui/built/theorem.js +41 -19
- package/ui/built/theorem.variants.d.ts +2 -2
- package/ui/embedding-space-view.d.ts +1 -1
- package/ui/index.d.ts +33 -28
- package/ui/index.js +4 -1
- package/ui/labels-provider.d.ts +1 -1
- package/ui/labels.d.ts +70 -2
- package/ui/labels.js +68 -0
- package/ui/media-viewer.d.ts +34 -0
- package/ui/media-viewer.js +27 -0
- package/ui/tool-media-shown.d.ts +13 -0
- package/ui/tool-media-shown.js +15 -0
- package/ui/tool-media.d.ts +34 -0
- package/ui/tool-media.js +52 -0
- package/ui/trace-patterns.d.ts +1 -1
- package/ui/transcript-copy-text.d.ts +1 -1
- package/ui/transcript-copy-text.js +1 -1
package/ui/ChatTranscript.js
CHANGED
|
@@ -9,7 +9,6 @@ import { HStack } from '@astryxdesign/core/HStack';
|
|
|
9
9
|
import { Icon } from '@astryxdesign/core/Icon';
|
|
10
10
|
import { IconButton } from '@astryxdesign/core/IconButton';
|
|
11
11
|
import { useLocale } from '@astryxdesign/core/i18n';
|
|
12
|
-
import { useLightbox } from '@astryxdesign/core/Lightbox';
|
|
13
12
|
import { Markdown } from '@astryxdesign/core/Markdown';
|
|
14
13
|
import { OverflowList } from '@astryxdesign/core/OverflowList';
|
|
15
14
|
import { Skeleton } from '@astryxdesign/core/Skeleton';
|
|
@@ -23,54 +22,36 @@ import { IconCheck, IconCopy } from '@tabler/icons-react';
|
|
|
23
22
|
import { stopText } from '@theoremjs/agents/interface';
|
|
24
23
|
import { citationsFromBlock } from '@theoremjs/web/client';
|
|
25
24
|
import { createContext, useContext, useEffect, useMemo, useRef, useState, } from 'react';
|
|
26
|
-
import { assistantTurnCopyText, assistantTurnTiming, composeAssistantTurn, groupTranscriptBlocks, pendingPromptOf, promptReplyKey, promptTime,
|
|
25
|
+
import { assistantTurnCopyText, assistantTurnTiming, composeAssistantTurn, groupTranscriptBlocks, pendingPromptOf, promptReplyKey, promptTime, toolCallLabel, workStatus, } from "../client/transcript-groups.js";
|
|
27
26
|
import { useSecondTicker } from "../hooks/use-second-ticker.js";
|
|
27
|
+
import { useTurnClock } from "../hooks/use-turn-clock.js";
|
|
28
28
|
import { useDisclosureMotion } from "./disclosure-motion.js";
|
|
29
29
|
import { usageLine, workDuration, workStatusLabel } from "./labels.js";
|
|
30
30
|
import { TheoremLabelsProvider, useLabels } from "./labels-provider.js";
|
|
31
31
|
import { useMarkdownPlugins } from "./markdown-plugins.js";
|
|
32
|
+
import { useMediaViewer } from "./media-viewer.js";
|
|
32
33
|
import { keyedByContent } from "./row-keys.js";
|
|
33
34
|
import { ShapedData } from "./ShapedData.js";
|
|
34
35
|
import { ApprovalCard, AuthChallengeCard } from "./ToolGateCard.js";
|
|
36
|
+
import { MediaFileToken, toolMediaShows, useResolvedMedia, useToolMedia, } from "./tool-media.js";
|
|
35
37
|
import { transcriptBlockCopyText } from "./transcript-copy-text.js";
|
|
36
38
|
import { VoiceNote } from "./VoiceNote.js";
|
|
37
39
|
/** Whether the transcript shows usage (`ChatTranscriptProps.usage`). */
|
|
38
40
|
const ShowUsage = createContext(false);
|
|
41
|
+
/** Whether a tool call's row opens on its detail (`ChatTranscriptProps.showToolData`). */
|
|
42
|
+
const ShowToolData = createContext(true);
|
|
43
|
+
/** Whether a finished tool call's row shows how long it ran (`ChatTranscriptProps.showToolDurations`). */
|
|
44
|
+
const ShowToolDurations = createContext(true);
|
|
45
|
+
/** What the transcript's props say a tool call's row shows. */
|
|
46
|
+
function useToolRowShows() {
|
|
47
|
+
return {
|
|
48
|
+
usage: useContext(ShowUsage),
|
|
49
|
+
detail: useContext(ShowToolData),
|
|
50
|
+
duration: useContext(ShowToolDurations),
|
|
51
|
+
};
|
|
52
|
+
}
|
|
39
53
|
/** Largest a generated image renders in the transcript. */
|
|
40
54
|
const GENERATED_IMAGE_MAX_WIDTH = 512;
|
|
41
|
-
/** First-seen time per group key, so timestamps don't jump while streaming. */
|
|
42
|
-
function useFirstSeen(keys) {
|
|
43
|
-
const times = useRef(new Map());
|
|
44
|
-
const now = Date.now();
|
|
45
|
-
for (const key of keys) {
|
|
46
|
-
if (!times.current.has(key))
|
|
47
|
-
times.current.set(key, now);
|
|
48
|
-
}
|
|
49
|
-
return (key) => times.current.get(key) ?? now;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Each turn's span, keyed by the user group that started it. A turn stops at
|
|
53
|
-
* a gate and streams again under the same prompt once it's answered; the wait
|
|
54
|
-
* in between counts as paused, not worked.
|
|
55
|
-
*/
|
|
56
|
-
function useTurnSpans(streaming, lastUserKey) {
|
|
57
|
-
const spans = useRef(new Map());
|
|
58
|
-
// why: The first send mounts the transcript already streaming; that's the start.
|
|
59
|
-
const wasStreaming = useRef(false);
|
|
60
|
-
if (lastUserKey && streaming !== wasStreaming.current) {
|
|
61
|
-
const now = Date.now();
|
|
62
|
-
const span = spans.current.get(lastUserKey);
|
|
63
|
-
if (streaming) {
|
|
64
|
-
const pausedMs = span?.endedAt === undefined ? 0 : span.pausedMs + now - span.endedAt;
|
|
65
|
-
spans.current.set(lastUserKey, { pausedMs });
|
|
66
|
-
}
|
|
67
|
-
else if (span) {
|
|
68
|
-
spans.current.set(lastUserKey, { ...span, endedAt: now });
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
wasStreaming.current = streaming;
|
|
72
|
-
return spans.current;
|
|
73
|
-
}
|
|
74
55
|
function CopyButton({ text }) {
|
|
75
56
|
const t = useLabels();
|
|
76
57
|
const [copied, setCopied] = useState(false);
|
|
@@ -211,9 +192,11 @@ function turnNotice(error, stopped) {
|
|
|
211
192
|
function dataUrl(mimeType, data) {
|
|
212
193
|
return data === undefined ? undefined : `data:${mimeType};base64,${data}`;
|
|
213
194
|
}
|
|
214
|
-
function ImageAttachment({ src, name }) {
|
|
215
|
-
const
|
|
216
|
-
|
|
195
|
+
function ImageAttachment({ src, name, reference, }) {
|
|
196
|
+
const viewer = useMediaViewer([
|
|
197
|
+
{ type: 'image', src, alt: name, caption: name, ...(reference ? { reference } : {}) },
|
|
198
|
+
]);
|
|
199
|
+
return (_jsxs(_Fragment, { children: [_jsx(Thumbnail, { src: src, alt: name, label: name, onClick: () => viewer.open() }), viewer.element] }));
|
|
217
200
|
}
|
|
218
201
|
function UserBlock({ block, metadata }) {
|
|
219
202
|
if (block.kind === 'user-text')
|
|
@@ -224,9 +207,24 @@ function UserBlock({ block, metadata }) {
|
|
|
224
207
|
}
|
|
225
208
|
/** An attached image or voice note inline; any other file as a Token. */
|
|
226
209
|
function UserFile({ block }) {
|
|
227
|
-
|
|
210
|
+
if (block.uri !== undefined)
|
|
211
|
+
return _jsx(SavedUserFile, { block: block, uri: block.uri });
|
|
212
|
+
return _jsx(UserFileView, { block: block, src: dataUrl(block.mimeType, block.data) });
|
|
213
|
+
}
|
|
214
|
+
/** A file the app saved, as its resolver shows it; the named file while it resolves, or when nothing does. */
|
|
215
|
+
function SavedUserFile({ block, uri }) {
|
|
216
|
+
const reference = {
|
|
217
|
+
type: block.type ?? (block.kind === 'user-voice' ? 'audio' : 'document'),
|
|
218
|
+
mimeType: block.mimeType,
|
|
219
|
+
uri,
|
|
220
|
+
...(block.metadata ? { metadata: block.metadata } : {}),
|
|
221
|
+
};
|
|
222
|
+
const src = useResolvedMedia(reference);
|
|
223
|
+
return _jsx(UserFileView, { block: block, src: src ?? undefined, reference: reference });
|
|
224
|
+
}
|
|
225
|
+
function UserFileView({ block, src, reference, }) {
|
|
228
226
|
if (src && block.mimeType.startsWith('image/')) {
|
|
229
|
-
return _jsx(ImageAttachment, { src: src, name: block.name });
|
|
227
|
+
return _jsx(ImageAttachment, { src: src, name: block.name, ...(reference ? { reference } : {}) });
|
|
230
228
|
}
|
|
231
229
|
if (src && block.mimeType.startsWith('audio/')) {
|
|
232
230
|
return _jsx(VoiceNote, { src: src, mimeType: block.mimeType });
|
|
@@ -234,9 +232,9 @@ function UserFile({ block }) {
|
|
|
234
232
|
return _jsx(Token, { label: block.name, description: block.mimeType });
|
|
235
233
|
}
|
|
236
234
|
function mediaSrc(block) {
|
|
237
|
-
return
|
|
235
|
+
return dataUrl(block.mimeType, block.data);
|
|
238
236
|
}
|
|
239
|
-
function
|
|
237
|
+
function viewerItem(t, src, mimeType) {
|
|
240
238
|
if (mimeType.startsWith('image/'))
|
|
241
239
|
return { src, alt: t('@theorem.transcript.generated_image'), type: 'image' };
|
|
242
240
|
if (mimeType.startsWith('video/'))
|
|
@@ -248,22 +246,22 @@ function galleryItemOf(t, block) {
|
|
|
248
246
|
if (block.kind !== 'media')
|
|
249
247
|
return undefined;
|
|
250
248
|
const src = mediaSrc(block);
|
|
251
|
-
const media = src ?
|
|
252
|
-
return media ? { media
|
|
249
|
+
const media = src ? viewerItem(t, src, block.mimeType) : undefined;
|
|
250
|
+
return media ? { media } : undefined;
|
|
253
251
|
}
|
|
254
252
|
/**
|
|
255
253
|
* Consecutive images and videos as one wrapping row of Astryx Thumbnails that
|
|
256
|
-
* share
|
|
254
|
+
* share one viewer, so its arrows walk them all.
|
|
257
255
|
*/
|
|
258
256
|
function MediaGallery({ items }) {
|
|
259
|
-
const lightbox =
|
|
260
|
-
return (_jsxs(HStack, { gap: 2, wrap: "wrap", children: [items.map(({ media: item
|
|
257
|
+
const lightbox = useMediaViewer(items.map((item) => item.media));
|
|
258
|
+
return (_jsxs(HStack, { gap: 2, wrap: "wrap", children: [items.map(({ media: item }, i) => (_jsx(Thumbnail, { src: item.type === 'image' ? item.src : undefined, alt: item.alt, label: item.alt, onClick: () => lightbox.open(i) }, item.src))), lightbox.element] }));
|
|
261
259
|
}
|
|
262
260
|
/** One generated image, framed to its natural ratio once loaded (the pinned ratio until then). */
|
|
263
261
|
function GeneratedImage(props) {
|
|
264
262
|
const t = useLabels();
|
|
265
263
|
const [natural, setNatural] = useState();
|
|
266
|
-
return (_jsx(ClickableCard, { label: t('@theorem.transcript.open_generated_image'), onClick: props.onOpen, padding: 0, width: "100%", maxWidth: GENERATED_IMAGE_MAX_WIDTH, children: _jsx(AspectRatio, { ratio: natural ?? props.ratio ?? 1, fit: "cover", children: _jsx("img", { src: props.item.
|
|
264
|
+
return (_jsx(ClickableCard, { label: t('@theorem.transcript.open_generated_image'), onClick: props.onOpen, padding: 0, width: "100%", maxWidth: GENERATED_IMAGE_MAX_WIDTH, children: _jsx(AspectRatio, { ratio: natural ?? props.ratio ?? 1, fit: "cover", children: _jsx("img", { src: props.item.media.src, alt: props.item.media.alt, onLoad: (event) => {
|
|
267
265
|
const { naturalWidth, naturalHeight } = event.currentTarget;
|
|
268
266
|
if (naturalWidth > 0 && naturalHeight > 0)
|
|
269
267
|
setNatural(naturalWidth / naturalHeight);
|
|
@@ -274,7 +272,7 @@ function GeneratedImage(props) {
|
|
|
274
272
|
* own ratio. Anything else (video) keeps the square Thumbnail.
|
|
275
273
|
*/
|
|
276
274
|
function GeneratedGallery({ items, ratio }) {
|
|
277
|
-
const lightbox =
|
|
275
|
+
const lightbox = useMediaViewer(items.map((item) => item.media));
|
|
278
276
|
return (_jsxs(VStack, { gap: 2, width: "100%", children: [items.map((item, i) => item.media.type === 'image' ? (_jsx(GeneratedImage, { item: item, ratio: ratio, onOpen: () => lightbox.open(i) }, item.media.src)) : (_jsx(Thumbnail, { alt: item.media.alt, label: item.media.alt, onClick: () => lightbox.open(i) }, item.media.src))), lightbox.element] }));
|
|
279
277
|
}
|
|
280
278
|
/** An image takes seconds: a slow, smooth breath rather than the Skeleton's quick stepped blink. */
|
|
@@ -288,24 +286,52 @@ function GeneratingImage({ ratio }) {
|
|
|
288
286
|
return (_jsx(VStack, { width: "100%", maxWidth: GENERATED_IMAGE_MAX_WIDTH, children: _jsx(AspectRatio, { ratio: ratio ?? 1, children: _jsx(Skeleton, { width: "100%", height: "100%", radius: 3, style: GENERATING_PULSE, "aria-label": t('@theorem.transcript.generating_image') }) }) }));
|
|
289
287
|
}
|
|
290
288
|
function MediaBlock({ block }) {
|
|
289
|
+
if (block.uri !== undefined) {
|
|
290
|
+
return (_jsx(ReferencedMedia, { reference: {
|
|
291
|
+
type: block.type ?? 'document',
|
|
292
|
+
mimeType: block.mimeType,
|
|
293
|
+
uri: block.uri,
|
|
294
|
+
...(block.metadata ? { metadata: block.metadata } : {}),
|
|
295
|
+
} }));
|
|
296
|
+
}
|
|
291
297
|
const src = mediaSrc(block);
|
|
292
298
|
if (src && block.mimeType.startsWith('audio/')) {
|
|
293
299
|
return _jsx(VoiceNote, { src: src, mimeType: block.mimeType });
|
|
294
300
|
}
|
|
295
301
|
return _jsx(Text, { color: "secondary", children: block.mimeType });
|
|
296
302
|
}
|
|
303
|
+
/**
|
|
304
|
+
* A reference a tool sent, as the app's resolver shows it: a picture or video in a gallery of its
|
|
305
|
+
* own, a clip to play; the named file while it resolves, or when nothing does.
|
|
306
|
+
*/
|
|
307
|
+
export function ReferencedMedia({ reference }) {
|
|
308
|
+
const t = useLabels();
|
|
309
|
+
const src = useResolvedMedia(reference);
|
|
310
|
+
if (src && reference.mimeType.startsWith('audio/')) {
|
|
311
|
+
return _jsx(VoiceNote, { src: src, mimeType: reference.mimeType });
|
|
312
|
+
}
|
|
313
|
+
const media = src ? viewerItem(t, src, reference.mimeType) : undefined;
|
|
314
|
+
if (media)
|
|
315
|
+
return _jsx(MediaGallery, { items: [{ media: { ...media, reference } }] });
|
|
316
|
+
return _jsx(MediaFileToken, { reference: reference });
|
|
317
|
+
}
|
|
297
318
|
/**
|
|
298
319
|
* Runs of images/videos become one gallery row; consecutive citation blocks
|
|
299
|
-
* become one sources row;
|
|
320
|
+
* become one sources row; calls side by side become one tools row; everything
|
|
321
|
+
* else is a row of its own.
|
|
300
322
|
*/
|
|
301
|
-
function bodyRows(t, body) {
|
|
323
|
+
function bodyRows(t, body, shown) {
|
|
302
324
|
const rows = [];
|
|
303
325
|
for (const block of body) {
|
|
326
|
+
if (block.kind === 'media' && !toolMediaShows(block, shown))
|
|
327
|
+
continue;
|
|
304
328
|
const item = galleryItemOf(t, block);
|
|
305
329
|
if (item)
|
|
306
330
|
addToGallery(rows, item);
|
|
307
331
|
else if (block.kind === 'citation')
|
|
308
332
|
addToSources(rows, citationsFromBlock(block));
|
|
333
|
+
else if (block.kind === 'tool')
|
|
334
|
+
addToTools(rows, block);
|
|
309
335
|
else
|
|
310
336
|
rows.push({ kind: 'block', block });
|
|
311
337
|
}
|
|
@@ -318,6 +344,13 @@ function addToGallery(rows, item) {
|
|
|
318
344
|
else
|
|
319
345
|
rows.push({ kind: 'gallery', items: [item] });
|
|
320
346
|
}
|
|
347
|
+
function addToTools(rows, block) {
|
|
348
|
+
const last = rows.at(-1);
|
|
349
|
+
if (last?.kind === 'tools')
|
|
350
|
+
last.blocks.push(block);
|
|
351
|
+
else
|
|
352
|
+
rows.push({ kind: 'tools', blocks: [block] });
|
|
353
|
+
}
|
|
321
354
|
function addToSources(rows, citations) {
|
|
322
355
|
if (citations.length === 0)
|
|
323
356
|
return;
|
|
@@ -397,8 +430,8 @@ function StreamedMarkdown({ text, streaming, density, components, }) {
|
|
|
397
430
|
function BodyBlock({ block, streaming }) {
|
|
398
431
|
if (block.kind === 'text')
|
|
399
432
|
return _jsx(StreamedMarkdown, { text: block.text, streaming: streaming });
|
|
400
|
-
if (block.kind === '
|
|
401
|
-
return _jsx(
|
|
433
|
+
if (block.kind === 'thought')
|
|
434
|
+
return _jsx(ThoughtLine, { text: block.text, streaming: streaming });
|
|
402
435
|
return _jsx(ResultBlock, { block: block });
|
|
403
436
|
}
|
|
404
437
|
/** Non-streaming answer rows: errors, structured output, and media. Citations coalesce in bodyRows. */
|
|
@@ -429,20 +462,33 @@ function toolDetail(t, tool, result) {
|
|
|
429
462
|
/** The calls an agent tool's agent made, each a call row of its own. */
|
|
430
463
|
function ToolSteps({ steps }) {
|
|
431
464
|
const t = useLabels();
|
|
432
|
-
const
|
|
433
|
-
return (_jsxs(VStack, { gap: 2, children: [_jsx(Text, { type: "supporting", color: "secondary", children: t('@theorem.transcript.tool_steps') }), _jsx(ToolCalls, { calls: steps.map((step) => toolCallItem(t, step.operationId ?? step.callId, step,
|
|
465
|
+
const shows = useToolRowShows();
|
|
466
|
+
return (_jsxs(VStack, { gap: 2, children: [_jsx(Text, { type: "supporting", color: "secondary", children: t('@theorem.transcript.tool_steps') }), _jsx(ToolCalls, { calls: steps.map((step) => toolCallItem(t, step.operationId ?? step.callId, step, shows)) })] }));
|
|
434
467
|
}
|
|
435
|
-
/** How long a finished call ran, when both ends were seen. */
|
|
436
|
-
function toolDuration(t, tool) {
|
|
437
|
-
if (tool.startedAt === undefined || tool.endedAt === undefined)
|
|
468
|
+
/** How long a finished call ran, when the transcript shows it and both ends were seen. */
|
|
469
|
+
function toolDuration(t, tool, shows) {
|
|
470
|
+
if (!shows.duration || tool.startedAt === undefined || tool.endedAt === undefined)
|
|
438
471
|
return {};
|
|
439
472
|
return { duration: workDuration(t, tool.endedAt - tool.startedAt) };
|
|
440
473
|
}
|
|
441
474
|
/** What the agent an agent tool ran used, after the call's name. Only agent tools report it. */
|
|
442
|
-
function toolUsageStats(state,
|
|
443
|
-
return
|
|
475
|
+
function toolUsageStats(state, shows) {
|
|
476
|
+
return shows.usage && state.tokens ? { stats: _jsx(Usage, { tokens: state.tokens }) } : {};
|
|
477
|
+
}
|
|
478
|
+
// why: The row already reads the failure's message, and `error` is the person's wording of the
|
|
479
|
+
// same failure, so the detail holds only what the row does not say.
|
|
480
|
+
function failureDetail(failure) {
|
|
481
|
+
return {
|
|
482
|
+
code: failure.code,
|
|
483
|
+
kind: failure.kind,
|
|
484
|
+
...(failure.details === undefined ? {} : { details: failure.details }),
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
/** A call's detail as its row takes it: none when the transcript shows no tool detail. */
|
|
488
|
+
function rowDetail(t, tool, shows, result) {
|
|
489
|
+
return shows.detail ? { resultDetail: toolDetail(t, tool, result) } : {};
|
|
444
490
|
}
|
|
445
|
-
function toolCallItem(t, id, tool,
|
|
491
|
+
function toolCallItem(t, id, tool, shows) {
|
|
446
492
|
const base = { key: id, name: toolCallLabel(tool) };
|
|
447
493
|
const { state } = tool;
|
|
448
494
|
switch (state?.phase) {
|
|
@@ -451,29 +497,37 @@ function toolCallItem(t, id, tool, showUsage) {
|
|
|
451
497
|
...base,
|
|
452
498
|
status: 'error',
|
|
453
499
|
target: state.failure.message,
|
|
454
|
-
...toolUsageStats(state,
|
|
500
|
+
...toolUsageStats(state, shows),
|
|
455
501
|
errorMessage: state.failure.message,
|
|
456
|
-
|
|
502
|
+
...rowDetail(t, tool, shows, _jsx(ShapedData, { value: failureDetail(state.failure), title: t('@theorem.transcript.tool_error') })),
|
|
457
503
|
};
|
|
458
504
|
case 'complete':
|
|
459
505
|
return {
|
|
460
506
|
...base,
|
|
461
507
|
status: 'complete',
|
|
462
|
-
...toolDuration(t, tool),
|
|
463
|
-
...toolUsageStats(state,
|
|
464
|
-
|
|
508
|
+
...toolDuration(t, tool, shows),
|
|
509
|
+
...toolUsageStats(state, shows),
|
|
510
|
+
...rowDetail(t, tool, shows, state.output === undefined ? undefined : (_jsx(ShapedData, { value: state.output, title: t('@theorem.transcript.tool_output') }))),
|
|
465
511
|
};
|
|
466
512
|
case 'running':
|
|
513
|
+
return { ...base, status: 'running', ...rowDetail(t, tool, shows) };
|
|
514
|
+
// why: The reply ended and the call goes on; the row says so until its end comes back.
|
|
467
515
|
case 'background':
|
|
468
|
-
return {
|
|
516
|
+
return {
|
|
517
|
+
...base,
|
|
518
|
+
status: 'running',
|
|
519
|
+
node: t('@theorem.transcript.tool_background'),
|
|
520
|
+
...rowDetail(t, tool, shows),
|
|
521
|
+
};
|
|
469
522
|
default:
|
|
470
|
-
return { ...base, status: 'pending',
|
|
523
|
+
return { ...base, status: 'pending', ...rowDetail(t, tool, shows) };
|
|
471
524
|
}
|
|
472
525
|
}
|
|
473
|
-
|
|
526
|
+
/** Calls side by side in a reply's body: one call's row, or several under their count. */
|
|
527
|
+
function ToolRun({ blocks }) {
|
|
474
528
|
const t = useLabels();
|
|
475
|
-
const
|
|
476
|
-
return _jsx(ToolCalls, { calls:
|
|
529
|
+
const shows = useToolRowShows();
|
|
530
|
+
return _jsx(ToolCalls, { calls: blocks.map((block) => toolCallItem(t, block.id, block.tool, shows)) });
|
|
477
531
|
}
|
|
478
532
|
/**
|
|
479
533
|
* Thinking reads as quieter text than the reply. Astryx has no reasoning
|
|
@@ -489,9 +543,18 @@ const THOUGHT_TEXT = {
|
|
|
489
543
|
'--text-body-size': 'var(--text-supporting-size)',
|
|
490
544
|
'--color-text-primary': 'var(--color-text-secondary)',
|
|
491
545
|
};
|
|
546
|
+
/**
|
|
547
|
+
* A thought where it came in a reply, folded to one line that opens on the whole of it. It starts
|
|
548
|
+
* folded, streaming too: the reply's words are what is read.
|
|
549
|
+
*/
|
|
550
|
+
function ThoughtLine({ text, streaming }) {
|
|
551
|
+
const t = useLabels();
|
|
552
|
+
const trigger = (_jsx(Text, { size: "sm", color: "secondary", maxLines: 1, children: t('@theorem.transcript.thought', { text: text.trim().replace(/\s+/g, ' ') }) }));
|
|
553
|
+
return (_jsx(Collapsible, { trigger: trigger, defaultIsOpen: false, children: _jsx("div", { style: THOUGHT_TEXT, children: _jsx(StreamedMarkdown, { text: text, streaming: streaming, density: "compact", components: THOUGHT_MARKDOWN }) }) }));
|
|
554
|
+
}
|
|
492
555
|
function TraceList({ items, streaming }) {
|
|
493
556
|
const t = useLabels();
|
|
494
|
-
const
|
|
557
|
+
const shows = useToolRowShows();
|
|
495
558
|
const rows = [];
|
|
496
559
|
let tools = [];
|
|
497
560
|
const flush = () => {
|
|
@@ -502,7 +565,7 @@ function TraceList({ items, streaming }) {
|
|
|
502
565
|
};
|
|
503
566
|
for (const [i, item] of items.entries()) {
|
|
504
567
|
if (item.kind === 'tool') {
|
|
505
|
-
tools.push(toolCallItem(t, item.id, item.block.tool,
|
|
568
|
+
tools.push(toolCallItem(t, item.id, item.block.tool, shows));
|
|
506
569
|
continue;
|
|
507
570
|
}
|
|
508
571
|
flush();
|
|
@@ -524,6 +587,7 @@ function answerSent(answering, tool) {
|
|
|
524
587
|
}
|
|
525
588
|
function GateCard({ block, handle, handlers, }) {
|
|
526
589
|
const { tool } = block;
|
|
590
|
+
const shows = useToolRowShows();
|
|
527
591
|
const gate = personGate(tool);
|
|
528
592
|
if (!gate)
|
|
529
593
|
return null;
|
|
@@ -532,7 +596,7 @@ function GateCard({ block, handle, handlers, }) {
|
|
|
532
596
|
if (gate.kind === 'auth') {
|
|
533
597
|
return (_jsx(AuthChallengeCard, { gate: gate, toolName: tool.name, submitted: answer === 'auth', onAuthenticated: (secret) => handlers.onAuthenticated?.(index, secret) }));
|
|
534
598
|
}
|
|
535
|
-
return (_jsx(ApprovalCard, { gate: gate, toolName: tool.name, agent: handle, input: tool.arguments, decided: answer === 'auth' ? null : answer, onDecision: (action) => handlers.onToolDecision?.(index, action) }));
|
|
599
|
+
return (_jsx(ApprovalCard, { gate: gate, toolName: tool.name, agent: handle, ...(shows.detail ? { input: tool.arguments } : {}), decided: answer === 'auth' ? null : answer, onDecision: (action) => handlers.onToolDecision?.(index, action) }));
|
|
536
600
|
}
|
|
537
601
|
/** Live elapsed time while the turn streams; its final duration once it ends. */
|
|
538
602
|
/** Live: counted from the start. Stopped: the work its blocks record. */
|
|
@@ -545,15 +609,19 @@ function useTurnElapsed(streaming, startedAt, workedMs) {
|
|
|
545
609
|
/**
|
|
546
610
|
* The turn's work status; with a trace, a Collapsible over its thinking and
|
|
547
611
|
* tool calls, open while the turn runs so they can be followed, folded away
|
|
548
|
-
* when it ends.
|
|
612
|
+
* when it ends. invariant: a run's end folds only what the run opened; a trace
|
|
613
|
+
* the person opened before a wake continued the turn stays open.
|
|
549
614
|
*/
|
|
550
615
|
function TurnStatus(props) {
|
|
551
616
|
const { status, streaming } = props;
|
|
552
617
|
const [traceOpen, setTraceOpen] = useState(streaming);
|
|
553
618
|
const [wasStreaming, setWasStreaming] = useState(streaming);
|
|
619
|
+
const [openBefore, setOpenBefore] = useState(false);
|
|
554
620
|
if (wasStreaming !== streaming) {
|
|
555
621
|
setWasStreaming(streaming);
|
|
556
|
-
|
|
622
|
+
if (streaming)
|
|
623
|
+
setOpenBefore(traceOpen);
|
|
624
|
+
setTraceOpen(streaming || (traceOpen && openBefore));
|
|
557
625
|
}
|
|
558
626
|
if (!status)
|
|
559
627
|
return null;
|
|
@@ -565,6 +633,8 @@ function TurnStatus(props) {
|
|
|
565
633
|
function BodyRowView({ row, streaming, imageOutput, }) {
|
|
566
634
|
if (row.kind === 'block')
|
|
567
635
|
return _jsx(BodyBlock, { block: row.block, streaming: streaming });
|
|
636
|
+
if (row.kind === 'tools')
|
|
637
|
+
return _jsx(ToolRun, { blocks: row.blocks });
|
|
568
638
|
if (row.kind === 'sources')
|
|
569
639
|
return _jsx(Sources, { citations: row.citations });
|
|
570
640
|
if (imageOutput)
|
|
@@ -582,13 +652,19 @@ function AssistantTurn(props) {
|
|
|
582
652
|
const chrome = useChromeReveal(props.isNewest === true);
|
|
583
653
|
const showUsage = useContext(ShowUsage);
|
|
584
654
|
const elapsedMs = useTurnElapsed(props.streaming, props.startedAt, props.workedMs);
|
|
585
|
-
const { trace, gatedTools, body, hasTrace } = composeAssistantTurn(props.blocks,
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
655
|
+
const { trace, gatedTools, body, hasTrace, hasSteps } = composeAssistantTurn(props.blocks, {
|
|
656
|
+
...(props.bodyKindPlacement !== undefined
|
|
657
|
+
? { bodyKindPlacement: props.bodyKindPlacement }
|
|
658
|
+
: {}),
|
|
659
|
+
...(props.stepLayout !== undefined ? { stepLayout: props.stepLayout } : {}),
|
|
660
|
+
});
|
|
661
|
+
const { shown } = useToolMedia();
|
|
662
|
+
const rows = bodyRows(t, body, shown);
|
|
663
|
+
const status = workStatusLabel(t, workStatus({ streaming: props.streaming, hasSteps, elapsedMs }));
|
|
590
664
|
const copyText = assistantTurnCopyText(body.length > 0 ? body : props.blocks);
|
|
591
|
-
return (_jsx(ChatMessage, { sender: "assistant", name: props.handle, ...chrome.handlers, metadata: props.streaming ? undefined : (_jsx(MessageChrome, { sender: "assistant", at: props.at, copyText: copyText, error: props.error, stopped: props.stopped, usage: showUsage ? props.usage : undefined, revealed: chrome.revealed })), children: _jsxs(VStack, { gap: 3, width: "100%", children: [_jsx(TurnStatus, { status: status, trace: trace, hasTrace: hasTrace, streaming: props.streaming }), gatedTools.map((block) => (_jsx(GateCard, { block: block, handle: props.handle, handlers: props.handlers }, block.id))), keyedByContent(rows, (row) => row.kind === 'gallery' || row.kind === 'sources'
|
|
665
|
+
return (_jsx(ChatMessage, { sender: "assistant", name: props.handle, ...chrome.handlers, metadata: props.streaming ? undefined : (_jsx(MessageChrome, { sender: "assistant", at: props.at, copyText: copyText, error: props.error, stopped: props.stopped, usage: showUsage ? props.usage : undefined, revealed: chrome.revealed })), children: _jsxs(VStack, { gap: 3, width: "100%", children: [_jsx(TurnStatus, { status: status, trace: trace, hasTrace: hasTrace, streaming: props.streaming }), gatedTools.map((block) => (_jsx(GateCard, { block: block, handle: props.handle, handlers: props.handlers }, block.id))), keyedByContent(rows, (row) => row.kind === 'gallery' || row.kind === 'sources' || row.kind === 'tools'
|
|
666
|
+
? row.kind
|
|
667
|
+
: row.block.kind).map(({ item: row, index: i, key }) => (_jsx(BodyRowView
|
|
592
668
|
// why: Not the block id: the committed turn re-mints ids, and a
|
|
593
669
|
// remount would cut the text reveal short.
|
|
594
670
|
, { row: row, streaming: props.streaming && i === rows.length - 1, imageOutput: props.imageOutput }, key))), _jsx(PendingImage, { imageOutput: props.imageOutput, streaming: props.streaming, rows: rows })] }) }));
|
|
@@ -617,12 +693,12 @@ function isBareFailure(group) {
|
|
|
617
693
|
}
|
|
618
694
|
/** Theorem transcript blocks rendered as Astryx chat messages. */
|
|
619
695
|
export function ChatTranscript(props) {
|
|
620
|
-
return (_jsx(TheoremLabelsProvider, { children: _jsx(ShowUsage.Provider, { value: props.usage === true, children: _jsx(ChatTranscriptBody, { ...props }) }) }));
|
|
696
|
+
return (_jsx(TheoremLabelsProvider, { children: _jsx(ShowUsage.Provider, { value: props.usage === true, children: _jsx(ShowToolData.Provider, { value: props.showToolData !== false, children: _jsx(ShowToolDurations.Provider, { value: props.showToolDurations !== false, children: _jsx(ChatTranscriptBody, { ...props }) }) }) }) }));
|
|
621
697
|
}
|
|
622
|
-
function ChatTranscriptBody({ blocks, handle, streaming = false, delivery, onToolDecision, answering = null, onAuthenticated, emptyState, dividers, imageOutput, bodyKindPlacement, labels, }) {
|
|
698
|
+
function ChatTranscriptBody({ blocks, handle, streaming = false, delivery, onToolDecision, answering = null, onAuthenticated, emptyState, dividers, imageOutput, bodyKindPlacement, stepLayout, labels, clock, }) {
|
|
623
699
|
const groups = useMemo(() => groupTranscriptBlocks(blocks, dividers && new Set(Object.keys(dividers))), [blocks, dividers]);
|
|
624
|
-
const
|
|
625
|
-
const
|
|
700
|
+
const own = useTurnClock(groups, streaming);
|
|
701
|
+
const { timeOf, replyStart } = clock ?? own;
|
|
626
702
|
const pendingPrompt = streaming ? pendingPromptOf(groups) : undefined;
|
|
627
703
|
const listRef = useRef(null);
|
|
628
704
|
useDisclosureMotion(listRef);
|
|
@@ -632,7 +708,7 @@ function ChatTranscriptBody({ blocks, handle, streaming = false, delivery, onToo
|
|
|
632
708
|
onToolDecision,
|
|
633
709
|
onAuthenticated,
|
|
634
710
|
};
|
|
635
|
-
const turn = { handle, handlers, imageOutput, bodyKindPlacement };
|
|
711
|
+
const turn = { handle, handlers, imageOutput, bodyKindPlacement, stepLayout };
|
|
636
712
|
const lastUser = groups.findLastIndex((group) => group.kind === 'user');
|
|
637
713
|
const userTurn = (group, index) => {
|
|
638
714
|
const next = groups[index + 1];
|
|
@@ -649,8 +725,7 @@ function ChatTranscriptBody({ blocks, handle, streaming = false, delivery, onToo
|
|
|
649
725
|
groups,
|
|
650
726
|
index,
|
|
651
727
|
streaming,
|
|
652
|
-
|
|
653
|
-
spans,
|
|
728
|
+
replyStart,
|
|
654
729
|
});
|
|
655
730
|
// why: A reply is dated when it last stopped: a reply that just finished reads "now".
|
|
656
731
|
const at = endedAt ?? timeOf(key);
|
|
@@ -668,7 +743,7 @@ function ChatTranscriptBody({ blocks, handle, streaming = false, delivery, onToo
|
|
|
668
743
|
// why: It sits in the same keyed list as the streamed reply, so the reply stays
|
|
669
744
|
// one message; a remount would read to the layout as a new message.
|
|
670
745
|
if (pendingPrompt) {
|
|
671
|
-
turns.push(_jsx(AssistantTurn, { ...turn, blocks: [], streaming: true, at: timeOf(pendingPrompt.key), startedAt: timeOf(pendingPrompt.key) }, promptReplyKey(pendingPrompt)));
|
|
746
|
+
turns.push(_jsx(AssistantTurn, { ...turn, blocks: [], streaming: true, at: timeOf(pendingPrompt.key), startedAt: replyStart(pendingPrompt) ?? timeOf(pendingPrompt.key) }, promptReplyKey(pendingPrompt)));
|
|
672
747
|
}
|
|
673
748
|
return (_jsx(ChatMessageList, { ref: listRef, isStreaming: streaming, emptyState: emptyState, children: turns }));
|
|
674
749
|
}
|
package/ui/ConsoleFrame.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { DefinedTheme } from '@astryxdesign/core/theme';
|
|
2
2
|
import type { HttpOptions } from '@theoremjs/web/client';
|
|
3
3
|
import { type CSSProperties, type ReactNode } from 'react';
|
|
4
|
-
import type { TheoremLabels } from './labels.
|
|
5
|
-
import { type TraceInspector } from './TraceInspectorPanel.
|
|
4
|
+
import type { TheoremLabels } from './labels.js';
|
|
5
|
+
import { type TraceInspector } from './TraceInspectorPanel.js';
|
|
6
6
|
/** The props a one-call console page shares: its look, its wording, its trace, and its layout. */
|
|
7
7
|
export type ConsolePageProps = {
|
|
8
8
|
/** Extra fetch options for the default HTTP transport (auth headers, custom fetch). */
|
package/ui/DecisionAnswers.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { DecisionJson, DecisionResult } from '@theoremjs/agents';
|
|
2
2
|
import type { DecisionInterface } from '@theoremjs/web/client';
|
|
3
3
|
import { type ReactNode } from 'react';
|
|
4
|
-
import { type DecisionImages } from '../client/decision-images.
|
|
4
|
+
import { type DecisionImages } from '../client/decision-images.js';
|
|
5
5
|
export type TheoremDecisionAnswersProps = {
|
|
6
6
|
iface: DecisionInterface;
|
|
7
7
|
result: DecisionResult;
|
package/ui/DecisionAnswers.js
CHANGED
|
@@ -4,7 +4,6 @@ import { HStack } from '@astryxdesign/core/HStack';
|
|
|
4
4
|
import { Icon } from '@astryxdesign/core/Icon';
|
|
5
5
|
import { IconButton } from '@astryxdesign/core/IconButton';
|
|
6
6
|
import { useLocale } from '@astryxdesign/core/i18n';
|
|
7
|
-
import { Lightbox } from '@astryxdesign/core/Lightbox';
|
|
8
7
|
import { Text } from '@astryxdesign/core/Text';
|
|
9
8
|
import { Tooltip } from '@astryxdesign/core/Tooltip';
|
|
10
9
|
import { VStack } from '@astryxdesign/core/VStack';
|
|
@@ -15,6 +14,7 @@ import { Arrive, Stream } from "./arrive.js";
|
|
|
15
14
|
import { CardWall } from "./CardWall.js";
|
|
16
15
|
import { resultMeta } from "./labels.js";
|
|
17
16
|
import { useLabels } from "./labels-provider.js";
|
|
17
|
+
import { useMediaViewer } from "./media-viewer.js";
|
|
18
18
|
import { ChartCard, TRACE_RADIUS, traceFill } from "./trace-patterns.js";
|
|
19
19
|
const EASE = 'var(--duration-medium) var(--ease-standard)';
|
|
20
20
|
/** Height of a share bar, as the trace draws one. */
|
|
@@ -134,6 +134,9 @@ function BoxCrop({ source, box, caption, }) {
|
|
|
134
134
|
const src = imageSrc(source);
|
|
135
135
|
const size = useImageSize(src);
|
|
136
136
|
const [marked, setMarked] = useState(null);
|
|
137
|
+
const viewer = useMediaViewer([
|
|
138
|
+
{ type: 'image', src: marked ?? src, alt: t('@theorem.decision.box_marked'), caption },
|
|
139
|
+
]);
|
|
137
140
|
if (!size)
|
|
138
141
|
return null;
|
|
139
142
|
const crop = cropOf(box);
|
|
@@ -144,7 +147,10 @@ function BoxCrop({ source, box, caption, }) {
|
|
|
144
147
|
outline: themeColor(event.currentTarget, '--color-accent'),
|
|
145
148
|
shade: themeColor(event.currentTarget, '--color-overlay'),
|
|
146
149
|
};
|
|
147
|
-
void markedBox(src, box, marks).then(
|
|
150
|
+
void markedBox(src, box, marks).then((next) => {
|
|
151
|
+
setMarked(next);
|
|
152
|
+
viewer.open();
|
|
153
|
+
});
|
|
148
154
|
}, children: _jsx("div", { role: "img", "aria-label": t('@theorem.decision.box_in'), style: {
|
|
149
155
|
position: 'relative',
|
|
150
156
|
overflow: 'hidden',
|
|
@@ -159,10 +165,7 @@ function BoxCrop({ source, box, caption, }) {
|
|
|
159
165
|
left: `${String(crop.left)}%`,
|
|
160
166
|
top: `${String(crop.top)}%`,
|
|
161
167
|
maxWidth: 'none',
|
|
162
|
-
} }) }) }) }),
|
|
163
|
-
if (!isOpen)
|
|
164
|
-
setMarked(null);
|
|
165
|
-
}, media: { src: marked ?? src, alt: t('@theorem.decision.box_marked'), caption }, hasZoom: true })] }));
|
|
168
|
+
} }) }) }) }), viewer.element] }));
|
|
166
169
|
}
|
|
167
170
|
/** The box cut from its image, or drawn in a frame that stands for the whole image when the page cannot tell which. */
|
|
168
171
|
function BoxAnswer({ title, aside, detail, answer, image, asked, }) {
|
package/ui/DecisionImages.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { DecisionAsset } from '@theoremjs/agents';
|
|
2
|
+
import { type DecisionImages } from '../client/decision-images.js';
|
|
2
3
|
/**
|
|
3
4
|
* Reads each file as an image and hands over the ones that are, with the name of the first that
|
|
4
5
|
* is not as the refusal to show.
|
|
5
6
|
*/
|
|
6
7
|
export declare function useImageReader(): {
|
|
7
|
-
read: (files: File | File[] | null) => Promise<[File,
|
|
8
|
+
read: (files: File | File[] | null) => Promise<[File, DecisionAsset][]>;
|
|
8
9
|
status: {
|
|
9
|
-
type:
|
|
10
|
+
type: 'error';
|
|
10
11
|
message: string;
|
|
11
12
|
} | undefined;
|
|
12
13
|
};
|
|
@@ -2,8 +2,8 @@ import { type EmbeddingInput } from '@theoremjs/agents';
|
|
|
2
2
|
import type { EmbeddingInterface } from '@theoremjs/web/client';
|
|
3
3
|
import { type EmbeddingInputCheck, type EmbeddingMediaPart } from '@theoremjs/web/client';
|
|
4
4
|
import { type ReactNode } from 'react';
|
|
5
|
-
import { type ConsoleView } from './ConsoleFrame.
|
|
6
|
-
import type { LabelText } from './labels.
|
|
5
|
+
import { type ConsoleView } from './ConsoleFrame.js';
|
|
6
|
+
import type { LabelText } from './labels.js';
|
|
7
7
|
/** The profile's `inputs`, which every request is held to. */
|
|
8
8
|
export type Rules = EmbeddingInterface['inputs'];
|
|
9
9
|
/** A document as the list shows it: what it sends, and the file it came from. */
|
package/ui/EmbeddingQuery.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type EmbeddingInput } from '@theoremjs/agents';
|
|
2
2
|
import { type EmbeddingFields } from '@theoremjs/web/client';
|
|
3
|
-
import { type ConsoleView } from './ConsoleFrame.
|
|
4
|
-
import { type Rules } from './EmbeddingDocuments.
|
|
3
|
+
import { type ConsoleView } from './ConsoleFrame.js';
|
|
4
|
+
import { type Rules } from './EmbeddingDocuments.js';
|
|
5
5
|
/** Where the embedded documents stand for a search: as embedded, or changed since. */
|
|
6
6
|
export type IndexState = 'fresh' | 'stale' | 'model';
|
|
7
7
|
/** The query, held as the JSON of the one input it sends, and the view it is edited in. */
|
package/ui/EmbeddingResults.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { EmbeddingResult } from '@theoremjs/agents';
|
|
2
2
|
import type { EmbeddingMatch } from '@theoremjs/web/client';
|
|
3
|
-
import type { EmbeddingIndex, IndexProgress } from '../hooks/use-embedding-index.
|
|
4
|
-
import type { OneCallState } from '../hooks/use-one-call.
|
|
5
|
-
import { type EmbeddingDocument } from './EmbeddingDocuments.
|
|
3
|
+
import type { EmbeddingIndex, IndexProgress } from '../hooks/use-embedding-index.js';
|
|
4
|
+
import type { OneCallState } from '../hooks/use-one-call.js';
|
|
5
|
+
import { type EmbeddingDocument } from './EmbeddingDocuments.js';
|
|
6
6
|
/** Which document the space and the matches both point at, and how either changes it. */
|
|
7
7
|
export type Pointing = {
|
|
8
8
|
hovered: number | null;
|
package/ui/LiveCallTile.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DefinedTheme } from '@astryxdesign/core/theme';
|
|
2
|
-
import type { LiveCall } from '../components/live/use-live-call.
|
|
3
|
-
import { type TheoremLabels } from './labels.
|
|
2
|
+
import type { LiveCall } from '../components/live/use-live-call.js';
|
|
3
|
+
import { type TheoremLabels } from './labels.js';
|
|
4
4
|
export type LiveCallTileProps = {
|
|
5
5
|
/** The call to draw, from `useLiveCall`: the same call `LiveRunner` draws. */
|
|
6
6
|
call: LiveCall;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import { type LiveCaptionState, type LiveCaptionTurn } from '../client/live/live-captions.
|
|
2
|
+
import { type LiveCaptionState, type LiveCaptionTurn } from '../client/live/live-captions.js';
|
|
3
3
|
export type LiveCaptionsPanelProps = {
|
|
4
4
|
/** Profile handle. The transcript shows it as the agent's name. */
|
|
5
5
|
handle: string;
|