@gemies/sdk 10.0.2 → 10.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # @gemies/sdk
2
2
 
3
+ ## 10.1.0
4
+
5
+ ### `@gemies/sdk/ask/lean`
6
+
7
+ A new entry: `@gemies/sdk/ask` whose sheet brings no chart cards of its own. The host passes
8
+ `chartCards` (`{ LineChartCard, BarListCard }`, typed `GemieChartCards`) to its `GemieAskProvider`,
9
+ and the conversation draws a market or FairCoin quote and a generated chart with them. An app that
10
+ draws the same cards on a lazy screen of its own loads them once, through its own `import()`,
11
+ instead of having them shared between that screen's chunk and the sheet's and hoisted into its
12
+ first paint (`__common.js`) on web. Without `chartCards`, a quote says its price in words and a
13
+ generated chart is not drawn.
14
+
15
+ Every other entry draws as before, with Bloom's cards: they now come from one module
16
+ (`components/charts/default-chart-cards`) that the root, `@gemies/sdk/text` and the default ask
17
+ sheets import. `scripts/check-entry-isolation.mjs` holds that every entry that draws the chat
18
+ brings them, that no other SDK module imports `@oxy.so/bloom/chart-cards`, and that
19
+ `@gemies/sdk/ask/lean` never reaches them, not even behind its lazy sheet.
20
+
21
+ `GemieChatSheet` and `GemieChatContent` take `chartCards` too, over the entry's own.
22
+
3
23
  ## 10.0.0
4
24
 
5
25
  Built on `@oxy.so/services` 15. The runtime's own data moved off React Query onto
package/README.md CHANGED
@@ -163,6 +163,7 @@ one is the same conversation in the others.
163
163
  | One "Ask" sheet at the app's root, loaded with the first `ask` | `@gemies/sdk/ask` | yes, in the sheet's chunk |
164
164
  | The root's eager Ask provider and hook | `@gemies/sdk/ask/eager` | yes, loaded eagerly |
165
165
  | The same, text only | `@gemies/sdk/ask/text` | no |
166
+ | `@gemies/sdk/ask` without Bloom's chart cards: you pass your own (`chartCards`) | `@gemies/sdk/ask/lean` | yes, in the sheet's chunk |
166
167
  | Data only: conversations, the stream, the model | `@gemies/sdk/runtime`, `@gemies/sdk/model` | no |
167
168
  | Her face on a button | `@gemies/sdk/avatar` | no |
168
169
  | Character parser and runtime URL | `@gemies/sdk/character` | no |
@@ -222,6 +223,22 @@ of `@gemies/sdk/ask`. So either mount the provider from `@gemies/sdk/ask`, or la
222
223
  own module that imports the root entry (or `@gemies/sdk/text`). Don't do both, or the chat they
223
224
  share lands in `__common.js`. The text-only entries draw no extra boundary either.
224
225
 
226
+ The same goes for what the sheet shares with your own lazy screens. The sheet draws charts (a
227
+ market quote, a generated chart) with Bloom's `LineChartCard` and `BarListCard`; if your app also
228
+ draws them on a lazy screen of its own, the two chunks share them and Metro hoists them into
229
+ `__common.js`. Mount the provider from `@gemies/sdk/ask/lean` instead and pass `chartCards`, the
230
+ two cards loaded through the same `import()` your screen uses, so they load once, in their own
231
+ chunk:
232
+
233
+ ```tsx
234
+ import { GemieAskProvider } from '@gemies/sdk/ask/lean';
235
+ import type { GemieChartCards } from '@gemies/sdk/ask/lean';
236
+
237
+ <GemieAskProvider chartCards={myLazyChartCards /* GemieChartCards */}>{children}</GemieAskProvider>;
238
+ ```
239
+
240
+ Without `chartCards` the lean sheet says a quote's price in words and draws no generated chart.
241
+
225
242
  The sheet offers the person's latest conversations with its lead under the greeting
226
243
  (`recentConversations={false}` turns it off). The code that configures the sheet sits above it, so
227
244
  `GemieAskProvider` forwards a ref to the same `GemieAsk` for it.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gemies/sdk",
3
- "version": "10.0.2",
3
+ "version": "10.1.0",
4
4
  "description": "The Gemies SDK: the conversation runtime, chat UI, voice calls and dictation for Oxy apps that talk to a gemie",
