@theoremjs/react 0.0.0-stage → 0.3.0
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/LICENSE +21 -0
- package/README.md +246 -2
- package/client/attachment-hover-preview.d.ts +11 -0
- package/client/attachment-hover-preview.js +36 -0
- package/client/audio-level.d.ts +5 -0
- package/client/audio-level.js +24 -0
- package/client/composer-attachments.d.ts +30 -0
- package/client/composer-attachments.js +33 -0
- package/client/composer-drawer.d.ts +19 -0
- package/client/composer-drawer.js +15 -0
- package/client/composer-hints.d.ts +25 -0
- package/client/composer-hints.js +20 -0
- package/client/composer-primary.d.ts +16 -0
- package/client/composer-primary.js +25 -0
- package/client/decision-transport.d.ts +48 -0
- package/client/decision-transport.js +102 -0
- package/client/decode-composer-draft.d.ts +11 -0
- package/client/decode-composer-draft.js +12 -0
- package/client/encode-composer-draft.d.ts +9 -0
- package/client/encode-composer-draft.js +34 -0
- package/client/encode-files.d.ts +18 -0
- package/client/encode-files.js +54 -0
- package/client/failure.d.ts +32 -0
- package/client/failure.js +34 -0
- package/client/generation-selection.d.ts +15 -0
- package/client/generation-selection.js +24 -0
- package/client/host-call.d.ts +51 -0
- package/client/host-call.js +42 -0
- package/client/host-transport.d.ts +68 -0
- package/client/host-transport.js +74 -0
- package/client/image-output.d.ts +6 -0
- package/client/image-output.js +13 -0
- package/client/index.d.ts +20 -0
- package/client/index.js +18 -0
- package/client/ink-waveform.d.ts +17 -0
- package/client/ink-waveform.js +69 -0
- package/client/live/apply-live-turn-tool-event.d.ts +14 -0
- package/client/live/apply-live-turn-tool-event.js +39 -0
- package/client/live/live-captions.d.ts +23 -0
- package/client/live/live-captions.js +70 -0
- package/client/live/live-mic-forward.d.ts +29 -0
- package/client/live/live-mic-forward.js +37 -0
- package/client/live/live-state.d.ts +11 -0
- package/client/live/live-state.js +20 -0
- package/client/live/live-tool.d.ts +11 -0
- package/client/live/live-tool.js +1 -0
- package/client/live/live-video.d.ts +10 -0
- package/client/live/live-video.js +71 -0
- package/client/live/run-live-tool-call.d.ts +17 -0
- package/client/live/run-live-tool-call.js +32 -0
- package/client/live-client.d.ts +141 -0
- package/client/live-client.js +638 -0
- package/client/live-errors.d.ts +2 -0
- package/client/live-errors.js +9 -0
- package/client/live-messages.d.ts +110 -0
- package/client/live-messages.js +67 -0
- package/client/mic-capture.d.ts +4 -0
- package/client/mic-capture.js +6 -0
- package/client/oauth-popup.d.ts +26 -0
- package/client/oauth-popup.js +30 -0
- package/client/pcm-downsample.d.ts +4 -0
- package/client/pcm-downsample.js +45 -0
- package/client/run-commit.d.ts +61 -0
- package/client/run-commit.js +124 -0
- package/client/run-session.d.ts +80 -0
- package/client/run-session.js +215 -0
- package/client/schema-fields.d.ts +63 -0
- package/client/schema-fields.js +178 -0
- package/client/shaped-data.d.ts +118 -0
- package/client/shaped-data.js +314 -0
- package/client/source-citations.d.ts +13 -0
- package/client/source-citations.js +56 -0
- package/client/state-fields.d.ts +16 -0
- package/client/state-fields.js +44 -0
- package/client/tool-result.d.ts +78 -0
- package/client/tool-result.js +275 -0
- package/client/tool-resume.d.ts +33 -0
- package/client/tool-resume.js +11 -0
- package/client/trace-feed.d.ts +13 -0
- package/client/trace-feed.js +18 -0
- package/client/trace-story.d.ts +163 -0
- package/client/trace-story.js +416 -0
- package/client/trace-view.d.ts +130 -0
- package/client/trace-view.js +293 -0
- package/client/transcript-groups.d.ts +114 -0
- package/client/transcript-groups.js +167 -0
- package/client/transcript-scroll.d.ts +7 -0
- package/client/transcript-scroll.js +6 -0
- package/client/transport.d.ts +176 -0
- package/client/transport.js +256 -0
- package/client/turn-client.d.ts +35 -0
- package/client/turn-client.js +93 -0
- package/client/voice-label.d.ts +2 -0
- package/client/voice-label.js +15 -0
- package/client/voice-recorder.d.ts +27 -0
- package/client/voice-recorder.js +165 -0
- package/client/walk-away.d.ts +34 -0
- package/client/walk-away.js +48 -0
- package/client/wire-line.d.ts +56 -0
- package/client/wire-line.js +90 -0
- package/client/worklets/mic-capture.js +16 -0
- package/components/InkWaveform.d.ts +10 -0
- package/components/InkWaveform.js +108 -0
- package/components/live/use-live-runner-controls.d.ts +48 -0
- package/components/live/use-live-runner-controls.js +100 -0
- package/components/live/use-live-runner-model.d.ts +45 -0
- package/components/live/use-live-runner-model.js +175 -0
- package/components/live/use-live-runner-ui.d.ts +65 -0
- package/components/live/use-live-runner-ui.js +159 -0
- package/components/live/use-live-session-client.d.ts +41 -0
- package/components/live/use-live-session-client.js +123 -0
- package/components/use-composer-voice.d.ts +28 -0
- package/components/use-composer-voice.js +90 -0
- package/components/use-editor-selection.d.ts +3 -0
- package/components/use-editor-selection.js +16 -0
- package/components/use-voice-playback.d.ts +16 -0
- package/components/use-voice-playback.js +68 -0
- package/hooks/use-described.d.ts +8 -0
- package/hooks/use-described.js +23 -0
- package/hooks/use-theorem-chat-actions.d.ts +75 -0
- package/hooks/use-theorem-chat-actions.js +265 -0
- package/hooks/use-theorem-chat-state.d.ts +66 -0
- package/hooks/use-theorem-chat-state.js +118 -0
- package/hooks/use-theorem-chat.d.ts +63 -0
- package/hooks/use-theorem-chat.js +340 -0
- package/hooks/use-theorem-decision.d.ts +23 -0
- package/hooks/use-theorem-decision.js +75 -0
- package/hooks/use-theorem-host.d.ts +44 -0
- package/hooks/use-theorem-host.js +117 -0
- package/hooks/use-theorem-interface.d.ts +19 -0
- package/hooks/use-theorem-interface.js +25 -0
- package/hooks/use-trace-records.d.ts +4 -0
- package/hooks/use-trace-records.js +7 -0
- package/index.d.ts +14 -0
- package/index.js +14 -0
- package/live.d.ts +8 -0
- package/live.js +10 -0
- package/package.json +73 -4
- package/server/credential-store.d.ts +24 -0
- package/server/credential-store.js +14 -0
- package/server/decision-handler.d.ts +34 -0
- package/server/decision-handler.js +55 -0
- package/server/handler.d.ts +114 -0
- package/server/handler.js +568 -0
- package/server/json-response.d.ts +2 -0
- package/server/json-response.js +7 -0
- package/server/mod.d.ts +16 -0
- package/server/mod.js +15 -0
- package/server/request-check.d.ts +16 -0
- package/server/request-check.js +34 -0
- package/server/session-store.d.ts +74 -0
- package/server/session-store.js +49 -0
- package/server/steer-inbox.d.ts +35 -0
- package/server/steer-inbox.js +52 -0
- package/server/walk-away.d.ts +22 -0
- package/server/walk-away.js +41 -0
- package/styles/ink-controls.css +134 -0
- package/ui/ChatComposerBar.d.ts +39 -0
- package/ui/ChatComposerBar.js +251 -0
- package/ui/ChatTranscript.d.ts +30 -0
- package/ui/ChatTranscript.js +474 -0
- package/ui/ConsoleFrame.d.ts +47 -0
- package/ui/ConsoleFrame.js +46 -0
- package/ui/DecisionAnswers.d.ts +15 -0
- package/ui/DecisionAnswers.js +102 -0
- package/ui/LiveRunner.d.ts +28 -0
- package/ui/LiveRunner.js +193 -0
- package/ui/SchemaFields.d.ts +10 -0
- package/ui/SchemaFields.js +122 -0
- package/ui/ShapedData.d.ts +11 -0
- package/ui/ShapedData.js +151 -0
- package/ui/SidePanel.d.ts +57 -0
- package/ui/SidePanel.js +50 -0
- package/ui/StateFields.d.ts +36 -0
- package/ui/StateFields.js +96 -0
- package/ui/TheoremChat.d.ts +71 -0
- package/ui/TheoremChat.js +146 -0
- package/ui/TheoremDecision.d.ts +38 -0
- package/ui/TheoremDecision.js +87 -0
- package/ui/TheoremHost.d.ts +38 -0
- package/ui/TheoremHost.js +150 -0
- package/ui/ToolGateCard.d.ts +28 -0
- package/ui/ToolGateCard.js +100 -0
- package/ui/ToolResult.d.ts +10 -0
- package/ui/ToolResult.js +60 -0
- package/ui/ToolResultCharts.d.ts +5 -0
- package/ui/ToolResultCharts.js +86 -0
- package/ui/TraceCharts.d.ts +13 -0
- package/ui/TraceCharts.js +235 -0
- package/ui/TraceGuardrails.d.ts +10 -0
- package/ui/TraceGuardrails.js +56 -0
- package/ui/TraceInspector.d.ts +6 -0
- package/ui/TraceInspector.js +189 -0
- package/ui/TraceInspectorPanel.d.ts +24 -0
- package/ui/TraceInspectorPanel.js +57 -0
- package/ui/TraceOverview.d.ts +34 -0
- package/ui/TraceOverview.js +96 -0
- package/ui/TraceSpanDetail.d.ts +10 -0
- package/ui/TraceSpanDetail.js +188 -0
- package/ui/TraceStory.d.ts +20 -0
- package/ui/TraceStory.js +107 -0
- package/ui/TraceValues.d.ts +36 -0
- package/ui/TraceValues.js +113 -0
- package/ui/TraceWaterfall.d.ts +13 -0
- package/ui/TraceWaterfall.js +132 -0
- package/ui/VoiceNote.d.ts +12 -0
- package/ui/VoiceNote.js +28 -0
- package/ui/built/theme.css +774 -0
- package/ui/built/theorem.d.ts +13 -0
- package/ui/built/theorem.js +631 -0
- package/ui/built/theorem.variants.d.ts +16 -0
- package/ui/disclosure-motion.d.ts +6 -0
- package/ui/disclosure-motion.js +163 -0
- package/ui/icons.d.ts +4 -0
- package/ui/icons.js +37 -0
- package/ui/index.d.ts +25 -0
- package/ui/index.js +29 -0
- package/ui/labels-provider.d.ts +16 -0
- package/ui/labels-provider.js +61 -0
- package/ui/labels.d.ts +1153 -0
- package/ui/labels.js +603 -0
- package/ui/theme.d.ts +10 -0
- package/ui/theme.js +13 -0
- package/ui/theorem-theme.d.ts +10 -0
- package/ui/theorem-theme.js +83 -0
- package/ui/trace-palette.d.ts +24 -0
- package/ui/trace-palette.js +24 -0
- package/ui/trace-patterns.d.ts +32 -0
- package/ui/trace-patterns.js +44 -0
- package/ui/transcript-copy-text.d.ts +4 -0
- package/ui/transcript-copy-text.js +39 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type DefinedTheme } from '@astryxdesign/core/theme';
|
|
2
|
+
/**
|
|
3
|
+
* Default Theorem look: Astryx neutral (its radius scale, palettes, type)
|
|
4
|
+
* with Tabler icons. Extend it like any Astryx theme:
|
|
5
|
+
*
|
|
6
|
+
* ```ts
|
|
7
|
+
* defineTheme({ name: 'mine', extends: theoremTheme, tokens: { '--color-accent': '#5b5bd6' } })
|
|
8
|
+
* ```
|
|
9
|
+
*/
|
|
10
|
+
export declare const theoremTheme: DefinedTheme;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { defineTheme } from '@astryxdesign/core/theme';
|
|
2
|
+
import { neutralTheme } from '@astryxdesign/theme-neutral/built';
|
|
3
|
+
import { tablerIcons } from "./icons.js";
|
|
4
|
+
/**
|
|
5
|
+
* Default Theorem look: Astryx neutral (its radius scale, palettes, type)
|
|
6
|
+
* with Tabler icons. Extend it like any Astryx theme:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* defineTheme({ name: 'mine', extends: theoremTheme, tokens: { '--color-accent': '#5b5bd6' } })
|
|
10
|
+
* ```
|
|
11
|
+
*/
|
|
12
|
+
export const theoremTheme = defineTheme({
|
|
13
|
+
name: 'theorem',
|
|
14
|
+
extends: neutralTheme,
|
|
15
|
+
icons: tablerIcons,
|
|
16
|
+
components: {
|
|
17
|
+
// Media keeps a margin from the viewport edges, over a lighter scrim than
|
|
18
|
+
// Astryx's shared --color-overlay (dialogs keep theirs).
|
|
19
|
+
lightbox: {
|
|
20
|
+
base: {
|
|
21
|
+
padding: 'var(--spacing-12)',
|
|
22
|
+
'::backdrop': { backgroundColor: 'light-dark(#00000059, #00000099)' },
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
// Collapsible shows and hides without motion; ease its height with the
|
|
26
|
+
// same --duration-medium / --ease-standard as ChatToolCalls and the
|
|
27
|
+
// composer drawer. Closed = the trigger before it reads aria-expanded="false".
|
|
28
|
+
'collapsible-content': {
|
|
29
|
+
base: {
|
|
30
|
+
display: 'block',
|
|
31
|
+
overflow: 'clip',
|
|
32
|
+
interpolateSize: 'allow-keywords',
|
|
33
|
+
transition: 'height var(--duration-medium) var(--ease-standard), padding-top var(--duration-medium) var(--ease-standard), content-visibility var(--duration-medium) allow-discrete',
|
|
34
|
+
':where([aria-expanded="false"] + *)': { height: '0', paddingTop: '0', contentVisibility: 'hidden' },
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
// A source's favicon sits bare beside its title, without the ring
|
|
38
|
+
// Astryx draws around a citation icon. Nested keys must open with a
|
|
39
|
+
// pseudo-class, so `:where(*)` (the citation itself) leads the child rules.
|
|
40
|
+
citation: {
|
|
41
|
+
base: {
|
|
42
|
+
':where(*) > [aria-hidden="true"]': { backgroundColor: 'transparent', borderWidth: '0', borderRadius: '0' },
|
|
43
|
+
':where(*) > [aria-hidden="true"] > img': { width: '100%', height: '100%' },
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
// A call row's name is code type and its target or error note is body type;
|
|
47
|
+
// centered, their different metrics sit their text on different lines.
|
|
48
|
+
// Share a baseline instead (the status icon and chevron stay centered).
|
|
49
|
+
'chat-tool-calls': {
|
|
50
|
+
base: {
|
|
51
|
+
':where(*) [role="button"][aria-expanded] > span:not(:first-child):not(:has(svg))': {
|
|
52
|
+
alignSelf: 'baseline',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
// Side panels (SidePanel's LayoutPanels) slide open and closed by easing
|
|
57
|
+
// their width, pushing the content over.
|
|
58
|
+
'layout-panel': {
|
|
59
|
+
base: {
|
|
60
|
+
':where([role="complementary"])': {
|
|
61
|
+
transition: 'width var(--duration-medium) var(--ease-standard)',
|
|
62
|
+
},
|
|
63
|
+
// While its ResizeHandle (the sibling before it) drags, follow the pointer.
|
|
64
|
+
':where([data-resizing] + [role="complementary"])': {
|
|
65
|
+
transition: 'none',
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
adaptations: {
|
|
71
|
+
rules: [
|
|
72
|
+
{
|
|
73
|
+
when: { motion: 'reduce' },
|
|
74
|
+
value: {
|
|
75
|
+
components: {
|
|
76
|
+
'collapsible-content': { base: { transition: 'none' } },
|
|
77
|
+
'layout-panel': { base: { ':where([role="complementary"])': { transition: 'none' } } },
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
});
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The trace panel's colours, taken from Theorem's landscape stills rather than
|
|
3
|
+
* the stock hues: deep royal navy, antique brass, fjord teal, heather, warm
|
|
4
|
+
* stone, and moss and oxblood kept for how a step ended. Each is a
|
|
5
|
+
* light-dark pair, deep in light mode and softened, not brightened, in dark.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
export declare const TRACE_HUE: {
|
|
10
|
+
/** Royal navy: the model. */
|
|
11
|
+
readonly navy: "light-dark(#152350, #2b4596)";
|
|
12
|
+
/** Antique brass: tools. */
|
|
13
|
+
readonly brass: "light-dark(#6f5520, #b39150)";
|
|
14
|
+
/** Deep fjord teal: the host. */
|
|
15
|
+
readonly fjord: "light-dark(#24595c, #5f9a9c)";
|
|
16
|
+
/** Moss green: what succeeded. */
|
|
17
|
+
readonly moss: "light-dark(#3d5f2c, #7c9f5a)";
|
|
18
|
+
/** Heather: Theorem itself (guardrails, gates, the turn). */
|
|
19
|
+
readonly heather: "light-dark(#54447e, #9585bf)";
|
|
20
|
+
/** Warm stone: the person, and time nothing else accounts for. */
|
|
21
|
+
readonly stone: "light-dark(#6d6861, #a39d93)";
|
|
22
|
+
/** Oxblood: whatever failed. */
|
|
23
|
+
readonly oxblood: "light-dark(#8e2a28, #cd5f55)";
|
|
24
|
+
};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The trace panel's colours, taken from Theorem's landscape stills rather than
|
|
3
|
+
* the stock hues: deep royal navy, antique brass, fjord teal, heather, warm
|
|
4
|
+
* stone, and moss and oxblood kept for how a step ended. Each is a
|
|
5
|
+
* light-dark pair, deep in light mode and softened, not brightened, in dark.
|
|
6
|
+
*
|
|
7
|
+
* @module
|
|
8
|
+
*/
|
|
9
|
+
export const TRACE_HUE = {
|
|
10
|
+
/** Royal navy: the model. */
|
|
11
|
+
navy: 'light-dark(#152350, #2b4596)',
|
|
12
|
+
/** Antique brass: tools. */
|
|
13
|
+
brass: 'light-dark(#6f5520, #b39150)',
|
|
14
|
+
/** Deep fjord teal: the host. */
|
|
15
|
+
fjord: 'light-dark(#24595c, #5f9a9c)',
|
|
16
|
+
/** Moss green: what succeeded. */
|
|
17
|
+
moss: 'light-dark(#3d5f2c, #7c9f5a)',
|
|
18
|
+
/** Heather: Theorem itself (guardrails, gates, the turn). */
|
|
19
|
+
heather: 'light-dark(#54447e, #9585bf)',
|
|
20
|
+
/** Warm stone: the person, and time nothing else accounts for. */
|
|
21
|
+
stone: 'light-dark(#6d6861, #a39d93)',
|
|
22
|
+
/** Oxblood: whatever failed. */
|
|
23
|
+
oxblood: 'light-dark(#8e2a28, #cd5f55)',
|
|
24
|
+
};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { TraceActor } from '../client/trace-story.ts';
|
|
3
|
+
/**
|
|
4
|
+
* The trace charts' fills, one per series in order: the first is clear (a
|
|
5
|
+
* solid), the second a fine hatch, and the rest shades of deep navy (#0D1E37).
|
|
6
|
+
* Only a failure leaves the ramp, for oxblood. Also the card each chart
|
|
7
|
+
* sits in, which decision answers share.
|
|
8
|
+
*
|
|
9
|
+
* @module
|
|
10
|
+
*/
|
|
11
|
+
export type TraceFill = 'clear' | 'hatch' | 'shade1' | 'shade2' | 'shade3' | 'failed';
|
|
12
|
+
/** Corner radius of every bar, in pixels. */
|
|
13
|
+
export declare const TRACE_RADIUS = 4;
|
|
14
|
+
/** Paints the gap between stacked segments: the chart card's own background. */
|
|
15
|
+
export declare const TRACE_GAP = "var(--color-background-surface)";
|
|
16
|
+
/** Each actor's fill: the model clear, tools hatched, the rest in shades. */
|
|
17
|
+
export declare const ACTOR_FILL: Readonly<Record<TraceActor, TraceFill>>;
|
|
18
|
+
/** The paint for a fill; the hatch lives in {@link TracePatterns}. */
|
|
19
|
+
export declare function traceFill(fill: TraceFill): string;
|
|
20
|
+
/** The hatch, once per panel; charts anywhere in the document refer to it by id. */
|
|
21
|
+
export declare function TracePatterns(): import("react").JSX.Element;
|
|
22
|
+
/** A legend's key: a small rounded square in the fill. */
|
|
23
|
+
export declare function TraceSwatch({ fill }: {
|
|
24
|
+
fill: TraceFill;
|
|
25
|
+
}): import("react").JSX.Element;
|
|
26
|
+
/** A chart as a card: its name, one figure that answers it, then the chart and its key. */
|
|
27
|
+
export declare function ChartCard({ title, value, note, children }: {
|
|
28
|
+
title: string;
|
|
29
|
+
value: ReactNode;
|
|
30
|
+
note?: ReactNode;
|
|
31
|
+
children?: ReactNode;
|
|
32
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Card } from '@astryxdesign/core/Card';
|
|
3
|
+
import { Text } from '@astryxdesign/core/Text';
|
|
4
|
+
import { VStack } from '@astryxdesign/core/VStack';
|
|
5
|
+
const SOLID = {
|
|
6
|
+
clear: 'light-dark(#0d1e37, #b4c6e2)',
|
|
7
|
+
shade1: 'light-dark(#3b5580, #6582ad)',
|
|
8
|
+
shade2: 'light-dark(#7f95b7, #3b5078)',
|
|
9
|
+
shade3: 'light-dark(#bcc8da, #22345a)',
|
|
10
|
+
failed: 'light-dark(#8e2a28, #cd5f55)',
|
|
11
|
+
};
|
|
12
|
+
const HATCH_BASE = 'light-dark(#e4e7ec, #2b2f36)';
|
|
13
|
+
const HATCH_STRIPE = 'light-dark(#9aa3b1, #6b727d)';
|
|
14
|
+
/** Text that leads a chart's headline, in the clear series' colour. */
|
|
15
|
+
const TRACE_ACCENT = SOLID.clear;
|
|
16
|
+
/** Corner radius of every bar, in pixels. */
|
|
17
|
+
export const TRACE_RADIUS = 4;
|
|
18
|
+
/** Paints the gap between stacked segments: the chart card's own background. */
|
|
19
|
+
export const TRACE_GAP = 'var(--color-background-surface)';
|
|
20
|
+
/** Each actor's fill: the model clear, tools hatched, the rest in shades. */
|
|
21
|
+
export const ACTOR_FILL = {
|
|
22
|
+
model: 'clear',
|
|
23
|
+
tool: 'hatch',
|
|
24
|
+
host: 'shade1',
|
|
25
|
+
theorem: 'shade2',
|
|
26
|
+
user: 'shade3',
|
|
27
|
+
error: 'failed',
|
|
28
|
+
};
|
|
29
|
+
/** The paint for a fill; the hatch lives in {@link TracePatterns}. */
|
|
30
|
+
export function traceFill(fill) {
|
|
31
|
+
return fill === 'hatch' ? 'url(#trace-fill-hatch)' : SOLID[fill];
|
|
32
|
+
}
|
|
33
|
+
/** The hatch, once per panel; charts anywhere in the document refer to it by id. */
|
|
34
|
+
export function TracePatterns() {
|
|
35
|
+
return (_jsx("svg", { "aria-hidden": true, width: 0, height: 0, style: { position: 'absolute' }, children: _jsx("defs", { children: _jsxs("pattern", { id: "trace-fill-hatch", width: 3, height: 3, patternUnits: "userSpaceOnUse", patternTransform: "rotate(45)", children: [_jsx("rect", { width: 3, height: 3, fill: HATCH_BASE }), _jsx("line", { x1: 0, y1: 0, x2: 0, y2: 3, stroke: HATCH_STRIPE, strokeWidth: 1.2 })] }) }) }));
|
|
36
|
+
}
|
|
37
|
+
/** A legend's key: a small rounded square in the fill. */
|
|
38
|
+
export function TraceSwatch({ fill }) {
|
|
39
|
+
return (_jsx("svg", { "aria-hidden": true, width: 10, height: 10, style: { display: 'block', flexShrink: 0 }, children: _jsx("rect", { width: 10, height: 10, rx: 2, fill: traceFill(fill) }) }));
|
|
40
|
+
}
|
|
41
|
+
/** A chart as a card: its name, one figure that answers it, then the chart and its key. */
|
|
42
|
+
export function ChartCard({ title, value, note, children }) {
|
|
43
|
+
return (_jsx(Card, { variant: "muted", padding: 4, style: { background: 'var(--color-background-surface)' }, children: _jsxs(VStack, { gap: 3, children: [_jsx(Text, { type: "supporting", color: "secondary", children: title }), _jsxs("div", { style: { display: 'flex', alignItems: 'baseline', flexWrap: 'wrap', columnGap: 8 }, children: [_jsx(Text, { size: "2xl", weight: "medium", hasTabularNumbers: true, children: value }), note ? (_jsx(Text, { type: "supporting", hasTabularNumbers: true, children: _jsx("span", { style: { color: TRACE_ACCENT }, children: note }) })) : null] }), children] }) }));
|
|
44
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** Plain text copied from a transcript block. */
|
|
2
|
+
export function transcriptBlockCopyText(t, block) {
|
|
3
|
+
switch (block.kind) {
|
|
4
|
+
case 'user-text':
|
|
5
|
+
return block.text;
|
|
6
|
+
case 'user-attachment':
|
|
7
|
+
case 'user-voice':
|
|
8
|
+
return block.name;
|
|
9
|
+
case 'thought':
|
|
10
|
+
return block.text;
|
|
11
|
+
case 'text':
|
|
12
|
+
return block.text;
|
|
13
|
+
case 'tool': {
|
|
14
|
+
const lines = [t('@theorem.transcript.copy_text.tool', { name: block.tool.name })];
|
|
15
|
+
const { state } = block.tool;
|
|
16
|
+
if (state?.phase === 'complete' && state.output !== undefined) {
|
|
17
|
+
lines.push(JSON.stringify(state.output, null, 2));
|
|
18
|
+
}
|
|
19
|
+
else if (state?.phase === 'error') {
|
|
20
|
+
lines.push(JSON.stringify(state.failure, null, 2));
|
|
21
|
+
}
|
|
22
|
+
return lines.join('\n\n');
|
|
23
|
+
}
|
|
24
|
+
case 'structured':
|
|
25
|
+
return JSON.stringify(block.value, null, 2);
|
|
26
|
+
case 'media':
|
|
27
|
+
return block.url ?? t('@theorem.transcript.copy_text.media', { mimeType: block.mimeType });
|
|
28
|
+
case 'grounding':
|
|
29
|
+
return JSON.stringify(block.grounding, null, 2);
|
|
30
|
+
case 'citation':
|
|
31
|
+
return JSON.stringify(block.sources, null, 2);
|
|
32
|
+
case 'evidence':
|
|
33
|
+
return JSON.stringify(block.evidence, null, 2);
|
|
34
|
+
case 'error':
|
|
35
|
+
return block.message;
|
|
36
|
+
case 'turn-done':
|
|
37
|
+
return '';
|
|
38
|
+
}
|
|
39
|
+
}
|