@getloopscale/ui 0.0.0-stage → 0.37.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 +201 -0
- package/README.md +61 -2
- package/dist/components/composites/account-menu/account-menu.d.ts +43 -0
- package/dist/components/composites/account-menu/index.d.ts +1 -0
- package/dist/components/composites/annotation-input/annotation-input.d.ts +38 -0
- package/dist/components/composites/annotation-input/index.d.ts +4 -0
- package/dist/components/composites/annotation-input/types.d.ts +31 -0
- package/dist/components/composites/annotation-summary-group/annotation-summary-group.d.ts +28 -0
- package/dist/components/composites/annotation-summary-group/index.d.ts +1 -0
- package/dist/components/composites/attributes-table/attributes-table.d.ts +20 -0
- package/dist/components/composites/attributes-table/index.d.ts +1 -0
- package/dist/components/composites/chat-message-card/chat-message-card.d.ts +14 -0
- package/dist/components/composites/chat-message-card/index.d.ts +1 -0
- package/dist/components/composites/code-block/code-block.d.ts +29 -0
- package/dist/components/composites/code-block/index.d.ts +1 -0
- package/dist/components/composites/command-palette/command-palette.d.ts +41 -0
- package/dist/components/composites/command-palette/index.d.ts +1 -0
- package/dist/components/composites/comment-thread/comment-thread.d.ts +24 -0
- package/dist/components/composites/comment-thread/index.d.ts +2 -0
- package/dist/components/composites/confirm-dialog/confirm-dialog.d.ts +41 -0
- package/dist/components/composites/confirm-dialog/index.d.ts +1 -0
- package/dist/components/composites/data-table/compare-values.d.ts +2 -0
- package/dist/components/composites/data-table/data-table-loading.d.ts +10 -0
- package/dist/components/composites/data-table/data-table-parts.d.ts +16 -0
- package/dist/components/composites/data-table/data-table-virtualized.d.ts +32 -0
- package/dist/components/composites/data-table/data-table.d.ts +82 -0
- package/dist/components/composites/data-table/index.d.ts +2 -0
- package/dist/components/composites/data-table/use-data-table-sort.d.ts +19 -0
- package/dist/components/composites/dataset-item-diff/dataset-item-diff.d.ts +19 -0
- package/dist/components/composites/dataset-item-diff/index.d.ts +4 -0
- package/dist/components/composites/dataset-item-diff/to-diff-text.d.ts +22 -0
- package/dist/components/composites/deployment-row/deployment-row.d.ts +28 -0
- package/dist/components/composites/deployment-row/index.d.ts +1 -0
- package/dist/components/composites/diff-view/diff-section.d.ts +19 -0
- package/dist/components/composites/diff-view/diff-view.d.ts +39 -0
- package/dist/components/composites/diff-view/index.d.ts +2 -0
- package/dist/components/composites/domain-config/domain-config.d.ts +34 -0
- package/dist/components/composites/domain-config/index.d.ts +1 -0
- package/dist/components/composites/env-var-editor/env-var-editor.d.ts +35 -0
- package/dist/components/composites/env-var-editor/index.d.ts +1 -0
- package/dist/components/composites/evaluator-form/evaluator-form.d.ts +25 -0
- package/dist/components/composites/evaluator-form/index.d.ts +3 -0
- package/dist/components/composites/evaluator-form/types.d.ts +41 -0
- package/dist/components/composites/histogram/histogram.d.ts +19 -0
- package/dist/components/composites/histogram/index.d.ts +2 -0
- package/dist/components/composites/io-cards/index.d.ts +2 -0
- package/dist/components/composites/io-cards/io-cards.d.ts +17 -0
- package/dist/components/composites/io-cards/message-card.d.ts +21 -0
- package/dist/components/composites/message-branch-selector/index.d.ts +1 -0
- package/dist/components/composites/message-branch-selector/message-branch-selector.d.ts +27 -0
- package/dist/components/composites/metric-card/index.d.ts +2 -0
- package/dist/components/composites/metric-card/metric-card.d.ts +46 -0
- package/dist/components/composites/page-shell/index.d.ts +1 -0
- package/dist/components/composites/page-shell/page-shell.d.ts +68 -0
- package/dist/components/composites/percentile-chart/index.d.ts +2 -0
- package/dist/components/composites/percentile-chart/percentile-chart.d.ts +37 -0
- package/dist/components/composites/preview-env-card/index.d.ts +1 -0
- package/dist/components/composites/preview-env-card/preview-env-card.d.ts +36 -0
- package/dist/components/composites/price-breakdown/index.d.ts +2 -0
- package/dist/components/composites/price-breakdown/price-breakdown.d.ts +21 -0
- package/dist/components/composites/project-card/index.d.ts +1 -0
- package/dist/components/composites/project-card/project-card.d.ts +32 -0
- package/dist/components/composites/prompt-template-editor/extract-vars.d.ts +1 -0
- package/dist/components/composites/prompt-template-editor/index.d.ts +2 -0
- package/dist/components/composites/prompt-template-editor/prompt-template-editor.d.ts +24 -0
- package/dist/components/composites/prompt-version-diff/index.d.ts +4 -0
- package/dist/components/composites/prompt-version-diff/prompt-version-diff.d.ts +20 -0
- package/dist/components/composites/prompt-version-diff/to-diff-text.d.ts +26 -0
- package/dist/components/composites/rollback-ui/index.d.ts +1 -0
- package/dist/components/composites/rollback-ui/rollback-ui.d.ts +32 -0
- package/dist/components/composites/session-summary/index.d.ts +1 -0
- package/dist/components/composites/session-summary/session-summary.d.ts +18 -0
- package/dist/components/composites/session-timeline/index.d.ts +1 -0
- package/dist/components/composites/session-timeline/session-timeline.d.ts +22 -0
- package/dist/components/composites/severity-badge/index.d.ts +2 -0
- package/dist/components/composites/severity-badge/severity-badge.d.ts +33 -0
- package/dist/components/composites/span-graph/index.d.ts +1 -0
- package/dist/components/composites/span-graph/span-graph.d.ts +19 -0
- package/dist/components/composites/span-tree/index.d.ts +2 -0
- package/dist/components/composites/span-tree/span-tree-row.d.ts +22 -0
- package/dist/components/composites/span-tree/span-tree-virtual.d.ts +7 -0
- package/dist/components/composites/span-tree/span-tree.d.ts +34 -0
- package/dist/components/composites/span-waterfall/index.d.ts +1 -0
- package/dist/components/composites/span-waterfall/span-waterfall.d.ts +28 -0
- package/dist/components/composites/status-indicator/index.d.ts +2 -0
- package/dist/components/composites/status-indicator/status-indicator.d.ts +31 -0
- package/dist/components/composites/stepper/index.d.ts +1 -0
- package/dist/components/composites/stepper/stepper.d.ts +53 -0
- package/dist/components/composites/tag-input/index.d.ts +2 -0
- package/dist/components/composites/tag-input/tag-input.d.ts +32 -0
- package/dist/components/composites/task-header/index.d.ts +1 -0
- package/dist/components/composites/task-header/task-header.d.ts +20 -0
- package/dist/components/composites/token-cost-breakdown/index.d.ts +2 -0
- package/dist/components/composites/token-cost-breakdown/token-cost-breakdown.d.ts +26 -0
- package/dist/components/composites/trace-compare/index.d.ts +1 -0
- package/dist/components/composites/trace-compare/trace-compare.d.ts +27 -0
- package/dist/components/composites/trace-transcript/index.d.ts +1 -0
- package/dist/components/composites/trace-transcript/trace-transcript.d.ts +26 -0
- package/dist/components/composites/trend-chart/index.d.ts +1 -0
- package/dist/components/composites/trend-chart/trend-chart.d.ts +117 -0
- package/dist/components/primitives/action-bar/action-bar.d.ts +36 -0
- package/dist/components/primitives/action-bar/index.d.ts +1 -0
- package/dist/components/primitives/alert/alert.d.ts +31 -0
- package/dist/components/primitives/alert/index.d.ts +1 -0
- package/dist/components/primitives/avatar/avatar.d.ts +26 -0
- package/dist/components/primitives/avatar/index.d.ts +1 -0
- package/dist/components/primitives/badge/badge.d.ts +33 -0
- package/dist/components/primitives/badge/index.d.ts +1 -0
- package/dist/components/primitives/breadcrumb/breadcrumb.d.ts +15 -0
- package/dist/components/primitives/breadcrumb/index.d.ts +1 -0
- package/dist/components/primitives/button/button.d.ts +26 -0
- package/dist/components/primitives/button/index.d.ts +1 -0
- package/dist/components/primitives/card/card.d.ts +59 -0
- package/dist/components/primitives/card/index.d.ts +1 -0
- package/dist/components/primitives/checkbox/checkbox.d.ts +20 -0
- package/dist/components/primitives/checkbox/index.d.ts +1 -0
- package/dist/components/primitives/combobox/combobox.d.ts +53 -0
- package/dist/components/primitives/combobox/index.d.ts +1 -0
- package/dist/components/primitives/copy-button/copy-button.d.ts +17 -0
- package/dist/components/primitives/copy-button/index.d.ts +1 -0
- package/dist/components/primitives/danger-zone/danger-zone.d.ts +40 -0
- package/dist/components/primitives/danger-zone/index.d.ts +1 -0
- package/dist/components/primitives/description-list/description-list.d.ts +33 -0
- package/dist/components/primitives/description-list/index.d.ts +1 -0
- package/dist/components/primitives/dialog/dialog.d.ts +31 -0
- package/dist/components/primitives/dialog/index.d.ts +1 -0
- package/dist/components/primitives/dropdown-menu/dropdown-menu.d.ts +68 -0
- package/dist/components/primitives/dropdown-menu/index.d.ts +1 -0
- package/dist/components/primitives/empty-state/empty-state.d.ts +22 -0
- package/dist/components/primitives/empty-state/index.d.ts +1 -0
- package/dist/components/primitives/file-dropzone/file-dropzone.d.ts +26 -0
- package/dist/components/primitives/file-dropzone/index.d.ts +1 -0
- package/dist/components/primitives/file-dropzone/validate.d.ts +40 -0
- package/dist/components/primitives/form-field/form-field.d.ts +44 -0
- package/dist/components/primitives/form-field/index.d.ts +1 -0
- package/dist/components/primitives/input/index.d.ts +1 -0
- package/dist/components/primitives/input/input.d.ts +24 -0
- package/dist/components/primitives/json-viewer/index.d.ts +1 -0
- package/dist/components/primitives/json-viewer/json-viewer.d.ts +32 -0
- package/dist/components/primitives/label/index.d.ts +1 -0
- package/dist/components/primitives/label/label.d.ts +15 -0
- package/dist/components/primitives/login-split/index.d.ts +1 -0
- package/dist/components/primitives/login-split/login-split.d.ts +24 -0
- package/dist/components/primitives/metrics-panel/index.d.ts +1 -0
- package/dist/components/primitives/metrics-panel/metrics-panel.d.ts +62 -0
- package/dist/components/primitives/pagination/index.d.ts +1 -0
- package/dist/components/primitives/pagination/pagination.d.ts +44 -0
- package/dist/components/primitives/pin-input/index.d.ts +1 -0
- package/dist/components/primitives/pin-input/pin-input.d.ts +41 -0
- package/dist/components/primitives/plan-badge/index.d.ts +1 -0
- package/dist/components/primitives/plan-badge/plan-badge.d.ts +35 -0
- package/dist/components/primitives/progress/index.d.ts +1 -0
- package/dist/components/primitives/progress/progress.d.ts +44 -0
- package/dist/components/primitives/radio-group/index.d.ts +1 -0
- package/dist/components/primitives/radio-group/radio-group.d.ts +5 -0
- package/dist/components/primitives/scroll-area/index.d.ts +2 -0
- package/dist/components/primitives/scroll-area/scroll-area.d.ts +40 -0
- package/dist/components/primitives/scroll-area/use-stick-to-bottom.d.ts +20 -0
- package/dist/components/primitives/select/index.d.ts +1 -0
- package/dist/components/primitives/select/select.d.ts +50 -0
- package/dist/components/primitives/sheet/index.d.ts +1 -0
- package/dist/components/primitives/sheet/sheet.d.ts +33 -0
- package/dist/components/primitives/sidebar/index.d.ts +1 -0
- package/dist/components/primitives/sidebar/sidebar.d.ts +76 -0
- package/dist/components/primitives/skeleton/index.d.ts +1 -0
- package/dist/components/primitives/skeleton/skeleton.d.ts +21 -0
- package/dist/components/primitives/slider/index.d.ts +1 -0
- package/dist/components/primitives/slider/slider.d.ts +24 -0
- package/dist/components/primitives/social-auth-row/index.d.ts +1 -0
- package/dist/components/primitives/social-auth-row/social-auth-row.d.ts +24 -0
- package/dist/components/primitives/stat-tile/index.d.ts +1 -0
- package/dist/components/primitives/stat-tile/stat-tile.d.ts +28 -0
- package/dist/components/primitives/status-dot/index.d.ts +1 -0
- package/dist/components/primitives/status-dot/status-dot.d.ts +31 -0
- package/dist/components/primitives/switch/index.d.ts +1 -0
- package/dist/components/primitives/switch/switch.d.ts +20 -0
- package/dist/components/primitives/table/index.d.ts +1 -0
- package/dist/components/primitives/table/table.d.ts +61 -0
- package/dist/components/primitives/tabs/index.d.ts +1 -0
- package/dist/components/primitives/tabs/tabs.d.ts +7 -0
- package/dist/components/primitives/textarea/index.d.ts +1 -0
- package/dist/components/primitives/textarea/textarea.d.ts +20 -0
- package/dist/components/primitives/timestamp/index.d.ts +1 -0
- package/dist/components/primitives/timestamp/timestamp.d.ts +34 -0
- package/dist/components/primitives/toast/index.d.ts +2 -0
- package/dist/components/primitives/toast/toast.d.ts +34 -0
- package/dist/components/primitives/toast/toaster.d.ts +38 -0
- package/dist/components/primitives/tooltip/index.d.ts +1 -0
- package/dist/components/primitives/tooltip/tooltip.d.ts +33 -0
- package/dist/components/primitives/topnav/index.d.ts +1 -0
- package/dist/components/primitives/topnav/topnav.d.ts +29 -0
- package/dist/components/primitives/update-banner/index.d.ts +1 -0
- package/dist/components/primitives/update-banner/update-banner.d.ts +16 -0
- package/dist/components.css +2 -0
- package/dist/fonts/geist-400.woff2 +0 -0
- package/dist/fonts/geist-500.woff2 +0 -0
- package/dist/fonts/geist-600.woff2 +0 -0
- package/dist/fonts/geist-mono-400.woff2 +0 -0
- package/dist/fonts/geist-mono-500.woff2 +0 -0
- package/dist/fonts/geist-mono-600.woff2 +0 -0
- package/dist/fonts-cdn.css +28 -0
- package/dist/fonts.css +75 -0
- package/dist/index.d.ts +116 -0
- package/dist/index.js +9274 -0
- package/dist/lib/chart/histogram.d.ts +21 -0
- package/dist/lib/chart/index.d.ts +1 -0
- package/dist/lib/cn.d.ts +6 -0
- package/dist/lib/diff/diff-lines.d.ts +23 -0
- package/dist/lib/diff/index.d.ts +1 -0
- package/dist/lib/env.d.ts +55 -0
- package/dist/lib/live-region-context.d.ts +2 -0
- package/dist/lib/safe-href.d.ts +27 -0
- package/dist/lib/session/aggregate.d.ts +18 -0
- package/dist/lib/session/index.d.ts +2 -0
- package/dist/lib/session/types.d.ts +30 -0
- package/dist/lib/trace/align.d.ts +41 -0
- package/dist/lib/trace/attributes.d.ts +11 -0
- package/dist/lib/trace/bar-layout.d.ts +52 -0
- package/dist/lib/trace/chat.d.ts +14 -0
- package/dist/lib/trace/cost.d.ts +24 -0
- package/dist/lib/trace/duration.d.ts +18 -0
- package/dist/lib/trace/flatten.d.ts +28 -0
- package/dist/lib/trace/graph-layout.d.ts +52 -0
- package/dist/lib/trace/index.d.ts +9 -0
- package/dist/lib/trace/types.d.ts +85 -0
- package/dist/lib/types.d.ts +10 -0
- package/dist/preset.css +27 -0
- package/dist/styles/tailwind-preset.d.ts +29 -0
- package/dist/styles-v3-legacy.css +88 -0
- package/dist/styles.css +137 -0
- package/dist/tailwind-preset.js +166 -0
- package/dist/test/a11y.d.ts +13 -0
- package/dist/test/fixtures/trace.d.ts +19 -0
- package/dist/test/setup.d.ts +1 -0
- package/dist/tokens-v4.css +223 -0
- package/dist/tokens.css +315 -0
- package/dist/types/task.d.ts +9 -0
- package/package.json +127 -4
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure histogram binning — distributes numeric values into `binCount`
|
|
3
|
+
* equal-width bins over [min, max] and counts how many fall in each.
|
|
4
|
+
*
|
|
5
|
+
* Zero-dependency, total, deterministic (M11 ADR D2 — binning is pure logic,
|
|
6
|
+
* distinct from the SVG scaling reused from TrendChart). Non-finite values
|
|
7
|
+
* (NaN / ±Infinity) are dropped, mirroring the trace-core `Number.isFinite`
|
|
8
|
+
* discipline. A degenerate range (all values equal) collapses to a single
|
|
9
|
+
* populated bin so no count is lost.
|
|
10
|
+
*/
|
|
11
|
+
/** One histogram bucket: half-open [lo, hi) except the final bin, which is [lo, hi] (max-inclusive). */
|
|
12
|
+
export interface HistogramBin {
|
|
13
|
+
lo: number;
|
|
14
|
+
hi: number;
|
|
15
|
+
count: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Bin `values` into `binCount` equal-width buckets.
|
|
19
|
+
* Returns `[]` for an empty input or a non-positive `binCount`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function computeHistogram(values: number[], binCount: number): HistogramBin[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./histogram.js";
|
package/dist/lib/cn.d.ts
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure line-level diff via Longest Common Subsequence (M14 ADR D1 — zero
|
|
3
|
+
* dependency, keeps the registry copy-pasteable; no `diff`/`@pierre/diffs`).
|
|
4
|
+
* Suitable for the design-system case (prompts / JSON, < ~500 lines);
|
|
5
|
+
* O(n·m) time. A row is `eq` (unchanged), `del` (only in old), or `add`
|
|
6
|
+
* (only in new). Line numbers are honest: `del` has no rightNo, `add` has no
|
|
7
|
+
* leftNo. Deterministic, total — never throws.
|
|
8
|
+
*/
|
|
9
|
+
export type DiffRowKind = "eq" | "del" | "add";
|
|
10
|
+
export interface DiffRow {
|
|
11
|
+
kind: DiffRowKind;
|
|
12
|
+
text: string;
|
|
13
|
+
/** 1-based line number in the old text (absent for `add`). */
|
|
14
|
+
leftNo?: number;
|
|
15
|
+
/** 1-based line number in the new text (absent for `del`). */
|
|
16
|
+
rightNo?: number;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Diff `oldText` against `newText` at line granularity. Returns the aligned
|
|
20
|
+
* sequence of rows (eq / del / add) in reading order. `del` before `add` when a
|
|
21
|
+
* line is replaced.
|
|
22
|
+
*/
|
|
23
|
+
export declare function diffLines(oldText: string, newText: string): DiffRow[];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./diff-lines.js";
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Environment helpers — type-safe, browser- and SSR-safe.
|
|
3
|
+
*
|
|
4
|
+
* Why this exists
|
|
5
|
+
* ---------------
|
|
6
|
+
* Component source files in this package need to gate development-only
|
|
7
|
+
* diagnostics (a11y warnings, dev-only `console.warn`, defensive validation
|
|
8
|
+
* messages) on `process.env.NODE_ENV`. Reading `process.env.NODE_ENV`
|
|
9
|
+
* directly in TypeScript triggers `TS2591: Cannot find name 'process'`
|
|
10
|
+
* unless `@types/node` is included in `tsconfig.json#compilerOptions.types`.
|
|
11
|
+
*
|
|
12
|
+
* Adding `node` to that array would work — but it pollutes the ambient
|
|
13
|
+
* global namespace with Node-only APIs (`Buffer`, `fs`, `path`, `Stream`)
|
|
14
|
+
* that have no place in a UI library targeting the browser. Authors would
|
|
15
|
+
* receive autocomplete for `import { readFileSync } from "node:fs"` while
|
|
16
|
+
* writing a React component. That is the wrong trade.
|
|
17
|
+
*
|
|
18
|
+
* The conventional pattern (React, Radix, Stripe Elements, MUI) is to
|
|
19
|
+
* funnel every `NODE_ENV` read through a single typed accessor. Bundlers
|
|
20
|
+
* (Vite, Webpack, esbuild, Rollup, tsup) replace the literal
|
|
21
|
+
* `process.env.NODE_ENV` reference at build time via their `define`
|
|
22
|
+
* mechanism, so this incurs zero runtime cost in the consumer's
|
|
23
|
+
* production build — the dead branch is dead-code-eliminated.
|
|
24
|
+
*
|
|
25
|
+
* Read access is funneled through `globalThis.process?.env?.NODE_ENV`
|
|
26
|
+
* so the helpers work in three environments without ambient types:
|
|
27
|
+
*
|
|
28
|
+
* - Browser via bundler with `define` (Vite/Webpack): the literal
|
|
29
|
+
* `process.env.NODE_ENV` is substituted; `globalThis.process` is the
|
|
30
|
+
* synthesized stub the bundler injects.
|
|
31
|
+
* - Node (SSR, tests, scripts): `globalThis.process` is the real `process`.
|
|
32
|
+
* - Browser without bundler injection: `globalThis.process` is undefined
|
|
33
|
+
* and {@link isDev} returns `true` so developers see warnings during
|
|
34
|
+
* hand-testing rather than silent failure.
|
|
35
|
+
*/
|
|
36
|
+
/**
|
|
37
|
+
* Returns `true` unless `process.env.NODE_ENV === "production"`.
|
|
38
|
+
*
|
|
39
|
+
* Use this to gate development-only branches: a11y warnings, dev-mode
|
|
40
|
+
* `console.warn`, defensive runtime validation. In a consumer's production
|
|
41
|
+
* build the bundler replaces the substituted reference and tree-shakes the
|
|
42
|
+
* dev branch entirely.
|
|
43
|
+
*
|
|
44
|
+
* Defensive default: when `process` is absent (browser without bundler
|
|
45
|
+
* injection), returns `true` to err on the side of more diagnostics.
|
|
46
|
+
*/
|
|
47
|
+
export declare function isDev(): boolean;
|
|
48
|
+
/**
|
|
49
|
+
* Returns `true` only when `process.env.NODE_ENV === "production"`.
|
|
50
|
+
*
|
|
51
|
+
* Strict inverse of {@link isDev}: when `process` is absent, returns
|
|
52
|
+
* `false`. Use this when you specifically need to confirm a production
|
|
53
|
+
* build (e.g. enabling minified-only optimizations).
|
|
54
|
+
*/
|
|
55
|
+
export declare function isProd(): boolean;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* safeHref — defang `javascript:`, `vbscript:`, and `data:text/html` URIs.
|
|
3
|
+
*
|
|
4
|
+
* T3.3 (Security SEC-003). When a consumer passes user-controlled data as
|
|
5
|
+
* an href to one of our card composites (`ProjectCard.href`, `PreviewEnvCard.url`,
|
|
6
|
+
* etc.), an attacker who controls that data can craft a `javascript:alert(...)`
|
|
7
|
+
* URI that fires in the application's origin on click. This is a standard
|
|
8
|
+
* component-library hardening (mitigation also documented in `SECURITY.md`).
|
|
9
|
+
*
|
|
10
|
+
* Returns `undefined` for dangerous protocols so the consuming component
|
|
11
|
+
* can short-circuit to a non-link rendering. Returns the URL unchanged for
|
|
12
|
+
* safe protocols (`http`, `https`, `mailto`, `tel`, relative paths).
|
|
13
|
+
*
|
|
14
|
+
* Allowed (returns input unchanged):
|
|
15
|
+
* - "https://example.com/path?query"
|
|
16
|
+
* - "/internal/route"
|
|
17
|
+
* - "mailto:dev@theokit.dev"
|
|
18
|
+
* - "tel:+15551234567"
|
|
19
|
+
*
|
|
20
|
+
* Blocked (returns undefined):
|
|
21
|
+
* - "javascript:alert(1)" — XSS via JS execution
|
|
22
|
+
* - " JavaScript:alert(1)" — case-insensitive, leading whitespace
|
|
23
|
+
* - "vbscript:msgbox(1)" — legacy IE XSS surface (still relevant on
|
|
24
|
+
* certain enterprise envs)
|
|
25
|
+
* - "data:text/html,..." — inline HTML/script payloads
|
|
26
|
+
*/
|
|
27
|
+
export declare function safeHref(url: string | null | undefined): string | undefined;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure, total session-metric aggregation. Never throws, never does I/O. Honest sums: absent
|
|
3
|
+
* cost/tokens count as 0 (never NaN); the window is max(end) − min(start) over parseable timestamps
|
|
4
|
+
* (an unparseable start is skipped from the window, never a crash).
|
|
5
|
+
*/
|
|
6
|
+
import type { SessionMetrics, SessionTraceItem } from "./types.js";
|
|
7
|
+
/**
|
|
8
|
+
* The session's wall-clock window in ns: [min start, max effective end] over the parseable
|
|
9
|
+
* timestamps. An unparseable start is skipped (never a crash); a clock-skewed/absent end falls back
|
|
10
|
+
* to its own start. A session with no parseable timestamps yields 0/0. This is the SINGLE definition
|
|
11
|
+
* of "a session's time window" — both `aggregateSession` (for `windowMs`) and `SessionTimeline` (for
|
|
12
|
+
* the per-trace bar denominator) consume it, so the window semantics live in one place.
|
|
13
|
+
*/
|
|
14
|
+
export declare function sessionBounds(items: SessionTraceItem[]): {
|
|
15
|
+
startNs: bigint;
|
|
16
|
+
endNs: bigint;
|
|
17
|
+
};
|
|
18
|
+
export declare function aggregateSession(items: SessionTraceItem[]): SessionMetrics;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Data contracts for the session-level components (M9). A session groups traces that share a
|
|
3
|
+
* `session.id`; `SessionTraceItem` is the trace-level shape both `SessionSummary` and
|
|
4
|
+
* `SessionTimeline` consume — the intersection of the looptrace traces-list row and the peer
|
|
5
|
+
* session views (phoenix numTraces+latency+cost, langfuse timestamp+name+latency). Timestamps
|
|
6
|
+
* accept unix-ns (bigint | numeric string) or ISO — normalized by the trace-core `toNs`.
|
|
7
|
+
*/
|
|
8
|
+
export interface SessionTraceItem {
|
|
9
|
+
id: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
/** Unix ns (bigint | numeric string) or ISO-8601 string. */
|
|
12
|
+
startTime?: bigint | string;
|
|
13
|
+
/** Absent/null = in-flight (renders unbounded on the timeline). */
|
|
14
|
+
endTime?: bigint | string | null;
|
|
15
|
+
status?: "OK" | "ERROR";
|
|
16
|
+
model?: string;
|
|
17
|
+
costUsd?: number;
|
|
18
|
+
totalTokens?: number;
|
|
19
|
+
}
|
|
20
|
+
/** Aggregate metrics over a session's traces. All numeric fields are 0 (never NaN) when absent. */
|
|
21
|
+
export interface SessionMetrics {
|
|
22
|
+
traceCount: number;
|
|
23
|
+
/** Session wall-clock window in ms: max(end) − min(start) across all traces. */
|
|
24
|
+
windowMs: number;
|
|
25
|
+
totalCostUsd: number;
|
|
26
|
+
totalTokens: number;
|
|
27
|
+
errorCount: number;
|
|
28
|
+
/** Distinct models seen, sorted. */
|
|
29
|
+
models: string[];
|
|
30
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure, total structural alignment + metric aggregation for comparing two
|
|
3
|
+
* traces. Never throws (cycle-guarded), never does I/O. Deltas are honest: a
|
|
4
|
+
* span present in only one trace has NO delta (never a fabricated 1:1 diff).
|
|
5
|
+
*/
|
|
6
|
+
import type { TraceSpan } from "./types.js";
|
|
7
|
+
export interface TraceMetrics {
|
|
8
|
+
durationMs: number | null;
|
|
9
|
+
totalTokens: number;
|
|
10
|
+
costUsd: number;
|
|
11
|
+
hasError: boolean;
|
|
12
|
+
spanCount: number;
|
|
13
|
+
}
|
|
14
|
+
/** Aggregate whole-trace metrics: root duration, summed tokens/cost, any-error flag. Total. */
|
|
15
|
+
export declare function traceMetrics(root: TraceSpan): TraceMetrics;
|
|
16
|
+
export interface NumericDelta {
|
|
17
|
+
from: number | null;
|
|
18
|
+
to: number | null;
|
|
19
|
+
deltaPct: number | null;
|
|
20
|
+
}
|
|
21
|
+
export interface AlignDelta {
|
|
22
|
+
durationMs?: NumericDelta;
|
|
23
|
+
tokens?: NumericDelta;
|
|
24
|
+
costUsd?: NumericDelta;
|
|
25
|
+
}
|
|
26
|
+
export interface AlignRow {
|
|
27
|
+
key: string;
|
|
28
|
+
depth: number;
|
|
29
|
+
a?: TraceSpan;
|
|
30
|
+
b?: TraceSpan;
|
|
31
|
+
status: "matched" | "only-in-a" | "only-in-b";
|
|
32
|
+
/** Present ONLY when status === "matched" — an unpaired span has no honest delta. */
|
|
33
|
+
delta?: AlignDelta;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Align two span trees structurally, matching children by name (greedy,
|
|
37
|
+
* first-unused). Produces a flat, depth-annotated row list: matched pairs
|
|
38
|
+
* carry a delta; only-in-a / only-in-b rows do not. Cycle-safe via a visited
|
|
39
|
+
* set on span ids (a malformed self-referential tree cannot loop).
|
|
40
|
+
*/
|
|
41
|
+
export declare function alignSpanTrees(a: TraceSpan, b: TraceSpan): AlignRow[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure grouping of OTel span attributes by namespace (the prefix before the
|
|
3
|
+
* first `.`). Keys without a dot fall into the `general` namespace. Total —
|
|
4
|
+
* never throws; deterministic insertion order preserved within a group.
|
|
5
|
+
*/
|
|
6
|
+
export interface AttributeGroup {
|
|
7
|
+
namespace: string;
|
|
8
|
+
entries: Array<[string, unknown]>;
|
|
9
|
+
}
|
|
10
|
+
/** Group attribute entries by their dotted-key namespace, sorted by namespace name. */
|
|
11
|
+
export declare function groupByNamespace(attrs: Record<string, unknown>): AttributeGroup[];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Waterfall-layout math: trace time envelope, per-span bar geometry, a
|
|
3
|
+
* human-friendly time axis, overlapping-span row packing, and ∑-cost
|
|
4
|
+
* aggregation. Every function is pure and total — it NEVER throws and NEVER
|
|
5
|
+
* does I/O — so skew / missing-timestamp / overlap / degenerate-bounds
|
|
6
|
+
* negative cases are provable without rendering.
|
|
7
|
+
*/
|
|
8
|
+
import type { TraceSpan } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Trace time bounds — min start / max end across ALL spans (ns, bigint-safe):
|
|
11
|
+
* the honest envelope for the waterfall denominator (not root-only, which
|
|
12
|
+
* would let a child overflow). Unparseable timestamps are skipped; a trace
|
|
13
|
+
* with no timestamps returns 0/0.
|
|
14
|
+
*/
|
|
15
|
+
export declare function computeTraceBounds(root: TraceSpan): {
|
|
16
|
+
startNs: bigint;
|
|
17
|
+
endNs: bigint;
|
|
18
|
+
};
|
|
19
|
+
export interface BarLayout {
|
|
20
|
+
leftPct: number;
|
|
21
|
+
widthPct: number;
|
|
22
|
+
unbounded: boolean;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Map a span's [start, end] against the trace bounds → clamped {leftPct,
|
|
26
|
+
* widthPct} in [0,100] with `leftPct + widthPct ≤ 100`. Missing end and
|
|
27
|
+
* clock-skew (end < start) are flagged `unbounded` with zero width — never a
|
|
28
|
+
* throw. Percentages carry 2 decimals via integer bigint math.
|
|
29
|
+
*/
|
|
30
|
+
export declare function computeBarLayout(spanStart: bigint | string | undefined, spanEnd: bigint | string | null | undefined, traceStartNs: bigint, traceEndNs: bigint): BarLayout;
|
|
31
|
+
/** One tick on the waterfall time axis. */
|
|
32
|
+
export interface AxisTick {
|
|
33
|
+
offsetNs: bigint;
|
|
34
|
+
label: string;
|
|
35
|
+
leftPct: number;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Human-friendly time axis: pick a step from the 1/2/5×10ⁿ ladder so ticks
|
|
39
|
+
* sit ≥70px apart, then emit ticks at 0, step, 2·step, … across the span.
|
|
40
|
+
* Total: a degenerate window or non-positive width yields an empty axis.
|
|
41
|
+
*/
|
|
42
|
+
export declare function niceAxisTicks(startNs: bigint, endNs: bigint, pxWidth: number): AxisTick[];
|
|
43
|
+
/**
|
|
44
|
+
* Greedy single-pass row packing for overlapping spans: sort by start, then
|
|
45
|
+
* assign each span the lowest row whose last-placed span ended at/before this
|
|
46
|
+
* span's start. Returns `Map<id, rowIndex>`. Total: `[]` → empty map.
|
|
47
|
+
*/
|
|
48
|
+
export declare function packRows(spans: Array<{
|
|
49
|
+
id: string;
|
|
50
|
+
startNs: bigint;
|
|
51
|
+
endNs: bigint;
|
|
52
|
+
}>): Map<string, number>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ChatML detection + payload pretty-print. Pure and total. Output is ALWAYS
|
|
3
|
+
* plain text/data — nothing here interprets HTML (the transcript/IO renderers
|
|
4
|
+
* inherit the no-dangerouslySetInnerHTML invariant from these totals).
|
|
5
|
+
*/
|
|
6
|
+
import type { ChatMessage } from "./types.js";
|
|
7
|
+
/** Parse a value as a chat-message array (`[{role, content}, …]`) or null when it is not one. */
|
|
8
|
+
export declare function asChat(value: string): ChatMessage[] | null;
|
|
9
|
+
/** Pretty-print a stringified value as JSON when parseable, else leave it raw. Always plain text. */
|
|
10
|
+
export declare function prettyValue(value: string): string;
|
|
11
|
+
/** True when a message's content is redacted OR is/contains redacted thinking/reasoning. Pure, total. */
|
|
12
|
+
export declare function isRedactedThinking(m: ChatMessage): boolean;
|
|
13
|
+
/** Extract a plain-text body from a message's content (string, or joined text/thinking blocks). Total. */
|
|
14
|
+
export declare function contentText(content: unknown): string;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-span and subtree USD cost. Pure and total — missing/non-numeric costs
|
|
3
|
+
* collapse to 0 (never NaN) so `∑` badges stay honest.
|
|
4
|
+
*/
|
|
5
|
+
import type { TraceSpan } from "./types.js";
|
|
6
|
+
/**
|
|
7
|
+
* A single span's own USD cost: the promoted `costUsd` field, else the first
|
|
8
|
+
* parseable cost attribute. Total: missing/non-numeric → 0 (never NaN);
|
|
9
|
+
* negative costs floor to 0.
|
|
10
|
+
*/
|
|
11
|
+
export declare function spanCostUsd(span: TraceSpan): number;
|
|
12
|
+
/**
|
|
13
|
+
* A single span's own USD cost for PER-SPAN DISPLAY: the promoted `costUsd` field, else the first
|
|
14
|
+
* parseable cost attribute — but returns `undefined` when the span has no individually-computed
|
|
15
|
+
* cost (absent / non-numeric / ≤ 0). Distinct from `spanCostUsd` (which collapses to 0 for honest
|
|
16
|
+
* `∑` badges): a per-span cost is "exists or doesn't", not a sum, so the absent case renders `—`
|
|
17
|
+
* (em-dash) downstream instead of a fabricated `$0.0000` (M52 / looptrace#71 Finding 3).
|
|
18
|
+
*/
|
|
19
|
+
export declare function spanOwnCostUsd(span: TraceSpan): number | undefined;
|
|
20
|
+
/**
|
|
21
|
+
* Sum a span's own cost + all descendants' (`∑`). Total: missing cost counts as 0, never NaN.
|
|
22
|
+
* Cycle-safe: a repeated/self-referential child is counted at most once (no stack overflow).
|
|
23
|
+
*/
|
|
24
|
+
export declare function aggregateCost(span: TraceSpan): number;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Timestamp normalization + duration math. Pure and total — never throws,
|
|
3
|
+
* never does I/O. All internal math is bigint ns (ADR D2 of the plan): no
|
|
4
|
+
* float precision loss on unix-ns timestamps.
|
|
5
|
+
*/
|
|
6
|
+
import type { SpanStatus, TraceSpan } from "./types.js";
|
|
7
|
+
/**
|
|
8
|
+
* Normalize a timestamp to unix ns. Accepts bigint ns, a numeric string
|
|
9
|
+
* (treated as ns), or an ISO-8601 string (ms precision → ns). Returns null
|
|
10
|
+
* for anything unparseable — callers treat null as "cannot place this span".
|
|
11
|
+
*/
|
|
12
|
+
export declare function toNs(value: bigint | string | null | undefined): bigint | null;
|
|
13
|
+
/** Span duration in ms; null when unavailable or clock-skewed (end < start). */
|
|
14
|
+
export declare function durationMs(span: Pick<TraceSpan, "startTime" | "endTime">): number | null;
|
|
15
|
+
/** Whether a span status counts as an error. Total: unknown statuses are not errors. */
|
|
16
|
+
export declare function isSpanError(status: SpanStatus | string | undefined): boolean;
|
|
17
|
+
/** Compact ms/s/min duration label (`1500 → "1.5s"`). Null → "in-flight". Pure, no locale. */
|
|
18
|
+
export declare function formatDurationMs(ms: number | null): string;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tree flattening + the reader-mode transcript row model. Pure and total.
|
|
3
|
+
* `flattenVisible` order is the contract every renderer (tree, waterfall,
|
|
4
|
+
* transcript) shares, so selection/keyboard indices agree across views.
|
|
5
|
+
*/
|
|
6
|
+
import type { FlatSpan, TraceSpan, TranscriptRow } from "./types.js";
|
|
7
|
+
/**
|
|
8
|
+
* Above this many visible rows, renderers switch from the recursive path to
|
|
9
|
+
* the react-virtual flat-list (blueprint Corner 2 Q9; langfuse uses 350, the
|
|
10
|
+
* lens origin uses 200 — virtualization only when it earns its complexity).
|
|
11
|
+
*/
|
|
12
|
+
export declare const VIRTUALIZE_THRESHOLD = 200;
|
|
13
|
+
/**
|
|
14
|
+
* Depth-first flatten of ALL spans (ignores collapse) — resolve-by-id / envelope input. Cycle-safe:
|
|
15
|
+
* a self-referential or repeated child is visited at most once (a malformed trace cannot stack-overflow).
|
|
16
|
+
*/
|
|
17
|
+
export declare function flattenAll(root: TraceSpan): TraceSpan[];
|
|
18
|
+
/**
|
|
19
|
+
* Depth-first flatten of VISIBLE spans (a node in `collapsed` contributes no descendants). Cycle-safe:
|
|
20
|
+
* each span id is emitted at most once.
|
|
21
|
+
*/
|
|
22
|
+
export declare function flattenVisible(root: TraceSpan, collapsed: Set<string>): FlatSpan[];
|
|
23
|
+
/**
|
|
24
|
+
* Flatten a span tree into the ordered reader-mode transcript feed. Pre-order
|
|
25
|
+
* walk so `span`-row order matches `flattenVisible`. A fan-out node emits a
|
|
26
|
+
* `group-header` row BEFORE its child rows so the view can collapse the group.
|
|
27
|
+
*/
|
|
28
|
+
export declare function toTranscriptRows(root: TraceSpan): TranscriptRow[];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* PURE, deterministic layered layout for the agent-graph view. No I/O, no
|
|
3
|
+
* React: derives each span's semantic kind, lays the trace out as a layered
|
|
4
|
+
* node-edge graph (depth = distance from root, order = index within depth),
|
|
5
|
+
* flags the root→selected execution path, and caps huge traces — so the SVG
|
|
6
|
+
* renderer stays thin. SVG-pure by ADR D4 of the blueprint (no elkjs/d3).
|
|
7
|
+
*/
|
|
8
|
+
import type { SpanKind, TraceSpan } from "./types.js";
|
|
9
|
+
/**
|
|
10
|
+
* Derive a span's semantic kind from OTel GenAI signals (the raw `.kind`
|
|
11
|
+
* field is often the OTLP numeric — useless as agent/tool/LLM). Precedence:
|
|
12
|
+
* tool > retriever > embedding > llm > chain(has children) > unknown.
|
|
13
|
+
*/
|
|
14
|
+
export declare function deriveSpanKind(span: TraceSpan): SpanKind;
|
|
15
|
+
/** Above this span count the graph renders an honest "too large" state. */
|
|
16
|
+
export declare const GRAPH_NODE_CAP = 200;
|
|
17
|
+
export interface GraphNode {
|
|
18
|
+
spanId: string;
|
|
19
|
+
name: string;
|
|
20
|
+
kind: SpanKind;
|
|
21
|
+
depth: number;
|
|
22
|
+
order: number;
|
|
23
|
+
x: number;
|
|
24
|
+
y: number;
|
|
25
|
+
error: boolean;
|
|
26
|
+
selected: boolean;
|
|
27
|
+
onPath: boolean;
|
|
28
|
+
}
|
|
29
|
+
export interface GraphEdge {
|
|
30
|
+
from: string;
|
|
31
|
+
to: string;
|
|
32
|
+
onPath: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface LayeredGraph {
|
|
35
|
+
nodes: GraphNode[];
|
|
36
|
+
edges: GraphEdge[];
|
|
37
|
+
width: number;
|
|
38
|
+
height: number;
|
|
39
|
+
truncated: boolean;
|
|
40
|
+
count: number;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Build the deterministic layered graph. Edges come from parent/call order
|
|
44
|
+
* (`parentId`), NOT the nested `children[]`, so malformed inputs are honest:
|
|
45
|
+
* a self-loop or cycle is broken by a visited set; a span whose `parentId`
|
|
46
|
+
* is absent from the trace is attached under the root, never dropped.
|
|
47
|
+
* `onPath` = root→selected ancestor chain; with no selection, root→deepest
|
|
48
|
+
* leaf. Over `cap` spans → `{ truncated: true, nodes: [], edges: [] }`.
|
|
49
|
+
*/
|
|
50
|
+
export declare function buildLayeredGraph(root: TraceSpan, selectedId?: string, cap?: number): LayeredGraph;
|
|
51
|
+
/** Kind → display label. */
|
|
52
|
+
export declare const KIND_LABEL: Record<SpanKind, string>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from "./types.js";
|
|
2
|
+
export * from "./duration.js";
|
|
3
|
+
export * from "./chat.js";
|
|
4
|
+
export * from "./attributes.js";
|
|
5
|
+
export * from "./align.js";
|
|
6
|
+
export * from "./flatten.js";
|
|
7
|
+
export * from "./bar-layout.js";
|
|
8
|
+
export * from "./cost.js";
|
|
9
|
+
export * from "./graph-layout.js";
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared data contracts for the trace-native component family (M8).
|
|
3
|
+
*
|
|
4
|
+
* `TraceSpan` is the intersection of three real shapes (phoenix ISpanItem,
|
|
5
|
+
* langfuse observation, looptrace TraceSpanNode — blueprint Corner 2): the
|
|
6
|
+
* smallest type every kit component consumes. Transport fields (tRPC/GraphQL)
|
|
7
|
+
* are deliberately absent. Timestamps accept unix-ns (bigint or numeric
|
|
8
|
+
* string) or an ISO-8601 string — `toNs()` normalizes at the boundary.
|
|
9
|
+
*
|
|
10
|
+
* Note: `bigint` values do not JSON-serialize — story/args tooling must use
|
|
11
|
+
* fixtures directly (EC-2 of the plan).
|
|
12
|
+
*/
|
|
13
|
+
/** OpenInference / OTel GenAI span-kind vocabulary (subset the kit renders). */
|
|
14
|
+
export type SpanKind = "llm" | "tool" | "retriever" | "embedding" | "agent" | "chain" | "reranker" | "evaluator" | "guardrail" | "unknown";
|
|
15
|
+
export type SpanStatus = "OK" | "ERROR" | "UNSET";
|
|
16
|
+
export interface TraceSpan {
|
|
17
|
+
id: string;
|
|
18
|
+
parentId: string | null;
|
|
19
|
+
name: string;
|
|
20
|
+
/** Raw kind hint; semantic kind is derived via `deriveSpanKind` when absent. */
|
|
21
|
+
kind?: string;
|
|
22
|
+
/** Unix ns (bigint | numeric string) or ISO-8601 string. */
|
|
23
|
+
startTime?: bigint | string;
|
|
24
|
+
/** Absent/null = in-flight span (renders unbounded). */
|
|
25
|
+
endTime?: bigint | string | null;
|
|
26
|
+
status?: SpanStatus;
|
|
27
|
+
model?: string;
|
|
28
|
+
provider?: string;
|
|
29
|
+
inputTokens?: number;
|
|
30
|
+
outputTokens?: number;
|
|
31
|
+
cacheReadTokens?: number;
|
|
32
|
+
cacheCreationTokens?: number;
|
|
33
|
+
ttftMs?: number;
|
|
34
|
+
costUsd?: number;
|
|
35
|
+
/** Raw input/output payloads (JSON string, chat array JSON, or plain text). */
|
|
36
|
+
inputValue?: string;
|
|
37
|
+
outputValue?: string;
|
|
38
|
+
attributes?: Record<string, unknown>;
|
|
39
|
+
events?: Array<{
|
|
40
|
+
name: string;
|
|
41
|
+
time?: bigint | string;
|
|
42
|
+
attributes?: Record<string, unknown>;
|
|
43
|
+
}>;
|
|
44
|
+
children?: TraceSpan[];
|
|
45
|
+
}
|
|
46
|
+
/** One OpenAI-shaped tool call attached to an assistant message. */
|
|
47
|
+
export interface ToolCall {
|
|
48
|
+
id: string;
|
|
49
|
+
function?: {
|
|
50
|
+
name?: string;
|
|
51
|
+
arguments?: string;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
/** ChatML message — the role vocabulary common to phoenix/langfuse/lens. */
|
|
55
|
+
export interface ChatMessage {
|
|
56
|
+
role: string;
|
|
57
|
+
content: unknown;
|
|
58
|
+
tool_calls?: ToolCall[];
|
|
59
|
+
tool_call_id?: string;
|
|
60
|
+
}
|
|
61
|
+
export interface FlatSpan {
|
|
62
|
+
span: TraceSpan;
|
|
63
|
+
depth: number;
|
|
64
|
+
}
|
|
65
|
+
/** Per-row micro-stats surfaced by the transcript feed. Missing inputs collapse to 0/null, never NaN. */
|
|
66
|
+
export interface TranscriptRowStats {
|
|
67
|
+
inputTokens: number;
|
|
68
|
+
outputTokens: number;
|
|
69
|
+
/**
|
|
70
|
+
* Per-span own cost. `undefined` when the span has no individually-computed cost — the feed
|
|
71
|
+
* renders `—` then, never a fabricated `$0.0000` (M52 / looptrace#71 Finding 3). A real computed
|
|
72
|
+
* cost is a positive number.
|
|
73
|
+
*/
|
|
74
|
+
costUsd: number | undefined;
|
|
75
|
+
durationMs: number | null;
|
|
76
|
+
}
|
|
77
|
+
/** One row in the reader-mode transcript feed. */
|
|
78
|
+
export interface TranscriptRow {
|
|
79
|
+
kind: "span" | "group-header";
|
|
80
|
+
spanId: string;
|
|
81
|
+
role?: string;
|
|
82
|
+
preview?: string;
|
|
83
|
+
stats?: TranscriptRowStats;
|
|
84
|
+
groupId?: string;
|
|
85
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ComponentType, SVGProps } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* IconComponent — shape compatible with both lucide-react icons and custom React SVG components.
|
|
4
|
+
*
|
|
5
|
+
* Centralizing this here avoids TS2322 noise from `exactOptionalPropertyTypes` when mapping
|
|
6
|
+
* icons through Record<...> structures.
|
|
7
|
+
*/
|
|
8
|
+
export type IconComponent = ComponentType<SVGProps<SVGSVGElement> & {
|
|
9
|
+
className?: string;
|
|
10
|
+
}>;
|
package/dist/preset.css
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/* LoopScale UI — Tailwind v4 CSS preset.
|
|
2
|
+
*
|
|
3
|
+
* For consumers running their own Tailwind v4 build (TheoKit framework
|
|
4
|
+
* path, custom Vite/Astro/Next apps with @tailwindcss/vite, etc.). The
|
|
5
|
+
* preset pulls in:
|
|
6
|
+
* 1. `tokens.css` — runtime `--*` vars `<ThemeProvider>` mutates per
|
|
7
|
+
* theme cascade.
|
|
8
|
+
* 2. `tokens-v4.css` — the `@theme { --color-*, --font-*, --text-*,
|
|
9
|
+
* --radius-*, --shadow-*, --ease-*, --animate-* }` namespace
|
|
10
|
+
* Tailwind v4 actually reads to generate utilities.
|
|
11
|
+
*
|
|
12
|
+
* Consumer usage (their entry CSS):
|
|
13
|
+
*
|
|
14
|
+
* @import "tailwindcss";
|
|
15
|
+
* @import "@theokit/ui/preset.css";
|
|
16
|
+
*
|
|
17
|
+
* /* the consumer's own @theme overrides come AFTER, so they win. * /
|
|
18
|
+
*
|
|
19
|
+
* Tailwind v4 dropped the v3 JS preset format. The previous JS preset
|
|
20
|
+
* remains shipped under `@theokit/ui/preset-v3-legacy` (which works only
|
|
21
|
+
* with `tailwindcss@^3`). New v4 consumers MUST use this CSS preset.
|
|
22
|
+
*
|
|
23
|
+
* See RFC 0008 follow-up.
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
@import "./tokens.css";
|
|
27
|
+
@import "./tokens-v4.css";
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* LoopScale UI Tailwind preset — Violet Forge identity.
|
|
3
|
+
*
|
|
4
|
+
* Single source of truth for the design system's utility-level tokens:
|
|
5
|
+
* - colors mapped to CSS variables (HSL split via `hsl(var(--x) / <alpha>)`)
|
|
6
|
+
* - Geist-inspired typescale (display / title / body / label / code tiers)
|
|
7
|
+
* - radii, shadows, motion timing & duration, keyframes
|
|
8
|
+
* - tailwindcss-animate plugin
|
|
9
|
+
*
|
|
10
|
+
* Consumed by:
|
|
11
|
+
* - `tailwind.config.ts` (this repo) via `presets: [loopscaleUIPreset]`
|
|
12
|
+
* - registry/r/tailwind-preset.json (shipped to consumers via shadcn CLI)
|
|
13
|
+
*
|
|
14
|
+
* Consumers integrate as:
|
|
15
|
+
*
|
|
16
|
+
* import type { Config } from "tailwindcss";
|
|
17
|
+
* import { loopscaleUIPreset } from "./styles/tailwind-preset";
|
|
18
|
+
*
|
|
19
|
+
* export default {
|
|
20
|
+
* darkMode: "class",
|
|
21
|
+
* content: ["./src/**\/*.{ts,tsx}"],
|
|
22
|
+
* presets: [loopscaleUIPreset],
|
|
23
|
+
* } satisfies Config;
|
|
24
|
+
*
|
|
25
|
+
* Note: `darkMode` and `content` are NOT in the preset — they are consumer
|
|
26
|
+
* decisions. The preset only contains `theme.extend.*` and `plugins`.
|
|
27
|
+
*/
|
|
28
|
+
import type { Config } from "tailwindcss";
|
|
29
|
+
export declare const loopscaleUIPreset: Partial<Config>;
|