@factorialco/f0-react 2.22.0 → 2.23.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/dist/ai.js CHANGED
@@ -1,44 +1,44 @@
1
- import { C as e, D as r, i, F as o, l as t, m as n, a as F, o as C, p as A, q as l, g as u, r as d, h, j as m, k as c, d as I, I as P, P as f, c as g, n as p, e as v, u as T, f as y, b as S } from "./F0CanvasPanel-v9tjaOnW.js";
2
- import { defaultTranslations as H } from "./i18n-provider-defaults.js";
3
- import { A as b, f as M, F as O, i as j, h as k, j as D, d as q, e as w, c as z, a as B, g as E, o as L, u as G, b as J } from "./F0AiTableCard-BzXULBvr.js";
1
+ import { D as e, F as r, a as t, e as i, f as o, c as n, d as F, I as C, P as A, b as l, u } from "./F0CanvasPanel-CSOSmTuX.js";
2
+ import { defaultTranslations as m } from "./i18n-provider-defaults.js";
3
+ import { A as c, C as I, h as P, s as v, t as f, w as p, m as T, j as g, q as y, x as S, p as x, r as H, k as V, e as b, g as M, l as O, F as k, i as w, a as D, n as j, o as q, b as z, f as B, v as E, c as L, d as G, u as J } from "./useChatHistory-CUWc-i-8.js";
4
4
  export {
5
- b as AiChatTranslationsProvider,
6
- e as ChatSpinner,
7
- r as DropOverlay,
8
- i as F0ActionItem,
9
- o as F0AiChat,
10
- t as F0AiChatHeader,
11
- n as F0AiChatHistory,
12
- F as F0AiChatProvider,
13
- C as F0AiChatTextArea,
14
- M as F0AiInsightCard,
15
- O as F0AiMask,
16
- j as F0AiMessageSources,
17
- A as F0AiMessagesContainer,
18
- l as F0AiPong,
19
- k as F0AiProposalCard,
20
- D as F0AiTableCard,
21
- q as F0AuraVoiceAnimation,
22
- u as F0CanvasCard,
23
- d as F0CanvasPanel,
24
- h as F0ClarifyingPanel,
25
- w as F0HILActionConfirmation,
26
- m as F0OneIcon,
27
- c as F0OneSwitch,
28
- I as FormCardValueFormatterProvider,
29
- P as I18nProvider,
30
- f as PongBall,
31
- z as actionItemStatuses,
32
- B as aiTranslations,
33
- E as contentTypes,
34
- H as defaultTranslations,
35
- L as oneIconSizes,
36
- g as useAiChat,
37
- G as useAiChatTranslations,
38
- J as useCanvasEntity,
39
- p as useChatHistory,
40
- v as useFormCardValueFormatter,
41
- T as useI18n,
42
- y as useSetFormCardValueFormatter,
43
- S as useToolCallId
5
+ c as AiChatTranslationsProvider,
6
+ I as ChatSpinner,
7
+ e as DropOverlay,
8
+ P as F0ActionItem,
9
+ r as F0AiChat,
10
+ v as F0AiChatHeader,
11
+ f as F0AiChatHistory,
12
+ t as F0AiChatProvider,
13
+ p as F0AiChatTextArea,
14
+ T as F0AiInsightCard,
15
+ g as F0AiMask,
16
+ y as F0AiMessageSources,
17
+ S as F0AiMessagesContainer,
18
+ i as F0AiPong,
19
+ x as F0AiProposalCard,
20
+ H as F0AiTableCard,
21
+ V as F0AuraVoiceAnimation,
22
+ b as F0CanvasCard,
23
+ o as F0CanvasPanel,
24
+ M as F0ClarifyingPanel,
25
+ O as F0HILActionConfirmation,
26
+ n as F0OneIcon,
27
+ F as F0OneSwitch,
28
+ k as FormCardValueFormatterProvider,
29
+ C as I18nProvider,
30
+ A as PongBall,
31
+ w as actionItemStatuses,
32
+ D as aiTranslations,
33
+ j as contentTypes,
34
+ m as defaultTranslations,
35
+ q as oneIconSizes,
36
+ l as useAiChat,
37
+ z as useAiChatTranslations,
38
+ B as useCanvasEntity,
39
+ E as useChatHistory,
40
+ L as useFormCardValueFormatter,
41
+ u as useI18n,
42
+ G as useSetFormCardValueFormatter,
43
+ J as useToolCallId
44
44
  };
