@theoremjs/react 0.0.0-stage → 0.3.1
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 +772 -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-images.d.ts +76 -0
- package/client/decision-images.js +139 -0
- package/client/decision-transport.d.ts +70 -0
- package/client/decision-transport.js +175 -0
- package/client/decode-composer-draft.d.ts +11 -0
- package/client/decode-composer-draft.js +12 -0
- package/client/embedding-input.d.ts +84 -0
- package/client/embedding-input.js +194 -0
- package/client/embedding-space.d.ts +82 -0
- package/client/embedding-space.js +389 -0
- package/client/embedding-transport.d.ts +40 -0
- package/client/embedding-transport.js +71 -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 +29 -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 +47 -0
- package/client/host-transport.d.ts +70 -0
- package/client/host-transport.js +75 -0
- package/client/image-output.d.ts +6 -0
- package/client/image-output.js +13 -0
- package/client/index.d.ts +28 -0
- package/client/index.js +22 -0
- package/client/ink-waveform.d.ts +17 -0
- package/client/ink-waveform.js +68 -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 +53 -0
- package/client/live/live-captions.js +174 -0
- package/client/live/live-mic-forward.d.ts +30 -0
- package/client/live/live-mic-forward.js +46 -0
- package/client/live/live-page-tool.d.ts +34 -0
- package/client/live/live-page-tool.js +11 -0
- package/client/live/live-state.d.ts +13 -0
- package/client/live/live-state.js +22 -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 +22 -0
- package/client/live/run-live-tool-call.js +70 -0
- package/client/live/use-live-caption-log.d.ts +17 -0
- package/client/live/use-live-caption-log.js +51 -0
- package/client/live-client.d.ts +189 -0
- package/client/live-client.js +829 -0
- package/client/live-errors.d.ts +2 -0
- package/client/live-errors.js +9 -0
- package/client/live-messages.d.ts +148 -0
- package/client/live-messages.js +100 -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/page-dispatch.d.ts +15 -0
- package/client/page-dispatch.js +63 -0
- package/client/pcm-downsample.d.ts +4 -0
- package/client/pcm-downsample.js +45 -0
- package/client/run-commit.d.ts +34 -0
- package/client/run-commit.js +49 -0
- package/client/run-session.d.ts +79 -0
- package/client/run-session.js +207 -0
- package/client/schema-fields.d.ts +63 -0
- package/client/schema-fields.js +199 -0
- package/client/shaped-data.d.ts +118 -0
- package/client/shaped-data.js +343 -0
- package/client/source-citations.d.ts +13 -0
- package/client/source-citations.js +56 -0
- package/client/space-geometry.d.ts +39 -0
- package/client/space-geometry.js +183 -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 +293 -0
- package/client/tool-resume.d.ts +50 -0
- package/client/tool-resume.js +14 -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 +440 -0
- package/client/trace-view.d.ts +130 -0
- package/client/trace-view.js +333 -0
- package/client/transcript-groups.d.ts +140 -0
- package/client/transcript-groups.js +217 -0
- package/client/transcript-schema.d.ts +10 -0
- package/client/transcript-schema.js +120 -0
- package/client/transcript-scroll.d.ts +7 -0
- package/client/transcript-scroll.js +6 -0
- package/client/transport.d.ts +264 -0
- package/client/transport.js +330 -0
- package/client/turn-client.d.ts +44 -0
- package/client/turn-client.js +88 -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 +162 -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 +21 -0
- package/components/InkWaveform.js +131 -0
- package/components/live/use-live-runner-controls.d.ts +47 -0
- package/components/live/use-live-runner-controls.js +96 -0
- package/components/live/use-live-runner-model.d.ts +49 -0
- package/components/live/use-live-runner-model.js +190 -0
- package/components/live/use-live-runner-ui.d.ts +67 -0
- package/components/live/use-live-runner-ui.js +167 -0
- package/components/live/use-live-session-client.d.ts +41 -0
- package/components/live/use-live-session-client.js +126 -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 +19 -0
- package/components/use-voice-playback.d.ts +17 -0
- package/components/use-voice-playback.js +68 -0
- package/hooks/use-described.d.ts +12 -0
- package/hooks/use-described.js +25 -0
- package/hooks/use-embedding-index.d.ts +27 -0
- package/hooks/use-embedding-index.js +43 -0
- package/hooks/use-one-call.d.ts +31 -0
- package/hooks/use-one-call.js +76 -0
- package/hooks/use-page-tool-warnings.d.ts +6 -0
- package/hooks/use-page-tool-warnings.js +25 -0
- package/hooks/use-second-ticker.d.ts +2 -0
- package/hooks/use-second-ticker.js +13 -0
- package/hooks/use-theorem-chat-actions.d.ts +79 -0
- package/hooks/use-theorem-chat-actions.js +287 -0
- package/hooks/use-theorem-chat-state.d.ts +66 -0
- package/hooks/use-theorem-chat-state.js +122 -0
- package/hooks/use-theorem-chat.d.ts +97 -0
- package/hooks/use-theorem-chat.js +528 -0
- package/hooks/use-theorem-decision.d.ts +18 -0
- package/hooks/use-theorem-decision.js +12 -0
- package/hooks/use-theorem-embedding.d.ts +18 -0
- package/hooks/use-theorem-embedding.js +12 -0
- package/hooks/use-theorem-host.d.ts +45 -0
- package/hooks/use-theorem-host.js +135 -0
- package/hooks/use-theorem-interface.d.ts +22 -0
- package/hooks/use-theorem-interface.js +15 -0
- package/hooks/use-trace-records.d.ts +4 -0
- package/hooks/use-trace-records.js +7 -0
- package/index.d.ts +17 -0
- package/index.js +17 -0
- package/live.d.ts +9 -0
- package/live.js +10 -0
- package/package.json +74 -4
- package/server/checkpoint-ownership.d.ts +6 -0
- package/server/checkpoint-ownership.js +42 -0
- package/server/conversation-store.d.ts +92 -0
- package/server/conversation-store.js +131 -0
- package/server/conversation.d.ts +193 -0
- package/server/conversation.js +552 -0
- package/server/credential-store.d.ts +24 -0
- package/server/credential-store.js +14 -0
- package/server/decision-handler.d.ts +42 -0
- package/server/decision-handler.js +46 -0
- package/server/embedding-handler.d.ts +33 -0
- package/server/embedding-handler.js +45 -0
- package/server/handler.d.ts +152 -0
- package/server/handler.js +771 -0
- package/server/json-response.d.ts +2 -0
- package/server/json-response.js +7 -0
- package/server/mod.d.ts +25 -0
- package/server/mod.js +23 -0
- package/server/page-dispatch.d.ts +22 -0
- package/server/page-dispatch.js +127 -0
- package/server/request-body.d.ts +2 -0
- package/server/request-body.js +42 -0
- package/server/request-check.d.ts +21 -0
- package/server/request-check.js +49 -0
- package/server/session-authority.d.ts +8 -0
- package/server/session-authority.js +78 -0
- package/server/session-boundary.d.ts +26 -0
- package/server/session-boundary.js +64 -0
- package/server/session-identity.d.ts +16 -0
- package/server/session-identity.js +41 -0
- package/server/session-limits.d.ts +12 -0
- package/server/session-limits.js +59 -0
- package/server/session-store.d.ts +123 -0
- package/server/session-store.js +264 -0
- package/server/single-action.d.ts +21 -0
- package/server/single-action.js +30 -0
- package/server/steer-inbox.d.ts +35 -0
- package/server/steer-inbox.js +52 -0
- package/server/tool-operations.d.ts +6 -0
- package/server/tool-operations.js +132 -0
- package/server/turn-input.d.ts +10 -0
- package/server/turn-input.js +29 -0
- package/styles/ink-controls.css +134 -0
- package/ui/CardWall.d.ts +10 -0
- package/ui/CardWall.js +61 -0
- package/ui/ChatComposerBar.d.ts +62 -0
- package/ui/ChatComposerBar.js +306 -0
- package/ui/ChatTranscript.d.ts +43 -0
- package/ui/ChatTranscript.js +527 -0
- package/ui/ConsoleFrame.d.ts +104 -0
- package/ui/ConsoleFrame.js +146 -0
- package/ui/DecisionAnswers.d.ts +53 -0
- package/ui/DecisionAnswers.js +233 -0
- package/ui/DecisionImages.d.ts +16 -0
- package/ui/DecisionImages.js +46 -0
- package/ui/EmbeddingDocuments.d.ts +78 -0
- package/ui/EmbeddingDocuments.js +278 -0
- package/ui/EmbeddingQuery.d.ts +27 -0
- package/ui/EmbeddingQuery.js +95 -0
- package/ui/EmbeddingResults.d.ts +41 -0
- package/ui/EmbeddingResults.js +165 -0
- package/ui/EmbeddingSpace.d.ts +26 -0
- package/ui/EmbeddingSpace.js +106 -0
- package/ui/LiveCaptionsPanel.d.ts +22 -0
- package/ui/LiveCaptionsPanel.js +27 -0
- package/ui/LiveRunner.d.ts +30 -0
- package/ui/LiveRunner.js +180 -0
- package/ui/PaneState.d.ts +33 -0
- package/ui/PaneState.js +50 -0
- package/ui/SchemaFields.d.ts +10 -0
- package/ui/SchemaFields.js +150 -0
- package/ui/ShapedData.d.ts +11 -0
- package/ui/ShapedData.js +196 -0
- package/ui/SidePanel.d.ts +126 -0
- package/ui/SidePanel.js +123 -0
- package/ui/StateFields.d.ts +44 -0
- package/ui/StateFields.js +139 -0
- package/ui/TheoremChat.d.ts +122 -0
- package/ui/TheoremChat.js +134 -0
- package/ui/TheoremDecision.d.ts +30 -0
- package/ui/TheoremDecision.js +130 -0
- package/ui/TheoremEmbedding.d.ts +27 -0
- package/ui/TheoremEmbedding.js +122 -0
- package/ui/TheoremHost.d.ts +55 -0
- package/ui/TheoremHost.js +240 -0
- package/ui/ToolGateCard.d.ts +32 -0
- package/ui/ToolGateCard.js +107 -0
- package/ui/ToolResult.d.ts +10 -0
- package/ui/ToolResult.js +62 -0
- package/ui/ToolResultCharts.d.ts +5 -0
- package/ui/ToolResultCharts.js +103 -0
- package/ui/TraceCharts.d.ts +13 -0
- package/ui/TraceCharts.js +266 -0
- package/ui/TraceGuardrails.d.ts +11 -0
- package/ui/TraceGuardrails.js +74 -0
- package/ui/TraceInspector.d.ts +16 -0
- package/ui/TraceInspector.js +206 -0
- package/ui/TraceInspectorPanel.d.ts +46 -0
- package/ui/TraceInspectorPanel.js +95 -0
- package/ui/TraceOverview.d.ts +38 -0
- package/ui/TraceOverview.js +126 -0
- package/ui/TraceSpanDetail.d.ts +10 -0
- package/ui/TraceSpanDetail.js +190 -0
- package/ui/TraceStory.d.ts +20 -0
- package/ui/TraceStory.js +108 -0
- package/ui/TraceValues.d.ts +36 -0
- package/ui/TraceValues.js +123 -0
- package/ui/TraceWaterfall.d.ts +13 -0
- package/ui/TraceWaterfall.js +135 -0
- package/ui/VoiceNote.d.ts +12 -0
- package/ui/VoiceNote.js +28 -0
- package/ui/approval-heading.d.ts +4 -0
- package/ui/approval-heading.js +9 -0
- package/ui/arrive.d.ts +18 -0
- package/ui/arrive.js +46 -0
- package/ui/built/theme.css +792 -0
- package/ui/built/theme.css.d.ts +9 -0
- package/ui/built/theorem.d.ts +13 -0
- package/ui/built/theorem.js +660 -0
- package/ui/built/theorem.variants.d.ts +22 -0
- package/ui/code-language.d.ts +12 -0
- package/ui/code-language.js +50 -0
- package/ui/disclosure-motion.d.ts +6 -0
- package/ui/disclosure-motion.js +207 -0
- package/ui/embedding-space-gl.d.ts +37 -0
- package/ui/embedding-space-gl.js +663 -0
- package/ui/embedding-space-view.d.ts +8 -0
- package/ui/embedding-space-view.js +8 -0
- package/ui/glide.d.ts +7 -0
- package/ui/glide.js +44 -0
- package/ui/icons.d.ts +4 -0
- package/ui/icons.js +38 -0
- package/ui/index.d.ts +36 -0
- package/ui/index.js +39 -0
- package/ui/labels-provider.d.ts +16 -0
- package/ui/labels-provider.js +64 -0
- package/ui/labels.d.ts +1442 -0
- package/ui/labels.js +1443 -0
- package/ui/markdown-plugins.d.ts +9 -0
- package/ui/markdown-plugins.js +13 -0
- package/ui/mcp-icon.d.ts +6 -0
- package/ui/mcp-icon.js +8 -0
- package/ui/row-keys.d.ts +19 -0
- package/ui/row-keys.js +33 -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 +105 -0
- package/ui/trace-palette.d.ts +10 -0
- package/ui/trace-palette.js +10 -0
- package/ui/trace-patterns.d.ts +40 -0
- package/ui/trace-patterns.js +57 -0
- package/ui/transcript-copy-text.d.ts +4 -0
- package/ui/transcript-copy-text.js +40 -0
- package/ui/wall-columns.d.ts +8 -0
- package/ui/wall-columns.js +19 -0
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { MarkdownPluginEntry } from '@astryxdesign/core/Markdown/plugins';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
/** The Markdown plugins the host asked for, or none: one array, so every `Markdown` below shares it. */
|
|
4
|
+
export declare function useMarkdownPlugins(): readonly MarkdownPluginEntry[] | undefined;
|
|
5
|
+
/** Labels untagged code fences in the Markdown beneath it, when `detectCodeLanguage` is on. */
|
|
6
|
+
export declare function MarkdownPluginsProvider({ detectCodeLanguage, children, }: {
|
|
7
|
+
detectCodeLanguage?: boolean;
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, use } from 'react';
|
|
3
|
+
import { codeLanguagePlugin } from "./code-language.js";
|
|
4
|
+
const PLUGINS = [codeLanguagePlugin];
|
|
5
|
+
const MarkdownPluginsContext = createContext(undefined);
|
|
6
|
+
/** The Markdown plugins the host asked for, or none: one array, so every `Markdown` below shares it. */
|
|
7
|
+
export function useMarkdownPlugins() {
|
|
8
|
+
return use(MarkdownPluginsContext);
|
|
9
|
+
}
|
|
10
|
+
/** Labels untagged code fences in the Markdown beneath it, when `detectCodeLanguage` is on. */
|
|
11
|
+
export function MarkdownPluginsProvider({ detectCodeLanguage, children, }) {
|
|
12
|
+
return (_jsx(MarkdownPluginsContext, { value: detectCodeLanguage ? PLUGINS : undefined, children: children }));
|
|
13
|
+
}
|
package/ui/mcp-icon.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { SVGProps } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Model Context Protocol mark (from Simple Icons, CC0), filled in the current colour.
|
|
4
|
+
* Tabler has no MCP icon; this marks MCP tools beside Tabler's glyphs for the other kinds.
|
|
5
|
+
*/
|
|
6
|
+
export declare function IconMcp(props: SVGProps<SVGSVGElement>): import("react").JSX.Element;
|
package/ui/mcp-icon.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Model Context Protocol mark (from Simple Icons, CC0), filled in the current colour.
|
|
4
|
+
* Tabler has no MCP icon; this marks MCP tools beside Tabler's glyphs for the other kinds.
|
|
5
|
+
*/
|
|
6
|
+
export function IconMcp(props) {
|
|
7
|
+
return (_jsx("svg", { viewBox: "0 0 24 24", fill: "currentColor", "aria-hidden": true, ...props, children: _jsx("path", { d: "M13.85 0a4.16 4.16 0 0 0-2.95 1.217L1.456 10.66a.835.835 0 0 0 0 1.18.835.835 0 0 0 1.18 0l9.442-9.442a2.49 2.49 0 0 1 3.541 0 2.49 2.49 0 0 1 0 3.541L8.59 12.97l-.1.1a.835.835 0 0 0 0 1.18.835.835 0 0 0 1.18 0l.1-.098 7.03-7.034a2.49 2.49 0 0 1 3.542 0l.049.05a2.49 2.49 0 0 1 0 3.54l-8.54 8.54a1.96 1.96 0 0 0 0 2.755l1.753 1.753a.835.835 0 0 0 1.18 0 .835.835 0 0 0 0-1.18l-1.753-1.753a.266.266 0 0 1 0-.394l8.54-8.54a4.185 4.185 0 0 0 0-5.9l-.05-.05a4.16 4.16 0 0 0-2.95-1.218c-.2 0-.401.02-.6.048a4.17 4.17 0 0 0-1.17-3.552A4.16 4.16 0 0 0 13.85 0m0 3.333a.84.84 0 0 0-.59.245L6.275 10.56a4.186 4.186 0 0 0 0 5.902 4.186 4.186 0 0 0 5.902 0L19.16 9.48a.835.835 0 0 0 0-1.18.835.835 0 0 0-1.18 0l-6.985 6.984a2.49 2.49 0 0 1-3.54 0 2.49 2.49 0 0 1 0-3.54l6.983-6.985a.835.835 0 0 0 0-1.18.84.84 0 0 0-.59-.245" }) }));
|
|
8
|
+
}
|
package/ui/row-keys.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** One item of a list with the React key it renders under. */
|
|
2
|
+
export type KeyedRow<T> = {
|
|
3
|
+
item: T;
|
|
4
|
+
index: number;
|
|
5
|
+
key: string;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Keys a read-only list by what each item says, so a repeated item is told apart by how many
|
|
9
|
+
* times it has appeared before. `base` must return the same text for the same item.
|
|
10
|
+
*/
|
|
11
|
+
export declare function keyedByContent<T>(items: readonly T[], base: (item: T) => string): KeyedRow<T>[];
|
|
12
|
+
/**
|
|
13
|
+
* Keys an editable list by identity: a row keeps its key while its text changes, and `drop`
|
|
14
|
+
* retires the key of a removed row so the rows after it keep theirs.
|
|
15
|
+
*/
|
|
16
|
+
export declare function useKeyedRows<T>(items: readonly T[]): {
|
|
17
|
+
rows: KeyedRow<T>[];
|
|
18
|
+
drop: (index: number) => void;
|
|
19
|
+
};
|
package/ui/row-keys.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { useRef } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Keys a read-only list by what each item says, so a repeated item is told apart by how many
|
|
4
|
+
* times it has appeared before. `base` must return the same text for the same item.
|
|
5
|
+
*/
|
|
6
|
+
export function keyedByContent(items, base) {
|
|
7
|
+
const seen = new Map();
|
|
8
|
+
return items.map((item, index) => {
|
|
9
|
+
const text = base(item);
|
|
10
|
+
const count = seen.get(text) ?? 0;
|
|
11
|
+
seen.set(text, count + 1);
|
|
12
|
+
return { item, index, key: `${text}#${String(count)}` };
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Keys an editable list by identity: a row keeps its key while its text changes, and `drop`
|
|
17
|
+
* retires the key of a removed row so the rows after it keep theirs.
|
|
18
|
+
*/
|
|
19
|
+
export function useKeyedRows(items) {
|
|
20
|
+
const keys = useRef([]);
|
|
21
|
+
const minted = useRef(0);
|
|
22
|
+
while (keys.current.length < items.length) {
|
|
23
|
+
keys.current.push(String(minted.current));
|
|
24
|
+
minted.current += 1;
|
|
25
|
+
}
|
|
26
|
+
keys.current.length = items.length;
|
|
27
|
+
return {
|
|
28
|
+
rows: items.map((item, index) => ({ item, index, key: keys.current[index] ?? '' })),
|
|
29
|
+
drop: (index) => {
|
|
30
|
+
keys.current.splice(index, 1);
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|
package/ui/theme.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type DefinedTheme } from '@astryxdesign/core/theme';
|
|
2
|
+
import { type ReactNode } from 'react';
|
|
3
|
+
export type TheoremThemeProviderProps = {
|
|
4
|
+
/** Force a theme. Omit to inherit the host's `<Theme>`, or fall back to {@link theoremTheme}. */
|
|
5
|
+
theme?: DefinedTheme;
|
|
6
|
+
mode?: 'system' | 'light' | 'dark';
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
};
|
|
9
|
+
/** Wraps children in the Theorem theme unless the host already provides an Astryx theme. */
|
|
10
|
+
export declare function TheoremThemeProvider({ theme, mode, children, }: TheoremThemeProviderProps): import("react").JSX.Element;
|
package/ui/theme.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Theme, ThemeContext } from '@astryxdesign/core/theme';
|
|
3
|
+
import { use } from 'react';
|
|
4
|
+
import { theoremTheme } from './built/theorem.js';
|
|
5
|
+
/** Wraps children in the Theorem theme unless the host already provides an Astryx theme. */
|
|
6
|
+
export function TheoremThemeProvider({ theme, mode = 'system', children, }) {
|
|
7
|
+
// why: Ask the React tree, not `useThemeName()`: outside a Theme that falls back to
|
|
8
|
+
// the <html> attribute our own Theme sets, which would unmount it in a loop.
|
|
9
|
+
const hostTheme = use(ThemeContext);
|
|
10
|
+
if (hostTheme != null && !theme)
|
|
11
|
+
return _jsx(_Fragment, { children: children });
|
|
12
|
+
return (_jsx(Theme, { theme: theme ?? theoremTheme, mode: mode, children: children }));
|
|
13
|
+
}
|
|
@@ -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,105 @@
|
|
|
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
|
+
// why: 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
|
+
// why: 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"] + *)': {
|
|
35
|
+
height: '0',
|
|
36
|
+
paddingTop: '0',
|
|
37
|
+
contentVisibility: 'hidden',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
// why: A source's favicon sits bare beside its title, without the ring
|
|
42
|
+
// Astryx draws around a citation icon. Nested keys must open with a
|
|
43
|
+
// pseudo-class, so `:where(*)` (the citation itself) leads the child rules.
|
|
44
|
+
citation: {
|
|
45
|
+
base: {
|
|
46
|
+
':where(*) > [aria-hidden="true"]': {
|
|
47
|
+
backgroundColor: 'transparent',
|
|
48
|
+
borderWidth: '0',
|
|
49
|
+
borderRadius: '0',
|
|
50
|
+
},
|
|
51
|
+
':where(*) > [aria-hidden="true"] > img': { width: '100%', height: '100%' },
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
// why: A call row's name is code type and its target or error note is body type;
|
|
55
|
+
// centered, their different metrics sit their text on different lines.
|
|
56
|
+
// Share a baseline instead (the status icon and chevron stay centered).
|
|
57
|
+
'chat-tool-calls': {
|
|
58
|
+
base: {
|
|
59
|
+
':where(*) [role="button"][aria-expanded] > span:not(:first-child):not(:has(svg))': {
|
|
60
|
+
alignSelf: 'baseline',
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
// why: A card that waits on the user sits in the transcript as a turn of its
|
|
65
|
+
// own, so it takes the surface of the user's message bubble.
|
|
66
|
+
card: {
|
|
67
|
+
'variant:bubble': {
|
|
68
|
+
backgroundColor: 'var(--color-neutral)',
|
|
69
|
+
borderRadius: 'var(--radius-chat)',
|
|
70
|
+
paddingBlock: 'var(--spacing-3)',
|
|
71
|
+
paddingInline: 'var(--spacing-4)',
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
// why: A code block sits among cards and panels, so it takes a card's corner
|
|
75
|
+
// (--radius-container) rather than the smaller element radius Astryx gives it.
|
|
76
|
+
'code-block': {
|
|
77
|
+
'container:card': { borderRadius: 'var(--radius-container)' },
|
|
78
|
+
},
|
|
79
|
+
'layout-panel': {
|
|
80
|
+
base: {
|
|
81
|
+
':where([role="complementary"])': {
|
|
82
|
+
transition: 'width var(--duration-medium) var(--ease-standard)',
|
|
83
|
+
},
|
|
84
|
+
// why: While its ResizeHandle drags, follow the pointer. An end panel's
|
|
85
|
+
// handle is the sibling before it; a start panel's handle is the sibling after it.
|
|
86
|
+
':where([data-resizing] + [role="complementary"], [role="complementary"]:has(+ [data-resizing]))': {
|
|
87
|
+
transition: 'none',
|
|
88
|
+
},
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
adaptations: {
|
|
93
|
+
rules: [
|
|
94
|
+
{
|
|
95
|
+
when: { motion: 'reduce' },
|
|
96
|
+
value: {
|
|
97
|
+
components: {
|
|
98
|
+
'collapsible-content': { base: { transition: 'none' } },
|
|
99
|
+
'layout-panel': { base: { ':where([role="complementary"])': { transition: 'none' } } },
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
],
|
|
104
|
+
},
|
|
105
|
+
});
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The trace panel's colour for a failed step: oxblood, a light-dark pair that is deep in light
|
|
3
|
+
* mode and softened, not brightened, in dark.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
export declare const TRACE_HUE: {
|
|
8
|
+
/** Oxblood: whatever failed. */
|
|
9
|
+
readonly oxblood: "light-dark(#8e2a28, #cd5f55)";
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The trace panel's colour for a failed step: oxblood, a light-dark pair that is deep in light
|
|
3
|
+
* mode and softened, not brightened, in dark.
|
|
4
|
+
*
|
|
5
|
+
* @module
|
|
6
|
+
*/
|
|
7
|
+
export const TRACE_HUE = {
|
|
8
|
+
/** Oxblood: whatever failed. */
|
|
9
|
+
oxblood: 'light-dark(#8e2a28, #cd5f55)',
|
|
10
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { ComponentProps, CSSProperties, 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
|
+
/** Every console card, request, response and result alike: one ground and one radius. A flush page points the ground at the muted one. */
|
|
27
|
+
export declare const CONSOLE_CARD: CSSProperties;
|
|
28
|
+
/** A chart's content: its name, one figure that answers it, then the chart and its key. */
|
|
29
|
+
export declare function ChartBody({ title, value, note, aside, detail, children, }: {
|
|
30
|
+
title: string;
|
|
31
|
+
value: ReactNode;
|
|
32
|
+
note?: ReactNode;
|
|
33
|
+
/** A line under the title that says more, cut to two lines with the rest on hover. */
|
|
34
|
+
detail?: string;
|
|
35
|
+
/** A control beside the title, such as a switch between views. */
|
|
36
|
+
aside?: ReactNode;
|
|
37
|
+
children?: ReactNode;
|
|
38
|
+
}): import("react").JSX.Element;
|
|
39
|
+
/** A chart as a card. */
|
|
40
|
+
export declare function ChartCard(props: ComponentProps<typeof ChartBody>): import("react").JSX.Element;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Card } from '@astryxdesign/core/Card';
|
|
3
|
+
import { HStack } from '@astryxdesign/core/HStack';
|
|
4
|
+
import { StackItem } from '@astryxdesign/core/Stack';
|
|
5
|
+
import { Text } from '@astryxdesign/core/Text';
|
|
6
|
+
import { VStack } from '@astryxdesign/core/VStack';
|
|
7
|
+
const SOLID = {
|
|
8
|
+
clear: 'light-dark(#0d1e37, #b4c6e2)',
|
|
9
|
+
shade1: 'light-dark(#3b5580, #6582ad)',
|
|
10
|
+
shade2: 'light-dark(#7f95b7, #3b5078)',
|
|
11
|
+
shade3: 'light-dark(#bcc8da, #22345a)',
|
|
12
|
+
failed: 'light-dark(#8e2a28, #cd5f55)',
|
|
13
|
+
};
|
|
14
|
+
const HATCH_BASE = 'light-dark(#e4e7ec, #2b2f36)';
|
|
15
|
+
const HATCH_STRIPE = 'light-dark(#9aa3b1, #6b727d)';
|
|
16
|
+
/** Text that leads a chart's headline, in the clear series' colour. */
|
|
17
|
+
const TRACE_ACCENT = SOLID.clear;
|
|
18
|
+
/** Corner radius of every bar, in pixels. */
|
|
19
|
+
export const TRACE_RADIUS = 4;
|
|
20
|
+
/** Paints the gap between stacked segments: the chart card's own background. */
|
|
21
|
+
export const TRACE_GAP = 'var(--color-background-surface)';
|
|
22
|
+
/** Each actor's fill: the model clear, tools hatched, the rest in shades. */
|
|
23
|
+
export const ACTOR_FILL = {
|
|
24
|
+
model: 'clear',
|
|
25
|
+
tool: 'hatch',
|
|
26
|
+
host: 'shade1',
|
|
27
|
+
theorem: 'shade2',
|
|
28
|
+
user: 'shade3',
|
|
29
|
+
error: 'failed',
|
|
30
|
+
};
|
|
31
|
+
/** The paint for a fill; the hatch lives in {@link TracePatterns}. */
|
|
32
|
+
export function traceFill(fill) {
|
|
33
|
+
return fill === 'hatch' ? 'url(#trace-fill-hatch)' : SOLID[fill];
|
|
34
|
+
}
|
|
35
|
+
/** The hatch, once per panel; charts anywhere in the document refer to it by id. */
|
|
36
|
+
export function TracePatterns() {
|
|
37
|
+
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 })] }) }) }));
|
|
38
|
+
}
|
|
39
|
+
/** A legend's key: a small rounded square in the fill. */
|
|
40
|
+
export function TraceSwatch({ fill }) {
|
|
41
|
+
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) }) }));
|
|
42
|
+
}
|
|
43
|
+
/** Every console card, request, response and result alike: one ground and one radius. A flush page points the ground at the muted one. */
|
|
44
|
+
export const CONSOLE_CARD = {
|
|
45
|
+
background: 'var(--theorem-console-card, var(--color-background-surface))',
|
|
46
|
+
borderRadius: 'var(--radius-page)',
|
|
47
|
+
};
|
|
48
|
+
/** A chart's content: its name, one figure that answers it, then the chart and its key. */
|
|
49
|
+
export function ChartBody({ title, value, note, aside, detail, children, }) {
|
|
50
|
+
const titled = (_jsx(Text, { type: "supporting", color: "secondary", children: title }));
|
|
51
|
+
const heading = detail ? (_jsxs(VStack, { gap: 1, children: [titled, _jsx(Text, { type: "supporting", maxLines: 2, children: detail })] })) : (titled);
|
|
52
|
+
return (_jsxs(VStack, { gap: 3, children: [aside ? (_jsxs(HStack, { gap: 3, vAlign: "center", children: [_jsx(StackItem, { size: "fill", children: heading }), aside] })) : (heading), _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] }));
|
|
53
|
+
}
|
|
54
|
+
/** A chart as a card. */
|
|
55
|
+
export function ChartCard(props) {
|
|
56
|
+
return (_jsx(Card, { variant: "muted", padding: 4, style: CONSOLE_CARD, children: _jsx(ChartBody, { ...props }) }));
|
|
57
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
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 'guardrail':
|
|
37
|
+
case 'turn-done':
|
|
38
|
+
return '';
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** How many columns at least `minWidth` wide fit across `width`, `gap` apart. Never fewer than one. */
|
|
2
|
+
export declare function columnCount(width: number, minWidth: number, gap: number): number;
|
|
3
|
+
/**
|
|
4
|
+
* Each card, in order, into the column that is shortest so far, by the
|
|
5
|
+
* cards' heights and the gap under each. A card not measured yet counts as
|
|
6
|
+
* no height, so unmeasured cards are dealt out in turn.
|
|
7
|
+
*/
|
|
8
|
+
export declare function wallColumns(heights: readonly (number | undefined)[], count: number, gap: number): number[][];
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** How many columns at least `minWidth` wide fit across `width`, `gap` apart. Never fewer than one. */
|
|
2
|
+
export function columnCount(width, minWidth, gap) {
|
|
3
|
+
return Math.max(1, Math.floor((width + gap) / (minWidth + gap)));
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Each card, in order, into the column that is shortest so far, by the
|
|
7
|
+
* cards' heights and the gap under each. A card not measured yet counts as
|
|
8
|
+
* no height, so unmeasured cards are dealt out in turn.
|
|
9
|
+
*/
|
|
10
|
+
export function wallColumns(heights, count, gap) {
|
|
11
|
+
const columns = Array.from({ length: count }, () => []);
|
|
12
|
+
const tall = Array.from({ length: count }, () => 0);
|
|
13
|
+
heights.forEach((height, card) => {
|
|
14
|
+
const at = tall.indexOf(Math.min(...tall));
|
|
15
|
+
columns[at]?.push(card);
|
|
16
|
+
tall[at] = (tall[at] ?? 0) + (height ?? 0) + gap;
|
|
17
|
+
});
|
|
18
|
+
return columns;
|
|
19
|
+
}
|