5
5
  "main": "src/index.ts",
6
6
  "react-native": "src/index.ts",
@@ -11,6 +11,7 @@
11
11
  "./accounts": "./src/accounts.ts",
12
12
  "./ask": "./src/ask.ts",
13
13
  "./ask/eager": "./src/ask-eager.ts",
14
+ "./ask/lean": "./src/ask-lean.ts",
14
15
  "./ask/text": "./src/ask-text.ts",
15
16
  "./avatar": "./src/avatar.ts",
16
17
  "./character": "./src/character.ts",
@@ -0,0 +1,11 @@
1
+ // @gemies/sdk/ask/lean — `@gemies/sdk/ask` whose sheet brings no chart cards of its own
2
+ // The same provider and hook; the host passes `chartCards` (Bloom's `LineChartCard` and
3
+ // `BarListCard`, loaded however it likes) and the conversation draws its charts with them.
4
+
5
+ export { GemieAskProvider, useAskGemie } from './components/GemieAskProviderLean';
6
+ export type {
7
+ GemieAsk,
8
+ GemieAskAgents,
9
+ GemieAskProviderProps,
10
+ } from './components/GemieAskProviderLean';
11
+ export type { GemieChartCards } from './components/charts/chart-cards';
@@ -44,6 +44,7 @@ export interface GemieAskProviderProps
44
44
  | 'app'
45
45
  | 'hostTools'
46
46
  | 'toolRenderers'
47
+ | 'chartCards'
47
48
  | 'labels'
48
49
  | 'voice'
49
50
  | 'clientContext'
@@ -0,0 +1,26 @@
1
+ /**
2
+ * The ask provider of `@gemies/sdk/ask/lean`: `@gemies/sdk/ask`'s, whose sheet comes without
3
+ * Bloom's chart cards. The host draws the charts with its own (`chartCards`), so an app that
4
+ * already loads those cards behind an `import()` of its own (its insights, say) loads them once, in
5
+ * that chunk, instead of having them shared between its chunk and the sheet's — and hoisted into
6
+ * its first paint (`__common.js`) for it.
7
+ *
8
+ * Its `import()` is the one async boundary of this entry, as in `GemieAskProviderLazy`.
9
+ */
10
+
11
+ import { lazy, Suspense } from 'react';
12
+ import { type AskSheetComponent, createAskProvider } from './GemieAskCore';
13
+
14
+ const loadSheet = () => import('./GemieAskSheetLean');
15
+ const LazyAskSheet = lazy(() => loadSheet().then((module) => ({ default: module.GemieAskSheet })));
16
+
17
+ const SuspendedAskSheet: AskSheetComponent = (props) => (
18
+ <Suspense fallback={null}>
19
+ <LazyAskSheet {...props} />
20
+ </Suspense>
21
+ );
22
+
23
+ export type { GemieAsk, GemieAskAgents, GemieAskProviderProps } from './GemieAskCore';
24
+ export { useAskGemie } from './GemieAskCore';
25
+
26
+ export const GemieAskProvider = createAskProvider(SuspendedAskSheet, loadSheet);
@@ -1,51 +1,11 @@
1
1
  /**
2
- * The sheet `GemieAskProvider` mounts, in its own module so the provider can load it lazily: an app
3
- * that mounts the provider at its root carries only the provider in its entry bundle, and the
4
- * chat — thread, composer, voice, renderers — arrives with the first `ask`.
5
- *
6
- * It presents the opening it is handed once it is mounted, which is the only moment a lazily
7
- * loaded sheet can be presented, and tells the provider the opening is spent.
2
+ * The sheet `GemieAskProvider` mounts, drawing its charts with Bloom's cards: what
3
+ * `@gemies/sdk/ask/text` loads with the first `ask`, and what `GemieAskSheetWithVoice` wraps for
4
+ * `@gemies/sdk/ask`, `/ask/eager` and the root. `@gemies/sdk/ask/lean` loads `GemieAskSheetBase`
5
+ * without them, so a host there brings its own (`chartCards`).
8
6
  */
9
7
 