@@ -1,4 +1,3 @@
1
- import { AIMessage } from '@copilotkit/shared';
2
1
  import { AlertAvatarProps as AlertAvatarProps_2 } from './F0AvatarAlert';
3
2
  import { AlertTagCellValue } from './types/alertTag';
4
3
  import { AlertTagCellValue as AlertTagCellValue_2 } from './experimental';
@@ -25,7 +24,6 @@ import { CompanyCellValue as CompanyCellValue_2 } from './experimental';
25
24
  import { CompanyItemProps } from './types';
26
25
  import { ComponentProps } from 'react';
27
26
  import { CompoundCellValue } from './types/compound';
28
- import { CopilotKitProps } from '@copilotkit/react-core';
29
27
  import { CountCellValue } from './types/count';
30
28
  import { CountryCellValue } from './types/country';
31
29
  import { DateCellValue } from './types/date';
@@ -68,7 +66,6 @@ import { LineChartConfig } from './experimental';
68
66
  import { LineChartProps } from './experimental';
69
67
  import { LineChartPropsBase } from './utils/types';
70
68
  import { LongTextCellValue } from './types/longText';
71
- import { Message as Message_2 } from '@copilotkit/shared';
72
69
  import { NumberCellValue } from './types/number';
73
70
  import { NumberCellValue as NumberCellValue_2 } from './experimental';
74
71
  import { NumberFilterOptions } from './NumberFilter/NumberFilter';
