semiotic 3.5.4 → 3.7.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/CLAUDE.md +196 -175
- package/README.md +52 -15
- package/ai/cli.js +41 -0
- package/ai/componentMetadata.cjs +11 -2
- package/ai/dist/mcp-server.js +454 -4
- package/ai/examples.md +98 -0
- package/ai/schema.json +614 -9
- package/ai/system-prompt.md +5 -2
- package/dist/components/AccessibleNavTree.d.ts +25 -0
- package/dist/components/Annotation.d.ts +40 -14
- package/dist/components/ChartContainer.d.ts +32 -2
- package/dist/components/ai/annotationProvenance.d.ts +349 -0
- package/dist/components/ai/audienceProfile.d.ts +147 -0
- package/dist/components/ai/audiences.d.ts +31 -0
- package/dist/components/ai/chartCapabilities.d.ts +55 -0
- package/dist/components/ai/chartCapabilityTypes.d.ts +254 -0
- package/dist/components/ai/chartRoles.d.ts +27 -0
- package/dist/components/ai/conversationArc.d.ts +379 -0
- package/dist/components/ai/dataScaleProfile.d.ts +320 -0
- package/dist/components/ai/describeChart.d.ts +114 -0
- package/dist/components/ai/diffProfile.d.ts +51 -0
- package/dist/components/ai/inferIntent.d.ts +24 -0
- package/dist/components/ai/intents.d.ts +34 -0
- package/dist/components/ai/navigationTree.d.ts +45 -0
- package/dist/components/ai/profileData.d.ts +16 -0
- package/dist/components/ai/qualityFixtures.d.ts +2 -0
- package/dist/components/ai/qualityScorecard.d.ts +82 -0
- package/dist/components/ai/readerGrounding.d.ts +70 -0
- package/dist/components/ai/repairChartConfig.d.ts +73 -0
- package/dist/components/ai/streamingTypes.d.ts +64 -0
- package/dist/components/ai/suggestCharts.d.ts +109 -0
- package/dist/components/ai/suggestDashboard.d.ts +92 -0
- package/dist/components/ai/suggestStreamCharts.d.ts +34 -0
- package/dist/components/ai/suggestStretchCharts.d.ts +60 -0
- package/dist/components/ai/useChartSuggestions.d.ts +22 -0
- package/dist/components/ai/useConversationArc.d.ts +89 -0
- package/dist/components/ai/useNavigationSync.d.ts +61 -0
- package/dist/components/ai/variantDiscovery.d.ts +168 -0
- package/dist/components/charts/geo/ChoroplethMap.capability.d.ts +2 -0
- package/dist/components/charts/geo/DistanceCartogram.capability.d.ts +2 -0
- package/dist/components/charts/geo/FlowMap.capability.d.ts +2 -0
- package/dist/components/charts/geo/ProportionalSymbolMap.capability.d.ts +2 -0
- package/dist/components/charts/index.d.ts +1 -1
- package/dist/components/charts/network/ChordDiagram.capability.d.ts +2 -0
- package/dist/components/charts/network/CirclePack.capability.d.ts +2 -0
- package/dist/components/charts/network/ForceDirectedGraph.capability.d.ts +2 -0
- package/dist/components/charts/network/OrbitDiagram.capability.d.ts +2 -0
- package/dist/components/charts/network/ProcessSankey.capability.d.ts +2 -0
- package/dist/components/charts/network/SankeyDiagram.capability.d.ts +2 -0
- package/dist/components/charts/network/TreeDiagram.capability.d.ts +2 -0
- package/dist/components/charts/network/Treemap.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/BarChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/BoxPlot.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/DonutChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/DotPlot.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/FunnelChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/GaugeChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/GroupedBarChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/Histogram.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/Histogram.d.ts +4 -2
- package/dist/components/charts/ordinal/LikertChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/LikertChart.d.ts +1 -1
- package/dist/components/charts/ordinal/LikertChart.defaults.d.ts +1 -0
- package/dist/components/charts/ordinal/PieChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/RidgelinePlot.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/StackedBarChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/SwarmPlot.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/SwimlaneChart.capability.d.ts +2 -0
- package/dist/components/charts/ordinal/ViolinPlot.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeHeatmap.d.ts +3 -0
- package/dist/components/charts/realtime/RealtimeHistogram.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeHistogram.d.ts +3 -0
- package/dist/components/charts/realtime/RealtimeLineChart.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeLineChart.d.ts +3 -0
- package/dist/components/charts/realtime/RealtimeSwarmChart.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeSwarmChart.d.ts +3 -0
- package/dist/components/charts/realtime/RealtimeWaterfallChart.capability.d.ts +2 -0
- package/dist/components/charts/realtime/RealtimeWaterfallChart.d.ts +3 -0
- package/dist/components/charts/realtime/TemporalHistogram.capability.d.ts +7 -0
- package/dist/components/charts/shared/annotationHierarchy.d.ts +42 -0
- package/dist/components/charts/shared/annotationResolvers.d.ts +3 -2
- package/dist/components/charts/shared/annotationRules.d.ts +16 -0
- package/dist/components/charts/shared/annotationTypes.d.ts +14 -0
- package/dist/components/charts/shared/auditAccessibility.d.ts +90 -0
- package/dist/components/charts/shared/chartSpecs.d.ts +2 -37
- package/dist/components/charts/shared/diagnoseConfig.d.ts +4 -6
- package/dist/components/charts/shared/selectionUtils.d.ts +5 -2
- package/dist/components/charts/shared/streamPropsHelpers.d.ts +2 -0
- package/dist/components/charts/shared/types.d.ts +5 -1
- package/dist/components/charts/value/BigNumber.capability.d.ts +13 -0
- package/dist/components/charts/value/BigNumber.d.ts +14 -0
- package/dist/components/charts/value/formatting.d.ts +40 -0
- package/dist/components/charts/value/thresholdSparkline.d.ts +40 -0
- package/dist/components/charts/value/types.d.ts +292 -0
- package/dist/components/charts/xy/AreaChart.capability.d.ts +10 -0
- package/dist/components/charts/xy/BubbleChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/CandlestickChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/ConnectedScatterplot.capability.d.ts +2 -0
- package/dist/components/charts/xy/DifferenceChart.capability.d.ts +8 -0
- package/dist/components/charts/xy/Heatmap.capability.d.ts +9 -0
- package/dist/components/charts/xy/LineChart.capability.d.ts +9 -0
- package/dist/components/charts/xy/MinimapChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/MultiAxisLineChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/QuadrantChart.capability.d.ts +2 -0
- package/dist/components/charts/xy/QuadrantChart.d.ts +5 -2
- package/dist/components/charts/xy/QuadrantChart.defaults.d.ts +2 -0
- package/dist/components/charts/xy/Scatterplot.capability.d.ts +2 -0
- package/dist/components/charts/xy/StackedAreaChart.capability.d.ts +2 -0
- package/dist/components/data/DataSummarizer.d.ts +45 -0
- package/dist/components/realtime/lifecycleBands.d.ts +44 -0
- package/dist/components/realtime/types.d.ts +23 -8
- package/dist/components/recipes/annotationDensity.d.ts +69 -0
- package/dist/components/recipes/annotationLayout.d.ts +93 -0
- package/dist/components/semiotic-ai.d.ts +58 -0
- package/dist/components/semiotic-realtime.d.ts +2 -0
- package/dist/components/semiotic-recipes.d.ts +4 -0
- package/dist/components/semiotic-utils.d.ts +8 -0
- package/dist/components/semiotic-value.d.ts +55 -0
- package/dist/components/semiotic-xy.d.ts +1 -1
- package/dist/components/semiotic.d.ts +8 -1
- package/dist/components/server/staticAnnotations.d.ts +2 -0
- package/dist/components/store/useChartFocus.d.ts +43 -0
- package/dist/components/store/useChartInterrogation.d.ts +141 -0
- package/dist/components/stream/AccessibleDataTable.d.ts +10 -1
- package/dist/components/stream/NetworkSVGOverlay.d.ts +11 -5
- package/dist/components/stream/OrdinalSVGOverlay.d.ts +2 -0
- package/dist/components/stream/SVGOverlay.d.ts +2 -0
- package/dist/components/stream/geoTypes.d.ts +3 -0
- package/dist/components/stream/networkTypes.d.ts +2 -0
- package/dist/components/stream/ordinalTypes.d.ts +2 -0
- package/dist/components/stream/types.d.ts +2 -0
- package/dist/geo.min.js +1 -1
- package/dist/geo.module.min.js +1 -1
- package/dist/network.min.js +1 -1
- package/dist/network.module.min.js +1 -1
- package/dist/ordinal.min.js +1 -1
- package/dist/ordinal.module.min.js +1 -1
- package/dist/realtime.min.js +1 -1
- package/dist/realtime.module.min.js +1 -1
- package/dist/semiotic-ai.d.ts +58 -0
- package/dist/semiotic-ai.min.js +1 -1
- package/dist/semiotic-ai.module.min.js +1 -1
- package/dist/semiotic-realtime.d.ts +2 -0
- package/dist/semiotic-recipes.d.ts +4 -0
- package/dist/semiotic-recipes.min.js +1 -1
- package/dist/semiotic-recipes.module.min.js +1 -1
- package/dist/semiotic-themes.min.js +1 -1
- package/dist/semiotic-themes.module.min.js +1 -1
- package/dist/semiotic-utils.d.ts +8 -0
- package/dist/semiotic-utils.min.js +1 -1
- package/dist/semiotic-utils.module.min.js +1 -1
- package/dist/semiotic-value.d.ts +55 -0
- package/dist/semiotic-value.min.js +2 -0
- package/dist/semiotic-value.module.min.js +2 -0
- package/dist/semiotic-xy.d.ts +1 -1
- package/dist/semiotic.d.ts +8 -1
- package/dist/semiotic.min.js +1 -1
- package/dist/semiotic.module.min.js +1 -1
- package/dist/server.min.js +1 -1
- package/dist/server.module.min.js +1 -1
- package/dist/xy.min.js +1 -1
- package/dist/xy.module.min.js +1 -1
- package/package.json +28 -5
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { Datum } from "../charts/shared/datumTypes";
|
|
2
|
+
import type { ChartCapability } from "./chartCapabilityTypes";
|
|
3
|
+
import type { IntentId } from "./intents";
|
|
4
|
+
/**
|
|
5
|
+
* One canonical fixture in a scorecard run. Pair canonical data with the
|
|
6
|
+
* intents/components a human expert would expect to win on it. Use null
|
|
7
|
+
* `expected` when the fixture is a stress-test that should produce no
|
|
8
|
+
* fitting chart at all (e.g. flat single-column data, broken GeoJSON).
|
|
9
|
+
*/
|
|
10
|
+
export interface ScorecardFixture {
|
|
11
|
+
name: string;
|
|
12
|
+
/** Free-text shape description, used in scorecard output for context. */
|
|
13
|
+
shape?: string;
|
|
14
|
+
data: ReadonlyArray<Datum>;
|
|
15
|
+
/** Optional non-tabular payload (network/hierarchy/GeoJSON). */
|
|
16
|
+
rawInput?: unknown;
|
|
17
|
+
/** Intent to rank by. If omitted, scored without intent (mean-of-all). */
|
|
18
|
+
intent?: IntentId;
|
|
19
|
+
/** Components the human expert would pick. Empty = "anything fits". */
|
|
20
|
+
expected?: ReadonlyArray<string>;
|
|
21
|
+
/** True if the fixture should produce zero fitting suggestions. Mutually exclusive with `expected`. */
|
|
22
|
+
expectsNoFit?: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface PerCapabilityScore {
|
|
25
|
+
component: string;
|
|
26
|
+
family: ChartCapability["family"];
|
|
27
|
+
/** Number of fixtures where this capability fit. */
|
|
28
|
+
fitsOn: number;
|
|
29
|
+
/** Number of fixtures where this capability was rejected. */
|
|
30
|
+
rejectedOn: number;
|
|
31
|
+
/** Number of fixtures where this capability appeared in the top-3 ranked suggestions. */
|
|
32
|
+
inTopThreeOn: number;
|
|
33
|
+
/** Fixtures where the human expert picked this chart AND it was in top-3 ranking. */
|
|
34
|
+
expertAgreementCount: number;
|
|
35
|
+
/** Mean composite score across fixtures where it fit. */
|
|
36
|
+
averageScore: number;
|
|
37
|
+
/** Fraction of suggestions that included at least one caveat. */
|
|
38
|
+
caveatCoverage: number;
|
|
39
|
+
/** Fraction of suggestions that picked a non-base variant. */
|
|
40
|
+
variantUtilization: number;
|
|
41
|
+
}
|
|
42
|
+
export interface PerFixtureScore {
|
|
43
|
+
fixture: string;
|
|
44
|
+
shape?: string;
|
|
45
|
+
intent?: IntentId;
|
|
46
|
+
expected?: ReadonlyArray<string>;
|
|
47
|
+
topPick?: {
|
|
48
|
+
component: string;
|
|
49
|
+
variantKey?: string;
|
|
50
|
+
score: number;
|
|
51
|
+
};
|
|
52
|
+
topThree: ReadonlyArray<{
|
|
53
|
+
component: string;
|
|
54
|
+
variantKey?: string;
|
|
55
|
+
score: number;
|
|
56
|
+
}>;
|
|
57
|
+
fittingCount: number;
|
|
58
|
+
rejectedCount: number;
|
|
59
|
+
/** True if the top-3 ranking contained at least one expected component (when expected is provided). */
|
|
60
|
+
expertAgreement: boolean | null;
|
|
61
|
+
/** Did the engine honor `expectsNoFit`? */
|
|
62
|
+
noFitHonored: boolean | null;
|
|
63
|
+
}
|
|
64
|
+
export interface ScorecardReport {
|
|
65
|
+
perCapability: PerCapabilityScore[];
|
|
66
|
+
perFixture: PerFixtureScore[];
|
|
67
|
+
summary: {
|
|
68
|
+
fixtureCount: number;
|
|
69
|
+
capabilityCount: number;
|
|
70
|
+
/** Fraction of expectation-bearing fixtures where the engine agreed with the expert. */
|
|
71
|
+
expertAgreementRate: number;
|
|
72
|
+
/** Average caveat coverage across all suggestions. */
|
|
73
|
+
overallCaveatCoverage: number;
|
|
74
|
+
/** Average variant utilization across all suggestions. */
|
|
75
|
+
overallVariantUtilization: number;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Run the scorecard. Pure — does no I/O — so it can be called from CI scripts,
|
|
80
|
+
* vizmart UIs, or test suites.
|
|
81
|
+
*/
|
|
82
|
+
export declare function runQualityScorecard(fixtures: ReadonlyArray<ScorecardFixture>, capabilities?: ReadonlyArray<ChartCapability>): ScorecardReport;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { Datum } from "../charts/shared/datumTypes";
|
|
2
|
+
import { type DescribeChartResult, type DescribeLevel, type DescribeCapabilityContext, type CommunicativeAct } from "./describeChart";
|
|
3
|
+
import { type NavTreeNode } from "./navigationTree";
|
|
4
|
+
import type { ChartCapability, ChartFamily } from "./chartCapabilityTypes";
|
|
5
|
+
import type { IntentId } from "./intents";
|
|
6
|
+
import type { AudienceProfile } from "./audienceProfile";
|
|
7
|
+
/**
|
|
8
|
+
* buildReaderGrounding — the single payload an AI agent reads to interpret a
|
|
9
|
+
* chart faithfully, without seeing the pixels. It composes the three reception
|
|
10
|
+
* artifacts the accessibility layer already builds:
|
|
11
|
+
*
|
|
12
|
+
* • {@link describeChart} L1–L3 — encoding, statistics, and trend.
|
|
13
|
+
* • the L4 *communicative act* — what the chart is asking the reader to do
|
|
14
|
+
* (the intent metadata that lives in each `*.capability.ts`).
|
|
15
|
+
* • {@link buildNavigationTree} — the structured chart → axes/series → datum
|
|
16
|
+
* tree the agent (or a screen reader) traverses.
|
|
17
|
+
*
|
|
18
|
+
* It's the reader-side complement to the author-side capability descriptor: the
|
|
19
|
+
* descriptor says how a chart *should* be used; this says how a given chart
|
|
20
|
+
* instance *reads*. Position it as the documented "render evidence" an LLM
|
|
21
|
+
* consumes — the non-visual reader and the AI reader are the same consumer.
|
|
22
|
+
*
|
|
23
|
+
* Pure and SSR-safe (the capability/audience inputs are type-only).
|
|
24
|
+
*/
|
|
25
|
+
export interface ChartReaderGroundingOptions {
|
|
26
|
+
/**
|
|
27
|
+
* Intent context powering the L4 communicative-act sentence — a chart's
|
|
28
|
+
* capability descriptor or a resolved {@link DescribeCapabilityContext}
|
|
29
|
+
* (e.g. a `Suggestion`'s `{ family, intentScores }`). Optional: without it
|
|
30
|
+
* the act is inferred from the component's family, best-effort.
|
|
31
|
+
*/
|
|
32
|
+
capability?: ChartCapability | DescribeCapabilityContext;
|
|
33
|
+
/** Audience profile — tunes the L4 sentence for reception (low familiarity → orienting nudge). */
|
|
34
|
+
audience?: AudienceProfile;
|
|
35
|
+
/** Locale for number formatting. Default "en". */
|
|
36
|
+
locale?: string;
|
|
37
|
+
/** Levels for the prose description. Default ["l1","l2","l3"] (L4 is carried in `intent`). */
|
|
38
|
+
levels?: DescribeLevel[];
|
|
39
|
+
/** Cap navigation-tree leaves per branch. Forwarded to buildNavigationTree (default 200). */
|
|
40
|
+
maxLeaves?: number;
|
|
41
|
+
/** Skip the navigation structure (e.g. to save tokens). Default false. */
|
|
42
|
+
includeStructure?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface ChartReaderGroundingIntent {
|
|
45
|
+
/** The communicative act the chart performs. */
|
|
46
|
+
act: CommunicativeAct;
|
|
47
|
+
/** The L4 illocutionary sentence ("This is an alerting chart; …"). */
|
|
48
|
+
sentence: string;
|
|
49
|
+
/** Chart family, when known from the supplied context. */
|
|
50
|
+
family?: ChartFamily;
|
|
51
|
+
/** Resolved per-intent scores, when the caller passed them (not from a raw descriptor). */
|
|
52
|
+
intentScores?: Partial<Record<IntentId, number>>;
|
|
53
|
+
}
|
|
54
|
+
export interface ChartReaderGrounding {
|
|
55
|
+
component: string;
|
|
56
|
+
/** Layered L1–L3 description ({ text, levels }). */
|
|
57
|
+
description: DescribeChartResult;
|
|
58
|
+
/** Communicative act + L4 sentence, when an act could be resolved. */
|
|
59
|
+
intent?: ChartReaderGroundingIntent;
|
|
60
|
+
/** Structured navigation tree (chart → axes/series → datum). Omitted when `includeStructure: false`. */
|
|
61
|
+
structure?: NavTreeNode;
|
|
62
|
+
/** L1–L4 joined into one prose blob an LLM can read directly. */
|
|
63
|
+
text: string;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Build the combined reader-grounding payload for a chart config. See the
|
|
67
|
+
* module docstring; pass a `capability` (or a resolved context) for the most
|
|
68
|
+
* precise L4 act, an `audience` for reception tuning.
|
|
69
|
+
*/
|
|
70
|
+
export declare function buildReaderGrounding(component: string, props: Datum, options?: ChartReaderGroundingOptions): ChartReaderGrounding;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { Datum } from "../charts/shared/datumTypes";
|
|
2
|
+
import type { ChartDataProfile, Suggestion } from "./chartCapabilityTypes";
|
|
3
|
+
import type { IntentId } from "./intents";
|
|
4
|
+
/**
|
|
5
|
+
* Repair result when the chosen chart fits the data — nothing to fix.
|
|
6
|
+
*/
|
|
7
|
+
export interface RepairOkResult {
|
|
8
|
+
status: "ok";
|
|
9
|
+
component: string;
|
|
10
|
+
/** The same data profile that was evaluated. */
|
|
11
|
+
profile: ChartDataProfile;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Repair result when the chosen chart doesn't fit. Carries the diagnostic
|
|
15
|
+
* reason from the capability's `fits()` plus ranked alternatives that *do*
|
|
16
|
+
* fit, with their reasons surfaced for caller narration.
|
|
17
|
+
*/
|
|
18
|
+
export interface RepairAlternativeResult {
|
|
19
|
+
status: "alternative";
|
|
20
|
+
/** The component the caller asked about. */
|
|
21
|
+
component: string;
|
|
22
|
+
/** Why it doesn't fit. */
|
|
23
|
+
reason: string;
|
|
24
|
+
/** Whether the caller intended one of the alternatives anyway. */
|
|
25
|
+
alternatives: Suggestion[];
|
|
26
|
+
profile: ChartDataProfile;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Repair result when no capability is registered for the asked component.
|
|
30
|
+
*/
|
|
31
|
+
export interface RepairUnknownResult {
|
|
32
|
+
status: "unknown";
|
|
33
|
+
component: string;
|
|
34
|
+
/** Closest matches by family/intent — best effort. */
|
|
35
|
+
alternatives: Suggestion[];
|
|
36
|
+
profile: ChartDataProfile;
|
|
37
|
+
}
|
|
38
|
+
export type RepairResult = RepairOkResult | RepairAlternativeResult | RepairUnknownResult;
|
|
39
|
+
export interface RepairOptions {
|
|
40
|
+
/** Caller's intent — informs ranking of alternatives when the chart doesn't fit. */
|
|
41
|
+
intent?: IntentId | IntentId[];
|
|
42
|
+
/** Non-tabular payload (network/hierarchy/GeoJSON). Forwarded to profileData. */
|
|
43
|
+
rawInput?: unknown;
|
|
44
|
+
/** Limit number of alternatives returned (default 3). */
|
|
45
|
+
maxAlternatives?: number;
|
|
46
|
+
/** Pre-computed profile, avoids recomputation. */
|
|
47
|
+
profile?: ChartDataProfile;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Validate that a chart component is a sensible choice for a dataset, and
|
|
51
|
+
* if not, propose alternatives that *do* fit — ranked by the caller's
|
|
52
|
+
* intent if provided.
|
|
53
|
+
*
|
|
54
|
+
* This is the "auto-fix" surface for `--doctor` and agent retry loops.
|
|
55
|
+
* Given a chart + data, returns either:
|
|
56
|
+
*
|
|
57
|
+
* - { status: "ok", component } — the chart fits, ship it
|
|
58
|
+
* - { status: "alternative", reason, alternatives } — the chart doesn't
|
|
59
|
+
* fit; here are charts that do, ranked by intent if specified
|
|
60
|
+
* - { status: "unknown", alternatives } — we don't have a
|
|
61
|
+
* capability for that component name; here are sensible defaults
|
|
62
|
+
*
|
|
63
|
+
* The contract: a caller can always render `alternatives[0]` and get
|
|
64
|
+
* something useful. The `reason` field is suitable for verbatim display
|
|
65
|
+
* to the user.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* repairChartConfig("PieChart", productData, { intent: "rank" })
|
|
69
|
+
* // → { status: "alternative",
|
|
70
|
+
* // reason: "9 slices is too many for a pie chart",
|
|
71
|
+
* // alternatives: [BarChart, DotPlot, ...] }
|
|
72
|
+
*/
|
|
73
|
+
export declare function repairChartConfig(component: string, data: ReadonlyArray<Datum> | null | undefined, options?: RepairOptions): RepairResult;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { ChartRubric } from "./chartCapabilityTypes";
|
|
2
|
+
import type { IntentId } from "./intents";
|
|
3
|
+
/**
|
|
4
|
+
* Streaming chart selection has a different shape than static. We don't have
|
|
5
|
+
* rows yet — we have a *schema*: which fields will arrive, what types, plus
|
|
6
|
+
* environment hints (throughput, retention).
|
|
7
|
+
*
|
|
8
|
+
* Rather than overloading `profileData` (which is row-statistics-centric) we
|
|
9
|
+
* model streams as a parallel API. The two share the intent vocabulary —
|
|
10
|
+
* "trend" still means trend — but the suitability logic is its own thing.
|
|
11
|
+
*/
|
|
12
|
+
export type StreamFieldKind = "numeric" | "categorical" | "date" | "boolean";
|
|
13
|
+
export interface StreamFieldSchema {
|
|
14
|
+
name: string;
|
|
15
|
+
kind: StreamFieldKind;
|
|
16
|
+
/** Optional role hint — overrides the engine's inference. */
|
|
17
|
+
role?: "x" | "y" | "value" | "category" | "series" | "size";
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Schema describing what a stream emits. No data, just shape + environment hints.
|
|
21
|
+
*/
|
|
22
|
+
export interface StreamSchema {
|
|
23
|
+
fields: ReadonlyArray<StreamFieldSchema>;
|
|
24
|
+
/**
|
|
25
|
+
* Hint about expected event rate. Affects chart selection — heatmaps and
|
|
26
|
+
* waterfalls amortize high-throughput streams better than line charts do.
|
|
27
|
+
* • "low" — < 1 event/sec, line/area charts read well
|
|
28
|
+
* • "medium" — ~1-100 events/sec
|
|
29
|
+
* • "high" — > 100 events/sec, prefer aggregating visualizations
|
|
30
|
+
*/
|
|
31
|
+
throughput?: "low" | "medium" | "high";
|
|
32
|
+
/**
|
|
33
|
+
* Hint about how long events are kept in view.
|
|
34
|
+
* • "windowed" — only recent events visible (default)
|
|
35
|
+
* • "cumulative" — all events accumulate
|
|
36
|
+
*/
|
|
37
|
+
retention?: "windowed" | "cumulative";
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Stream capability descriptor — parallel to ChartCapability but operates on
|
|
41
|
+
* a schema. No `fits(profile)`; instead `fits(schema)` returns null/reason.
|
|
42
|
+
*/
|
|
43
|
+
export interface StreamChartCapability {
|
|
44
|
+
component: string;
|
|
45
|
+
importPath: "semiotic/realtime";
|
|
46
|
+
rubric: ChartRubric;
|
|
47
|
+
fits: (schema: StreamSchema) => null | string;
|
|
48
|
+
intentScores: Partial<Record<IntentId, StreamIntentScorer>>;
|
|
49
|
+
caveats?: (schema: StreamSchema) => ReadonlyArray<string>;
|
|
50
|
+
buildProps: (schema: StreamSchema) => Record<string, unknown>;
|
|
51
|
+
}
|
|
52
|
+
export type StreamIntentScorer = number | ((schema: StreamSchema) => number);
|
|
53
|
+
export interface StreamSuggestion {
|
|
54
|
+
component: string;
|
|
55
|
+
family: "realtime";
|
|
56
|
+
importPath: "semiotic/realtime";
|
|
57
|
+
score: number;
|
|
58
|
+
intentScores: Partial<Record<IntentId, number>>;
|
|
59
|
+
rubric: ChartRubric;
|
|
60
|
+
reasons: ReadonlyArray<string>;
|
|
61
|
+
caveats: ReadonlyArray<string>;
|
|
62
|
+
/** Props ready to spread into the matching realtime chart. */
|
|
63
|
+
props: Record<string, unknown>;
|
|
64
|
+
}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import type { Datum } from "../charts/shared/datumTypes";
|
|
2
|
+
import { type ProfileDataOptions } from "./profileData";
|
|
3
|
+
import type { ChartCapability, ChartDataProfile, ScaledSuggestionGroups, Suggestion } from "./chartCapabilityTypes";
|
|
4
|
+
import type { IntentId } from "./intents";
|
|
5
|
+
import { type AudienceProfile } from "./audienceProfile";
|
|
6
|
+
import { type DataQualityProfile, type DataScaleProfile } from "./dataScaleProfile";
|
|
7
|
+
export interface SuggestChartsOptions extends ProfileDataOptions {
|
|
8
|
+
/** Ranking intent(s). When omitted, suggestions are ranked by mean intent score. */
|
|
9
|
+
intent?: IntentId | IntentId[];
|
|
10
|
+
/** Restrict to these component names. */
|
|
11
|
+
allow?: ReadonlyArray<string>;
|
|
12
|
+
/** Exclude these component names. */
|
|
13
|
+
deny?: ReadonlyArray<string>;
|
|
14
|
+
/** Maximum suggestions to return (default 10). */
|
|
15
|
+
maxResults?: number;
|
|
16
|
+
/** Include variant-level suggestions (default true). */
|
|
17
|
+
includeVariants?: boolean;
|
|
18
|
+
/** Filter out suggestions with a composite score below this (default 0 — keep all). */
|
|
19
|
+
minScore?: number;
|
|
20
|
+
/** Provide a pre-built profile instead of re-deriving from data. */
|
|
21
|
+
profile?: ChartDataProfile;
|
|
22
|
+
/** Override the registry. Defaults to the global capability registry. */
|
|
23
|
+
capabilities?: ReadonlyArray<ChartCapability>;
|
|
24
|
+
/**
|
|
25
|
+
* Audience profile — overrides chart familiarity and applies adoption-target
|
|
26
|
+
* bias to the ranking. See `audienceProfile.ts`.
|
|
27
|
+
*/
|
|
28
|
+
audience?: AudienceProfile;
|
|
29
|
+
/**
|
|
30
|
+
* Forward-looking declaration of the dataset's scale (row count, cardinality,
|
|
31
|
+
* field count, growth mode). When provided, the engine biases recommendations
|
|
32
|
+
* toward charts that work at the declared scale rather than the sample size.
|
|
33
|
+
* See `dataScaleProfile.ts`.
|
|
34
|
+
*/
|
|
35
|
+
scale?: DataScaleProfile;
|
|
36
|
+
/**
|
|
37
|
+
* Declaration of the dataset's quality (completeness, outliers, type
|
|
38
|
+
* heterogeneity). Affects caveats and biases score modestly. See
|
|
39
|
+
* `dataScaleProfile.ts`.
|
|
40
|
+
*/
|
|
41
|
+
quality?: DataQualityProfile;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Suggest charts for a dataset, ranked by intent suitability.
|
|
45
|
+
*
|
|
46
|
+
* Heuristic-only — does not call an LLM. Designed to be cheap enough to run on every
|
|
47
|
+
* keystroke in a UI, and to feed structured context to an LLM when one is available.
|
|
48
|
+
*/
|
|
49
|
+
export declare function suggestCharts(data: ReadonlyArray<Datum> | null | undefined, options?: SuggestChartsOptions): Suggestion[];
|
|
50
|
+
/**
|
|
51
|
+
* One rejected capability: a chart whose `fits()` returned a reason.
|
|
52
|
+
* Surfaced by `explainCapabilityFit` for diagnostic panels and `--doctor` auto-fix.
|
|
53
|
+
*/
|
|
54
|
+
export interface RejectedCapability {
|
|
55
|
+
component: string;
|
|
56
|
+
family: ChartCapability["family"];
|
|
57
|
+
importPath: ChartCapability["importPath"];
|
|
58
|
+
/** Human-readable reason this chart can't render this profile. */
|
|
59
|
+
reason: string;
|
|
60
|
+
}
|
|
61
|
+
export interface ExplainCapabilityFitResult {
|
|
62
|
+
/** Capabilities that fit the profile — full ranked suggestion list. */
|
|
63
|
+
fitting: Suggestion[];
|
|
64
|
+
/** Capabilities that did not fit, with their rejection reasons. */
|
|
65
|
+
rejected: RejectedCapability[];
|
|
66
|
+
/** The profile that was evaluated against (provided or computed). */
|
|
67
|
+
profile: ChartDataProfile;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Like `suggestCharts`, but also returns the capabilities that *didn't* fit
|
|
71
|
+
* along with their rejection reasons. The single best primitive for:
|
|
72
|
+
* • "Why isn't there a pie chart option?" UI surfaces (vizmart V.4)
|
|
73
|
+
* • `--doctor` auto-fix loops that need to enumerate alternatives
|
|
74
|
+
* • Descriptor authoring — quickly see whose `fits()` is too strict
|
|
75
|
+
*
|
|
76
|
+
* Mirrors `suggestCharts` for the fitting side. Rejection enumeration walks
|
|
77
|
+
* every registered capability whether it fits or not.
|
|
78
|
+
*/
|
|
79
|
+
export declare function explainCapabilityFit(data: ReadonlyArray<Datum> | null | undefined, options?: SuggestChartsOptions): ExplainCapabilityFitResult;
|
|
80
|
+
/**
|
|
81
|
+
* Score a specific (component, variant) pair against a dataset and (optionally) an intent.
|
|
82
|
+
* Useful for evaluating a chart a user already chose: "is this a good fit for what they want?"
|
|
83
|
+
*/
|
|
84
|
+
export declare function scoreChart(component: string, data: ReadonlyArray<Datum> | null | undefined, options?: {
|
|
85
|
+
intent?: IntentId | IntentId[];
|
|
86
|
+
variantKey?: string;
|
|
87
|
+
profile?: ChartDataProfile;
|
|
88
|
+
}): Suggestion | {
|
|
89
|
+
reason: string;
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* Return suggestions grouped by scale band. The "graduation of views" surface:
|
|
93
|
+
* the same data + intent can produce different chart recommendations depending
|
|
94
|
+
* on the row band you optimize for. Useful for narratives like
|
|
95
|
+
* "now → at 10× → at 100×" or for picking the right chart for a sample vs the
|
|
96
|
+
* production dataset.
|
|
97
|
+
*
|
|
98
|
+
* Behavior: runs `suggestCharts` five times (once per band — tiny/small/medium/
|
|
99
|
+
* large/huge), pinning the row band on each pass while keeping all other
|
|
100
|
+
* options stable. Each band returns its own ranked list. The same chart can
|
|
101
|
+
* appear in multiple bands when its sweet spot spans them.
|
|
102
|
+
*
|
|
103
|
+
* The single `effective` value on the return is computed from the *original*
|
|
104
|
+
* options (declared scale or measured profile), so callers can detect which
|
|
105
|
+
* band the user's actual data lives in and highlight that tier.
|
|
106
|
+
*/
|
|
107
|
+
export declare function suggestChartsGrouped(data: ReadonlyArray<Datum> | null | undefined, options?: SuggestChartsOptions & {
|
|
108
|
+
maxPerBand?: number;
|
|
109
|
+
}): ScaledSuggestionGroups;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import type { Datum } from "../charts/shared/datumTypes";
|
|
2
|
+
import { type StretchSuggestion } from "./suggestStretchCharts";
|
|
3
|
+
import type { ChartDataProfile, Suggestion } from "./chartCapabilityTypes";
|
|
4
|
+
import type { IntentId } from "./intents";
|
|
5
|
+
import type { AudienceProfile } from "./audienceProfile";
|
|
6
|
+
/**
|
|
7
|
+
* One panel in a generated dashboard. Pairs a chart suggestion with the
|
|
8
|
+
* intent that motivated it — consumers render the suggestion and label it
|
|
9
|
+
* with the intent so readers know *why* that panel exists.
|
|
10
|
+
*/
|
|
11
|
+
export interface DashboardPanel {
|
|
12
|
+
/** The intent this panel covers. */
|
|
13
|
+
intent: IntentId;
|
|
14
|
+
/** The chart picked for that intent. */
|
|
15
|
+
suggestion: Suggestion;
|
|
16
|
+
}
|
|
17
|
+
export interface DashboardSuggestion {
|
|
18
|
+
/** Ordered panels, each covering a distinct intent. */
|
|
19
|
+
panels: DashboardPanel[];
|
|
20
|
+
/** Intents the engine actually filled. */
|
|
21
|
+
intentsCovered: IntentId[];
|
|
22
|
+
/** Intents the engine couldn't fill from this data. */
|
|
23
|
+
intentsMissing: IntentId[];
|
|
24
|
+
/**
|
|
25
|
+
* Stretch panels — unfamiliar-but-fitting charts the audience could grow
|
|
26
|
+
* into. Empty when no `audience` is provided or `exposureLevel` is 0.
|
|
27
|
+
* Render alongside the main panels in a distinct surface so users see
|
|
28
|
+
* them as opt-in literacy growth, not silent defaults.
|
|
29
|
+
*/
|
|
30
|
+
stretchPanels: StretchSuggestion[];
|
|
31
|
+
/** The shape profile (computed once, reused for every panel). */
|
|
32
|
+
profile: ChartDataProfile;
|
|
33
|
+
}
|
|
34
|
+
export interface SuggestDashboardOptions {
|
|
35
|
+
/**
|
|
36
|
+
* Intents to attempt. When omitted, the engine picks a sensible default set
|
|
37
|
+
* based on the data shape (e.g. if `hasTimeAxis`, include "trend"; if
|
|
38
|
+
* `categoryCount`, include "rank" and "part-to-whole").
|
|
39
|
+
*/
|
|
40
|
+
intents?: ReadonlyArray<IntentId>;
|
|
41
|
+
/** Maximum number of panels. Default 6. */
|
|
42
|
+
maxPanels?: number;
|
|
43
|
+
/**
|
|
44
|
+
* When true (default), prefer not to repeat the same chart family across
|
|
45
|
+
* panels — produces a more varied dashboard. Set false to allow duplicates.
|
|
46
|
+
*/
|
|
47
|
+
diversifyByFamily?: boolean;
|
|
48
|
+
/** Allow only these component names. */
|
|
49
|
+
allow?: ReadonlyArray<string>;
|
|
50
|
+
/** Exclude these component names. */
|
|
51
|
+
deny?: ReadonlyArray<string>;
|
|
52
|
+
/** Optional pre-built profile (avoids recomputation). */
|
|
53
|
+
profile?: ChartDataProfile;
|
|
54
|
+
/** Non-tabular payload — forwarded to profileData. */
|
|
55
|
+
rawInput?: unknown;
|
|
56
|
+
/**
|
|
57
|
+
* Audience profile — applies familiarity overrides and adoption-target bias
|
|
58
|
+
* to every panel's ranking. When set with `exposureLevel >= 1`, the dashboard
|
|
59
|
+
* additionally returns `stretchPanels` showing unfamiliar-but-fitting charts.
|
|
60
|
+
*/
|
|
61
|
+
audience?: AudienceProfile;
|
|
62
|
+
/** Max stretch panels (default min(maxPanels, 3)). */
|
|
63
|
+
maxStretchPanels?: number;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Generate a dashboard: a set of complementary chart panels, each
|
|
67
|
+
* answering a distinct analytical intent on the same dataset.
|
|
68
|
+
*
|
|
69
|
+
* The contract: every panel has a stated `intent` and a suggestion that
|
|
70
|
+
* fits that intent. The engine diversifies by chart family by default to
|
|
71
|
+
* avoid "every panel is a bar chart" outcomes. Intents that can't be
|
|
72
|
+
* filled from the data (e.g. "geo" on row data with no lat/lon) are
|
|
73
|
+
* reported in `intentsMissing` so consumers can show "no fit for geo
|
|
74
|
+
* here" rather than silently dropping them.
|
|
75
|
+
*
|
|
76
|
+
* Heuristic only — no LLM call. The result is suitable for direct
|
|
77
|
+
* rendering (each panel's `suggestion.props` is spreadable into the
|
|
78
|
+
* matching chart) or for piping to an LLM as composition context.
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* const { panels } = suggestDashboard(data)
|
|
82
|
+
* return (
|
|
83
|
+
* <Grid>
|
|
84
|
+
* {panels.map(({ intent, suggestion }) => (
|
|
85
|
+
* <Panel key={intent} title={intent}>
|
|
86
|
+
* <DynamicChart component={suggestion.component} props={suggestion.props} />
|
|
87
|
+
* </Panel>
|
|
88
|
+
* ))}
|
|
89
|
+
* </Grid>
|
|
90
|
+
* )
|
|
91
|
+
*/
|
|
92
|
+
export declare function suggestDashboard(data: ReadonlyArray<Datum> | null | undefined, options?: SuggestDashboardOptions): DashboardSuggestion;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { StreamChartCapability, StreamSchema, StreamSuggestion } from "./streamingTypes";
|
|
2
|
+
import type { IntentId } from "./intents";
|
|
3
|
+
export declare function registerStreamChartCapability(capability: StreamChartCapability): void;
|
|
4
|
+
export declare function unregisterStreamChartCapability(component: string): void;
|
|
5
|
+
export declare function getStreamCapabilities(): ReadonlyArray<StreamChartCapability>;
|
|
6
|
+
export interface SuggestStreamChartsOptions {
|
|
7
|
+
intent?: IntentId | IntentId[];
|
|
8
|
+
allow?: ReadonlyArray<string>;
|
|
9
|
+
deny?: ReadonlyArray<string>;
|
|
10
|
+
maxResults?: number;
|
|
11
|
+
minScore?: number;
|
|
12
|
+
capabilities?: ReadonlyArray<StreamChartCapability>;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Suggest realtime charts for a schema, ranked by intent.
|
|
16
|
+
*
|
|
17
|
+
* Parallel to `suggestCharts` but operates on a `StreamSchema` (fields +
|
|
18
|
+
* throughput/retention hints) rather than row data. Use for live dashboards,
|
|
19
|
+
* monitoring views, anywhere events arrive over time rather than as a bounded
|
|
20
|
+
* table.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* const suggestions = suggestStreamCharts({
|
|
24
|
+
* fields: [
|
|
25
|
+
* { name: "ts", kind: "date" },
|
|
26
|
+
* { name: "latency_ms", kind: "numeric" },
|
|
27
|
+
* { name: "endpoint", kind: "categorical" },
|
|
28
|
+
* ],
|
|
29
|
+
* throughput: "high",
|
|
30
|
+
* retention: "windowed",
|
|
31
|
+
* }, { intent: "trend" })
|
|
32
|
+
* // → [{ component: "RealtimeHeatmap", ... }, { component: "RealtimeWaterfallChart", ... }]
|
|
33
|
+
*/
|
|
34
|
+
export declare function suggestStreamCharts(schema: StreamSchema, options?: SuggestStreamChartsOptions): StreamSuggestion[];
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { Datum } from "../charts/shared/datumTypes";
|
|
2
|
+
import type { ChartDataProfile, Suggestion } from "./chartCapabilityTypes";
|
|
3
|
+
import type { IntentId } from "./intents";
|
|
4
|
+
import { type AudienceProfile } from "./audienceProfile";
|
|
5
|
+
/**
|
|
6
|
+
* A "stretch pick" — an unfamiliar-but-fitting chart paired with the
|
|
7
|
+
* familiar chart it could substitute for. Pairing makes the literacy
|
|
8
|
+
* suggestion concrete: "instead of BarChart, try BoxPlot here, because…"
|
|
9
|
+
*/
|
|
10
|
+
export interface StretchSuggestion {
|
|
11
|
+
/** The unfamiliar chart we're suggesting as growth. */
|
|
12
|
+
suggestion: Suggestion;
|
|
13
|
+
/**
|
|
14
|
+
* The familiar chart this stretch could replace for the same intent.
|
|
15
|
+
* Undefined when the stretch is recommended on its own merits (e.g. a
|
|
16
|
+
* direct "increase" target with no obvious familiar counterpart).
|
|
17
|
+
*/
|
|
18
|
+
replacing?: string;
|
|
19
|
+
/** Human-readable rationale, suitable for verbatim display. */
|
|
20
|
+
rationale: string;
|
|
21
|
+
/** Audience familiarity for this chart — the number that made it qualify as a stretch. */
|
|
22
|
+
familiarity: number;
|
|
23
|
+
}
|
|
24
|
+
export interface SuggestStretchChartsOptions {
|
|
25
|
+
/** Intent(s) to rank by. When omitted, charts are picked by data fit alone. */
|
|
26
|
+
intent?: IntentId | IntentId[];
|
|
27
|
+
/** Required — without an audience profile, the concept of "stretch" doesn't apply. */
|
|
28
|
+
audience?: AudienceProfile;
|
|
29
|
+
/** Restrict to these component names. */
|
|
30
|
+
allow?: ReadonlyArray<string>;
|
|
31
|
+
/** Exclude these component names. */
|
|
32
|
+
deny?: ReadonlyArray<string>;
|
|
33
|
+
/** Max stretch picks to return (default 5). */
|
|
34
|
+
maxResults?: number;
|
|
35
|
+
/** Pre-built profile. */
|
|
36
|
+
profile?: ChartDataProfile;
|
|
37
|
+
/** Non-tabular payload — forwarded to profileData. */
|
|
38
|
+
rawInput?: unknown;
|
|
39
|
+
/**
|
|
40
|
+
* Only return stretches within this score distance of the top familiar pick
|
|
41
|
+
* (default 1.5). Tighter values keep the suggestions plausible; wider values
|
|
42
|
+
* expose more variety.
|
|
43
|
+
*/
|
|
44
|
+
scoreTolerance?: number;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Find pairs (familiar, stretch) where the stretch chart fits the data,
|
|
48
|
+
* has audience familiarity at or below the stretch ceiling, and either:
|
|
49
|
+
* • is an `increase` target for this audience, OR
|
|
50
|
+
* • scores within `scoreTolerance` of a familiar alternative for the
|
|
51
|
+
* same intent.
|
|
52
|
+
*
|
|
53
|
+
* Each pair is returned as a StretchSuggestion with `replacing` (the
|
|
54
|
+
* familiar chart it could substitute for) and a rationale string.
|
|
55
|
+
*
|
|
56
|
+
* Heuristic only. Use `audience` with care — without target signals, every
|
|
57
|
+
* audience-unfamiliar chart becomes a candidate, which can drown the
|
|
58
|
+
* surface in dubious recommendations.
|
|
59
|
+
*/
|
|
60
|
+
export declare function suggestStretchCharts(data: ReadonlyArray<Datum> | null | undefined, options?: SuggestStretchChartsOptions): StretchSuggestion[];
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { Datum } from "../charts/shared/datumTypes";
|
|
2
|
+
import { type ProfileDataOptions } from "./profileData";
|
|
3
|
+
import { type SuggestChartsOptions } from "./suggestCharts";
|
|
4
|
+
import type { ChartDataProfile, Suggestion } from "./chartCapabilityTypes";
|
|
5
|
+
export interface UseChartSuggestionsOptions extends SuggestChartsOptions, ProfileDataOptions {
|
|
6
|
+
}
|
|
7
|
+
export interface UseChartSuggestionsResult {
|
|
8
|
+
suggestions: ReadonlyArray<Suggestion>;
|
|
9
|
+
profile: ChartDataProfile;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Memoized chart suggestion hook.
|
|
13
|
+
*
|
|
14
|
+
* Heuristic-only: this hook never calls an LLM. Pair with `useChartInterrogation`
|
|
15
|
+
* to let an LLM re-rank or narrate the heuristic suggestions.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* const { suggestions } = useChartSuggestions(data, { intent: "trend" })
|
|
19
|
+
* const top = suggestions[0]
|
|
20
|
+
* return <DynamicChart component={top.component} props={top.props} />
|
|
21
|
+
*/
|
|
22
|
+
export declare function useChartSuggestions(data: ReadonlyArray<Datum> | null | undefined, options?: UseChartSuggestionsOptions): UseChartSuggestionsResult;
|