10
- import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
11
- import type { GemieTurn } from '../hooks/useChatComposer';
12
- import { GemieChatSheet, type GemieChatSheetProps, type GemieChatSheetRef } from './GemieChatSheet';
8
+ import './charts/default-chart-cards';
13
9
 
14
- /** What the person asked for: a turn to send, or a stored conversation to pick up again. */
15
- export interface GemieAskOpening {
16
- turn: GemieTurn | undefined;
17
- conversationId?: string;
18
- /** Changes on every `ask`, so asking the same agent twice opens twice. */
19
- serial: number;
20
- }
21
-
22
- export interface GemieAskSheetProps extends GemieChatSheetProps {
23
- /** The opening to present once mounted; `null` when there is none waiting. */
24
- opening: GemieAskOpening | null;
25
- /** The opening was presented. */
26
- onOpened: () => void;
27
- }
28
-
29
- export const GemieAskSheet = forwardRef<GemieChatSheetRef, GemieAskSheetProps>(
30
- function GemieAskSheet({ opening, onOpened, ...sheet }, ref) {
31
- const sheetRef = useRef<GemieChatSheetRef>(null);
32
- useImperativeHandle(
33
- ref,
34
- () => ({
35
- present: (turn?: GemieTurn) => sheetRef.current?.present(turn),
36
- resume: (conversationId: string) => sheetRef.current?.resume(conversationId),
37
- dismiss: () => sheetRef.current?.dismiss(),
38
- }),
39
- [],
40
- );
41
-
42
- useEffect(() => {
43
- if (opening === null) return;
44
- if (opening.conversationId !== undefined) sheetRef.current?.resume(opening.conversationId);
45
- else sheetRef.current?.present(opening.turn);
46
- onOpened();
47
- }, [opening, onOpened]);
48
-
49
- return <GemieChatSheet ref={sheetRef} {...sheet} />;
50
- },
51
- );
10
+ export { GemieAskSheet } from './GemieAskSheetBase';
11
+ export type { GemieAskOpening, GemieAskSheetProps } from './GemieAskSheetBase';
@@ -0,0 +1,53 @@
1
+ /**
2
+ * The sheet `GemieAskProvider` mounts, in its own module so the provider can load it lazily: an app
3
+ * that mounts the provider at its root carries only the provider in its entry bundle, and the
4
+ * chat — thread, composer, voice, renderers — arrives with the first `ask`.
5
+ *
6
+ * It presents the opening it is handed once it is mounted, which is the only moment a lazily
7
+ * loaded sheet can be presented, and tells the provider the opening is spent.
8
+ *
9
+ * It brings no chart cards: `GemieAskSheet` adds Bloom's, and `@gemies/sdk/ask/lean`'s host its own.
10
+ */
11
+
12
+ import { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
13
+ import type { GemieTurn } from '../hooks/useChatComposer';
14
+ import { GemieChatSheet, type GemieChatSheetProps, type GemieChatSheetRef } from './GemieChatSheet';
15
+
16
+ /** What the person asked for: a turn to send, or a stored conversation to pick up again. */
17
+ export interface GemieAskOpening {
18
+ turn: GemieTurn | undefined;
19
+ conversationId?: string;
20
+ /** Changes on every `ask`, so asking the same agent twice opens twice. */
21
+ serial: number;
22
+ }
23
+
24
+ export interface GemieAskSheetProps extends GemieChatSheetProps {
25
+ /** The opening to present once mounted; `null` when there is none waiting. */
26
+ opening: GemieAskOpening | null;
27
+ /** The opening was presented. */
28
+ onOpened: () => void;
29
+ }
30
+
31
+ export const GemieAskSheet = forwardRef<GemieChatSheetRef, GemieAskSheetProps>(
32
+ function GemieAskSheet({ opening, onOpened, ...sheet }, ref) {
33
+ const sheetRef = useRef<GemieChatSheetRef>(null);
34
+ useImperativeHandle(
35
+ ref,
36
+ () => ({
37
+ present: (turn?: GemieTurn) => sheetRef.current?.present(turn),
38
+ resume: (conversationId: string) => sheetRef.current?.resume(conversationId),
39
+ dismiss: () => sheetRef.current?.dismiss(),
40
+ }),
41
+ [],
42
+ );
43
+
44
+ useEffect(() => {
45
+ if (opening === null) return;
46
+ if (opening.conversationId !== undefined) sheetRef.current?.resume(opening.conversationId);
47
+ else sheetRef.current?.present(opening.turn);
48
+ onOpened();
49
+ }, [opening, onOpened]);
50
+
51
+ return <GemieChatSheet ref={sheetRef} {...sheet} />;
52
+ },
53
+ );
@@ -0,0 +1,10 @@
1
+ /**
2
+ * The ask sheet with the voice call and without Bloom's chart cards: what `@gemies/sdk/ask/lean`
3
+ * loads with the first `ask`. Its charts are drawn with the host's `chartCards`; with none, a quote
4
+ * says its price in words and a generated chart is not drawn.
5
+ */
6
+
7
+ import { GemieAskSheet as TextAskSheet } from './GemieAskSheetBase';
8
+ import { withVoiceCall } from './voice/withVoiceCall';
9
+
10
+ export const GemieAskSheet = withVoiceCall(TextAskSheet, 'GemieAskSheet');
@@ -60,6 +60,7 @@ import {
60
60
  leadOf,
61
61
  } from '../lib/participants';
62
62
  import { type GemieToolRenderers, GemieToolRenderersProvider } from '../lib/tool-renderers';
63
+ import { type GemieChartCards, GemieChartCardsProvider } from './charts/chart-cards';
63
64
  import { KeyboardSafeAreaFloor } from '../lib/keyboard';
64
65
  import { type GemieChatLabels, GemieChatLabelsProvider, useLabels } from '../lib/labels';
65
66
  import { type DeviceModel, buildPowerLevelOptions } from '../lib/power-level-options';
@@ -181,6 +182,11 @@ export interface GemieChatContentProps {
181
182
  hostTools?: GemieHostTools;
182
183
  /** The app's own drawing of a catalogue tool's result, keyed `<app>:<tool>`, before the generic card. */
183
184
  toolRenderers?: GemieToolRenderers;
185
+ /**
186
+ * The chart cards the conversation draws with, over the entry's own (Bloom's). Only
187
+ * `@gemies/sdk/ask/lean` comes without them, so a host on it passes its own here.
188
+ */
189
+ chartCards?: GemieChartCards;
184
190
  /**
185
191
  * The lead's feature gate refused something (`attachments.documents`…): the host shows its own
186
192
  * upsell. Also called for a locked row of the attach menu.
@@ -316,6 +322,7 @@ type ConversationViewProps = Omit<
316
322
  | 'conversationId'
317
323
  | 'apiUrl'
318
324
  | 'toolRenderers'
325
+ | 'chartCards'
319
326
  | 'onFeatureLocked'
320
327
  > & { conversationId: string | undefined };
321
328
 
@@ -863,6 +870,7 @@ export function GemieChatContent({
863
870
  apiUrl,
864
871
  app,
865
872
  toolRenderers,
873
+ chartCards,
866
874
  onFeatureLocked,
867
875
  ...props
868
876
  }: GemieChatContentProps) {
@@ -906,7 +914,13 @@ export function GemieChatContent({
906
914
  <GemieChatLabelsProvider labels={labels}>
907
915
  <GemieRuntimeProvider apiUrl={apiUrl ?? parent.apiUrl} host={host} app={chatApp}>
908
916
  <GemieToolRenderersProvider value={toolRenderers ?? NO_RENDERERS}>
909
- <GemieConversationView {...props} conversationId={controlledId ?? ownId} />
917
+ {chartCards === undefined ? (
918
+ <GemieConversationView {...props} conversationId={controlledId ?? ownId} />
919
+ ) : (
920
+ <GemieChartCardsProvider value={chartCards}>
921
+ <GemieConversationView {...props} conversationId={controlledId ?? ownId} />
922
+ </GemieChartCardsProvider>
923
+ )}
910
924
  </GemieToolRenderersProvider>
911
925
  </GemieRuntimeProvider>
912
926
  </GemieChatLabelsProvider>
@@ -17,6 +17,7 @@ import { useSafeAreaInsets } from 'react-native-safe-area-context';
17
17
  import { BREAKPOINTS } from '@oxy.so/bloom/styles';
18
18
  import { GemieChatLabelsProvider, type GemieChatLabels } from '../lib/labels';
19
19
  import type { GemieToolRenderers } from '../lib/tool-renderers';
20
+ import type { GemieChartCards } from './charts/chart-cards';
20
21
  import { useShareHandler } from '../hooks/useShareHandler';
21
22
  import type { GemieRuntimeHost } from '../runtime/config';
22
23
  import type { GemieHostTools } from '../runtime/host-tools';
@@ -59,6 +60,8 @@ export interface GemieChatSheetProps {
59
60
  hostTools?: GemieHostTools;
60
61
  /** The app's own drawing of catalogue tools' results, keyed `<app>:<tool>`. */
61
62
  toolRenderers?: GemieToolRenderers;
63
+ /** The chart cards the conversation draws with (see `GemieChatContentProps.chartCards`). */
64
+ chartCards?: GemieChartCards;
62
65
  /** The lead's feature gate refused something: show the app's upsell for `key`. */
63
66
  onFeatureLocked?: (key: string) => void;
64
67
  /** The power level (`auto`, `instant`, `medium`, `high`, `xhigh`, `pro`, `ultra`) or an exact `publisher/model` every turn is sent with; omitted, the server picks. */
@@ -123,6 +126,7 @@ const GemieChatSheetBody = forwardRef<GemieChatSheetRef, GemieChatSheetProps>(
123
126
  clientContext,
124
127
  hostTools,
125
128
  toolRenderers,
129
+ chartCards,
126
130
  onFeatureLocked,
127
131
  model,
128
132
  apiUrl,
@@ -281,6 +285,7 @@ const GemieChatSheetBody = forwardRef<GemieChatSheetRef, GemieChatSheetProps>(
281
285
  clientContext,
282
286
  hostTools,
283
287
  toolRenderers,
288
+ chartCards,
284
289
  onFeatureLocked,
285
290
  model,
286
291
  apiUrl,
@@ -1,8 +1,6 @@
1
1
  import { useLabels } from '../../lib/labels';
2
- // The two cards by subpath: the `chart-cards` root is every chart Bloom draws (~190 KB on web).
3
- import { BarListCard } from '@oxy.so/bloom/chart-cards/bar-list';
4
- import { LineChartCard } from '@oxy.so/bloom/chart-cards/line';
5
2
  import { formatNumber } from '@oxy.so/bloom/locale';
3
+ import { useChartCards } from '../charts/chart-cards';
6
4
 
7
5
  interface ChartData {
8
6
  chartType: 'bar' | 'line' | 'pie';
@@ -24,9 +22,14 @@ const format = (value: number) => formatNumber(value);
24
22
  * - one `line` series → `LineChartCard`;
25
23
  * - a `pie` → `BarListCard` in shares of the whole, which is what a pie says;
26
24
  * - bars, or several series → `BarListCard` in raw values, one tab per series.
25
+ *
26
+ * The cards are the entry's (Bloom's) or the host's (`chartCards`); with neither, there is no chart.
27
27
  */
28
28
  export function ChartRenderer({ data, title }: ChartRendererProps) {
29
29
  const { t } = useLabels();
30
+ const cards = useChartCards();
31
+ if (cards === null) return null;
32
+ const { LineChartCard, BarListCard } = cards;
30
33
  const { chartType, labels, datasets } = data;
31
34
  const itemsOf = (values: number[]) =>
32
35
  labels.map((label, i) => ({ label, value: values[i] || 0 }));
@@ -0,0 +1,34 @@
1
+ import type { BarListCard } from '@oxy.so/bloom/chart-cards/bar-list';
2
+ import type { LineChartCard } from '@oxy.so/bloom/chart-cards/line';
3
+ import { createContext, useContext } from 'react';
4
+
5
+ /**
6
+ * The two Bloom chart cards the conversation draws: a market or FairCoin quote and a generated
7
+ * chart's single line on `LineChartCard`, everything else a chart says on `BarListCard`.
8
+ *
9
+ * Every entry but `@gemies/sdk/ask/lean` brings Bloom's own (`./default-chart-cards`, imported for
10
+ * its effect next to the chat). `@gemies/sdk/ask/lean` brings none, so a host on it hands its own
11
+ * (`chartCards` on the provider): an app that draws the same cards behind an `import()` of its own
12
+ * keeps them out of its first paint instead of sharing them between its chunk and the sheet's.
13
+ */
14
+ export interface GemieChartCards {
15
+ LineChartCard: typeof LineChartCard;
16
+ BarListCard: typeof BarListCard;
17
+ }
18
+
19
+ let defaults: GemieChartCards | null = null;
20
+
21
+ /** Called once by `./default-chart-cards`, the only SDK module that imports the cards. */
22
+ export function provideDefaultChartCards(cards: GemieChartCards): void {
23
+ defaults = cards;
24
+ }
25
+
26
+ const ChartCardsContext = createContext<GemieChartCards | null>(null);
27
+
28
+ /** The host's own cards (`chartCards`), over the entry's default. */
29
+ export const GemieChartCardsProvider = ChartCardsContext.Provider;
30
+
31
+ /** The cards to draw with: the host's, else the entry's default; `null` when there is neither. */
32
+ export function useChartCards(): GemieChartCards | null {
33
+ return useContext(ChartCardsContext) ?? defaults;
34
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Bloom's chart cards as the conversation's default, imported for its effect by every entry that
3
+ * draws the chat except `@gemies/sdk/ask/lean`: the root and `@gemies/sdk/text` with the entry,
4
+ * `@gemies/sdk/ask`, `/ask/eager` and `/ask/text` with their sheet (`GemieAskSheet`). The only SDK
5
+ * module that imports the cards; `scripts/check-entry-isolation.mjs` holds both.
6
+ */
7
+
8
+ import { BarListCard } from '@oxy.so/bloom/chart-cards/bar-list';
9
+ import { LineChartCard } from '@oxy.so/bloom/chart-cards/line';
10
+ import { provideDefaultChartCards } from './chart-cards';
11
+
12
+ provideDefaultChartCards({ LineChartCard, BarListCard });
@@ -15,10 +15,10 @@ import {
15
15
  } from '../../runtime/model';
16
16
  import { useLabels } from '../../lib/labels';
17
17
  import { useGemieRuntime } from '../../runtime/config';
18
+ import { type GemieChartCards, useChartCards } from '../charts/chart-cards';
18
19
  import { AiChatMessageLine } from '@oxy.so/bloom/ai-chat';
19
20
  import { Badge } from '@oxy.so/bloom/badge';
20
21
  import { Card, CardBody, CardHeader } from '@oxy.so/bloom/card';
21
- import { LineChartCard } from '@oxy.so/bloom/chart-cards/line';
22
22
  import { IconCircle } from '@oxy.so/bloom/icon-circle';
23
23
  import { RiArrowRightSLine } from '@oxy.so/bloom/icons/RiArrowRightSLine';
24
24
  import { RiCalendarScheduleLine } from '@oxy.so/bloom/icons/RiCalendarScheduleLine';
@@ -58,7 +58,13 @@ export function ToolResultCard({ card }: { card: ToolCard }) {
58
58
  }
59
59
  }
60
60
 
61
- function PriceLineChart({ chart }: { chart: PriceChart }) {
61
+ function PriceLineChart({
62
+ chart,
63
+ LineChartCard,
64
+ }: {
65
+ chart: PriceChart;
66
+ LineChartCard: GemieChartCards['LineChartCard'];
67
+ }) {
62
68
  return (
63
69
  <LineChartCard
64
70
  title={chart.title}
@@ -99,12 +105,14 @@ function PriceInWords({ title, price, hint }: { title: string; price: string; hi
99
105
 
100
106
  function MarketResult({ data }: { data: MarketCardData }) {
101
107
  const { t, locale } = useLabels();
102
- const chart = marketChart(data, t, locale);
108
+ const cards = useChartCards();
109
+ // Without cards to draw it with, a quote says its price in words, as one with no line does.
110
+ const chart = cards === null ? null : marketChart(data, t, locale);
103
111
  return (
104
112
  <>
105
113
  <AiChatMessageLine block>
106
- {chart !== null ? (
107
- <PriceLineChart chart={chart} />
114
+ {chart !== null && cards !== null ? (
115
+ <PriceLineChart chart={chart} LineChartCard={cards.LineChartCard} />
108
116
  ) : (
109
117
  <PriceInWords
110
118
  title={`${data.name} · ${data.symbol}`}
@@ -124,12 +132,13 @@ function MarketResult({ data }: { data: MarketCardData }) {
124
132
 
125
133
  function FairCoinResult({ data }: { data: FairCoinCardData }) {
126
134
  const { t, locale } = useLabels();
135
+ const cards = useChartCards();
127
136
  const { chart, notes } = faircoinChart(data, t, locale);
128
137
  return (
129
138
  <>
130
139
  <AiChatMessageLine block>
131
- {chart !== null ? (
132
- <PriceLineChart chart={chart} />
140
+ {chart !== null && cards !== null ? (
141
+ <PriceLineChart chart={chart} LineChartCard={cards.LineChartCard} />
133
142
  ) : (
134
143
  <PriceInWords
135
144
  title={`${t('faircoin.name')} · ${t('faircoin.symbol')}`}
@@ -1,10 +1,9 @@
1
1
  import { useLabels } from '../lib/labels';
2
+ import { FAILED_TURN_TOAST_ID } from './useFailedTurnToast';
2
3
  import type { AgentActivityState } from '../runtime/thread/agent-activity';
3
4
  import { toast } from '@oxy.so/bloom/toast';
4
5
  import { useEffect } from 'react';
5
6
 
6
- /** One toast for the run that failed, replaced by the next failure. */
7
- export const AGENT_RUN_FAILURE_TOAST_ID = 'agent-run-failure';
8
7
  const AGENT_RUN_FAILURE_TOAST_MS = 10_000;
9
8
 
10
9
  /**
@@ -12,7 +11,8 @@ const AGENT_RUN_FAILURE_TOAST_MS = 10_000;
12
11
  * thread keeps the person's words and the agent's, and a failure is not part of either. The words
13
12
  * are the server's (why it failed), under the app's own line. A run that ended well still leaves its
14
13
  * summary card (`AgentResultCard`); this is for the one that did not, unless the turn's own failure
15
- * toast already told it.
14
+ * toast already told it. The two share one toast id: the run's failure reaches the thread before the
15
+ * turn's does, and the turn's toast, which can Retry, replaces it instead of stacking beside it.
16
16
  */
17
17
  export function useAgentRunFailureToast(
18
18
  activity: AgentActivityState | null | undefined,
@@ -26,7 +26,7 @@ export function useAgentRunFailureToast(
26
26
  useEffect(() => {
27
27
  if (!failed) return;
28
28
  toast.error(t('chat.agentRun.taskFailed'), {
29
- id: AGENT_RUN_FAILURE_TOAST_ID,
29
+ id: FAILED_TURN_TOAST_ID,
30
30
  description: detail,
31
31
  duration: AGENT_RUN_FAILURE_TOAST_MS,
32
32
  });
package/src/index.ts CHANGED
@@ -1,6 +1,9 @@
1
1
  // @gemies/sdk — the Gemies SDK
2
2
  // Reusable chat UI, voice, and streaming components for Oxy apps
3
3
 
4
+ // Bloom's chart cards, the conversation's default (`components/charts/default-chart-cards`).
5
+ import './components/charts/default-chart-cards';
6
+
4
7
  // ── Main components ──
5
8
  export { GemieChatContent } from './components/GemieChatWithVoice';
6
9
  export type {
@@ -27,6 +30,7 @@ export type { GemieChatParticipants, GemieLead, GemieParticipant } from './lib/p
27
30
  export { ANCHORS, leadToProfile } from './lib/flights';
28
31
  export { parseCatalogueTool, toolRendererKey } from './lib/catalogue-tool';
29
32
  export type { GemieToolRenderers, GemieToolResult } from './lib/tool-renderers';
33
+ export type { GemieChartCards } from './components/charts/chart-cards';
30
34
  export { GemieAskProvider, useAskGemie } from './components/GemieAskProvider';
31
35
  export type {
32
36
  GemieAsk,
package/src/text.ts CHANGED
@@ -5,6 +5,9 @@
5
5
  // Types can be imported from the root entry (they are erased); values from the root would bring
6
6
  // the call along.
7
7
 
8
+ // Bloom's chart cards, the conversation's default (`components/charts/default-chart-cards`).
9
+ import './components/charts/default-chart-cards';
10
+
8
11
  export { GemieChatContent } from './components/GemieChatContent';
9
12
  export type {
10
13
  GemieChatAgentRef,