@@ -502,6 +499,11 @@ declare type AiChatFileAttachmentConfig = {
502
499
  */
503
500
  declare type AiChatProviderProps = {
504
501
  enabled?: boolean;
502
+ /**
503
+ * Greeting phrase(s) shown by the welcome screen when the chat is empty.
504
+ * A single string renders once; an array rotates through phrases. Purely
505
+ * UI config — does not affect runtime behavior.
506
+ */
505
507
  initialMessage?: string | string[];
506
508
  welcomeScreenSuggestions?: WelcomeScreenSuggestion[];
507
509
  disclaimer?: AiChatDisclaimer;
@@ -579,31 +581,40 @@ declare type AiChatProviderProps = {
579
581
  * File attachment configuration. When provided, enables file uploads in the chat.
580
582
  */
581
583
  fileAttachments?: AiChatFileAttachmentConfig;
582
- onThumbsUp?: (message: AIMessage, { threadId, feedback }: {
584
+ onThumbsUp?: (message: F0AIMessage, { threadId, feedback }: {
583
585
  threadId: string;
584
586
  feedback: string;
585
587
  }) => void;
586
- onThumbsDown?: (message: AIMessage, { threadId, feedback }: {
588
+ onThumbsDown?: (message: F0AIMessage, { threadId, feedback }: {
587
589
  threadId: string;
588
590
  feedback: string;
589
591
  }) => void;
590
592
  tracking?: AiChatTrackingOptions;
591
593
  /**
592
- * Optional hook called before a user message is sent. Return false to block submission.
594
+ * Optional name of the AI agent. Forwarded to the host runtime adapter
595
+ * (mock in stories, CopilotKit in factorial) — f0 itself only stores it.
593
596
  */
594
- onBeforeSendMessage?: () => boolean | Promise<boolean>;
597
+ agent?: string;
595
598
  /**
596
- * Optional fetch implementation for AI runtime requests owned by F0.
599
+ * Slot elements rendered inside `<F0AiChat />`. Host apps (factorial in
600
+ * production, the mock runtime in stories) provide their own connected
601
+ * wrappers — f0 ships only the shell. Passing slots here makes them
602
+ * available to any `<F0AiChat />` mounted under this provider (used by
603
+ * `ApplicationFrame`, which renders the chat itself).
597
604
  */
598
- runtimeFetch?: typeof fetch;
599
- } & Pick<CopilotKitProps, "agent" | "credentials" | "children" | "runtimeUrl" | "showDevConsole" | "threadId" | "headers">;
605
+ chatHeader?: React.ReactNode;
606
+ chatMessages?: React.ReactNode;
607
+ chatInput?: React.ReactNode;
608
+ /** Children rendered inside the provider. */
609
+ children?: React.ReactNode;
610
+ };
600
611
 
601
612
  declare type AiChatTrackingOptions = {
602
613
  onVisibility?: () => void;
603
614
  onClose?: () => void;
604
615
  onWelcomeSuggestionClick?: (event: WelcomeSuggestionClickEvent) => void;
605
616
  onNewChat?: () => void;
606
- onMessage?: (message: Message_2) => void;
617
+ onMessage?: (message: F0Message) => void;
607
618
  };
608
619
 
609
620
  /**
@@ -4077,6 +4088,9 @@ export declare const F0AiBanner: ForwardRefExoticComponent<Omit<AiBannerInternal
4077
4088
 
4078
4089
  export declare type F0AiBannerProps = AiBannerInternalProps;
4079
4090
 
4091
+ /** Assistant-flavoured `F0Message`. Same shape — alias kept for clarity. */
4092
+ declare type F0AIMessage = F0Message;
4093
+
4080
4094
  declare const F0AvatarAlert: WithDataTestIdReturnType_5<({ type, size, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, }: AlertAvatarProps_2) => JSX_2.Element>;
4081
4095
 
4082
4096
  declare type F0AvatarCompanyProps = {
@@ -4309,6 +4323,24 @@ declare interface F0IconProps extends SVGProps<SVGSVGElement>, VariantProps<type
4309
4323
  color?: "default" | "currentColor" | `#${string}` | Lowercase<NestedKeyOf<typeof f1Colors.icon>>;
4310
4324
  }
4311
4325
 
4326
+ declare type F0Message = {
4327
+ id: string;
4328
+ role: "user" | "assistant" | "system" | "tool";
4329
+ content?: unknown;
4330
+ toolCalls?: F0ToolCall[];
4331
+ toolCallId?: string;
4332
+ createdAt?: string;
4333
+ generativeUI?: () => unknown;
4334
+ rawData?: unknown;
4335
+ /**
4336
+ * Reply quote text attached to the message by the composer. Rendered
4337
+ * as a block above the user bubble. Adapters (factorial / mock) own
4338
+ * the wire encoding; F0 only reads this structured field.
4339
+ */
4340
+ replyQuote?: string;
4341
+ [key: string]: any;
4342
+ };
4343
+
4312
4344
  /**
4313
4345
  * @experimental This is an experimental component, use it at your own risk.
4314
4346
  */
@@ -4591,6 +4623,21 @@ declare interface F0TagStatusProps {
4591
4623
 
4592
4624
  declare const F0TagTeam: WithDataTestIdReturnType_5<ForwardRefExoticComponent<F0TagTeamProps & RefAttributes<HTMLDivElement>>>;
4593
4625
 
4626
+ /**
4627
+ * Loose message shape used inside f0. Mirrors the CopilotKit `Message`
4628
+ * shape so adapters (factorial, mock runtime) can map back and forth
4629
+ * with no field rename, but is owned by f0 — nothing in `src/` imports
4630
+ * from `@copilotkit/*` anymore.
4631
+ */
4632
+ declare type F0ToolCall = {
4633
+ id: string;
4634
+ type?: "function";
4635
+ function: {
4636
+ name: string;
4637
+ arguments: string;
4638
+ };
4639
+ };
4640
+
4594
4641
  /**
4595
4642
  * @experimental This is an experimental component use it at your own risk
4596
4643
  */
@@ -8438,6 +8485,11 @@ declare module "gridstack" {
8438
8485
  }
8439
8486
 
8440
8487
 
8488
+ declare namespace Calendar {
8489
+ var displayName: string;
8490
+ }
8491
+
8492
+
8441
8493
  declare module "@tiptap/core" {
8442
8494
  interface Commands<ReturnType> {
8443
8495
  aiBlock: {
@@ -8469,10 +8521,8 @@ declare module "@tiptap/core" {
8469
8521
 
8470
8522
  declare module "@tiptap/core" {
8471
8523
  interface Commands<ReturnType> {
8472
- videoEmbed: {
8473
- setVideoEmbed: (options: {
8474
- src: string;
8475
- }) => ReturnType;
8524
+ transcript: {
8525
+ insertTranscript: (data: TranscriptData) => ReturnType;
8476
8526
  };
8477
8527
  }
8478
8528
  }
@@ -8480,18 +8530,15 @@ declare module "@tiptap/core" {
8480
8530
 
8481
8531
  declare module "@tiptap/core" {
8482
8532
  interface Commands<ReturnType> {
8483
- transcript: {
8484
- insertTranscript: (data: TranscriptData) => ReturnType;
8533
+ videoEmbed: {
8534
+ setVideoEmbed: (options: {
8535
+ src: string;
8536
+ }) => ReturnType;
8485
8537
  };
8486
8538
  }
8487
8539
  }
8488
8540
 
8489
8541
 
8490
- declare namespace Calendar {
8491
- var displayName: string;
8492
- }
8493
-
8494
-
8495
8542
  declare namespace F0GraphNodeWrapperInner {
8496
8543
  var displayName: string;
8497
8544
  }