@frontera-sdk/chat-ui 1.50.40

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.
Files changed (148) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +348 -0
  3. package/dist/af-DK_CjRn6-OPBHDTNZ.js +197 -0
  4. package/dist/agent-picker.d.ts +38 -0
  5. package/dist/agent-picker.js +8 -0
  6. package/dist/as-BPtSu6VN-O4ZZEAJG.js +11 -0
  7. package/dist/be-CrQ0smca-5HIE5K27.js +11 -0
  8. package/dist/bg-CrQqGwni-3IRVPZQ7.js +11 -0
  9. package/dist/bn-NCLZcWHi-XOZJFNIB.js +11 -0
  10. package/dist/ca-SUf6Y2Om-V6F2EBCA.js +38 -0
  11. package/dist/capture-NO5ZIGP6.js +1652 -0
  12. package/dist/chat.css +3555 -0
  13. package/dist/chat.d.ts +161 -0
  14. package/dist/chat.js +60498 -0
  15. package/dist/chunk-2KEBRV3W.js +191 -0
  16. package/dist/chunk-6BPHEBCF.js +639 -0
  17. package/dist/chunk-6HYPVNVA.js +25 -0
  18. package/dist/chunk-7ADM3CKD.js +10 -0
  19. package/dist/chunk-AFVU5VT6.js +5601 -0
  20. package/dist/chunk-BEJ3HQG4.js +93 -0
  21. package/dist/chunk-CCVPZVFK.js +28 -0
  22. package/dist/chunk-DGDHKMDB.js +10 -0
  23. package/dist/chunk-FXKXDR5K.js +2166 -0
  24. package/dist/chunk-GTQH7MPF.js +129 -0
  25. package/dist/chunk-I7SXWUAN.js +1258 -0
  26. package/dist/chunk-IQRPGFLI.js +234 -0
  27. package/dist/chunk-IXDM5R55.js +23 -0
  28. package/dist/chunk-JD6ETTXC.js +178 -0
  29. package/dist/chunk-OP4MLJDA.js +215 -0
  30. package/dist/chunk-PQZ2CS26.js +2315 -0
  31. package/dist/chunk-PR4QN5HX.js +38 -0
  32. package/dist/chunk-PUIVKDV5.js +271 -0
  33. package/dist/chunk-QSSFBZAS.js +6914 -0
  34. package/dist/chunk-RAKKA3WU.js +5896 -0
  35. package/dist/chunk-RB2Y4NYC.js +681 -0
  36. package/dist/chunk-VDZH5Z3K.js +72 -0
  37. package/dist/chunk-WMN6BPPS.js +49 -0
  38. package/dist/chunk-WO6DJLFE.js +10857 -0
  39. package/dist/chunk-X5E2DJVO.js +47634 -0
  40. package/dist/chunk-XJFTVKLW.js +2687 -0
  41. package/dist/chunk-ZS6PXIZP.js +187 -0
  42. package/dist/client.d.ts +89 -0
  43. package/dist/client.js +20 -0
  44. package/dist/composer.d.ts +23 -0
  45. package/dist/composer.js +89 -0
  46. package/dist/cop-C3sk0IUo-CIZA2H43.js +11 -0
  47. package/dist/credential.d.ts +75 -0
  48. package/dist/credential.js +3 -0
  49. package/dist/cs-CmAteokq-HAKEQPB4.js +17 -0
  50. package/dist/cu-CBUlrW6Y-QTZ6ZLA4.js +32 -0
  51. package/dist/cy-BBPa6z2x-MX6DGDNW.js +11 -0
  52. package/dist/da-CCDXfXtG-5YEOHMG3.js +11 -0
  53. package/dist/de-1901-CWoAOigE-63QFSF2A.js +11 -0
  54. package/dist/de-1996-BL6awyxG-R2PHKMAB.js +11 -0
  55. package/dist/de-ch-1901-hVThVHVb-JSDB53OZ.js +11 -0
  56. package/dist/el-monoton-D3aKqTz2-2V4OOFBB.js +11 -0
  57. package/dist/el-polyton-ogVWcTzh-3U7NGQMT.js +11 -0
  58. package/dist/en-gb-B7Al27b_-UKCBQFSU.js +21 -0
  59. package/dist/es-DcaaHPU_-NOBXSOZK.js +11 -0
  60. package/dist/esm-MHF25KDL.js +3 -0
  61. package/dist/et-B_spaleu-5UAYIW62.js +11 -0
  62. package/dist/eu-Ctv_kq9Z-V5DREOPN.js +11 -0
  63. package/dist/fi-RW5VB8Yp-YSXBK7LW.js +11 -0
  64. package/dist/fr-BC2onEz9-7KH5T76G.js +11 -0
  65. package/dist/frame.d.ts +59 -0
  66. package/dist/frame.js +111 -0
  67. package/dist/fur-AC12wySk-4PD2Y72H.js +11 -0
  68. package/dist/ga-Cn6LkudM-RRAAJT3N.js +58 -0
  69. package/dist/gl-DZGc-K_G-KYSXXTCY.js +11 -0
  70. package/dist/grc-DOlGgO8T-2HXBZVJ5.js +11 -0
  71. package/dist/gu-Bjl0l-cf-4CFSVZHZ.js +11 -0
  72. package/dist/header.d.ts +78 -0
  73. package/dist/header.js +18 -0
  74. package/dist/hi-DsAaTPCC-KMCFBWK7.js +11 -0
  75. package/dist/hr-DT1SBBes-X2TIX6EI.js +11 -0
  76. package/dist/hsb-DC_ITc1e-PXLERA7R.js +46 -0
  77. package/dist/hu-DVk7Y_ka-PJPVU54B.js +11 -0
  78. package/dist/hy-e995ysyO-MZBRFX52.js +11 -0
  79. package/dist/ia-Cr4TJH0c-D3O2FHGP.js +22 -0
  80. package/dist/id-DifDyWg9-MZ2BGHWI.js +58 -0
  81. package/dist/is-BT8UVRze-CZZCKEFI.js +11 -0
  82. package/dist/it-Bt_Meacx-T4Y5JYV6.js +11 -0
  83. package/dist/ka-jyoLzyDE-ES6EXZLW.js +11 -0
  84. package/dist/kmr-Cfwhwuff-TSW2R2KS.js +11 -0
  85. package/dist/kn-C6Lov-DP-B4BL47CE.js +11 -0
  86. package/dist/la-DuvHjUWw-6K7TFU6X.js +11 -0
  87. package/dist/la-x-classic-yTyAOQEt-YWTKMM2L.js +11 -0
  88. package/dist/la-x-liturgic-CXeQb4FY-B772L5E7.js +11 -0
  89. package/dist/lib-3ZKX25RJ.js +4511 -0
  90. package/dist/lt-BBe8DlDF-4YINVOZR.js +11 -0
  91. package/dist/lv-Q2BBHnzp-TMVQ3MX2.js +11 -0
  92. package/dist/message.d.ts +64 -0
  93. package/dist/message.js +18 -0
  94. package/dist/ml-2xLVYkVY-NGZLAPIN.js +11 -0
  95. package/dist/mn-cyrl-lHM4n0oC-DGBYYUT3.js +11 -0
  96. package/dist/mn-cyrl-x-lmc-3aetruI8-QHJABMOO.js +11 -0
  97. package/dist/mr-CjWJPVmH-X5UHV65O.js +11 -0
  98. package/dist/mul-ethi-D_CMSMEq-H7UMQSOQ.js +11 -0
  99. package/dist/nb-DI8u59ch-J4CAVI4Y.js +122 -0
  100. package/dist/new-session-Dw7JOgzu.d.ts +141 -0
  101. package/dist/new-session.d.ts +4 -0
  102. package/dist/new-session.js +10 -0
  103. package/dist/nl-BHQJ6Gvn-7BH55RA7.js +52 -0
  104. package/dist/nn-ntZvarUK-KKNCHHJ4.js +122 -0
  105. package/dist/no-B8ItS0F3-3ZXIRJ6U.js +120 -0
  106. package/dist/oauth-callback.d.ts +35 -0
  107. package/dist/oauth-callback.js +18 -0
  108. package/dist/oc-P_i3-xLA-XZM6E5YZ.js +11 -0
  109. package/dist/or-50rxpoq4-5VELAFMJ.js +11 -0
  110. package/dist/pa-C54UG8eN-WEJPMZ6Z.js +11 -0
  111. package/dist/parts.d.ts +49 -0
  112. package/dist/parts.js +106 -0
  113. package/dist/pdf-cover-thumbnail-inner-4N2Q5AAG.js +36 -0
  114. package/dist/pdf-deck-view-inner-FZVLAEQR.js +575 -0
  115. package/dist/pdf-document-view-inner-6DF54JWK.js +585 -0
  116. package/dist/pdf-viewer-inner-GPES3KG2.js +256 -0
  117. package/dist/pending-cards.d.ts +26 -0
  118. package/dist/pending-cards.js +9 -0
  119. package/dist/pi-B9cgjyG1-GD5ASDDU.js +11 -0
  120. package/dist/pl-9fg-ESVt-UMX7MCJM.js +32 -0
  121. package/dist/platform.css +4013 -0
  122. package/dist/pms-BRGfm5gS-SSE3AUW5.js +11 -0
  123. package/dist/pt-Cum2_NUC-W35JYVR4.js +11 -0
  124. package/dist/rm-C0MIK9N4-IWL4YTNT.js +11 -0
  125. package/dist/ro-0fmdH0HA-46WUTOYH.js +11 -0
  126. package/dist/ru-v4l-ayaq-BUGK6XCN.js +196 -0
  127. package/dist/sa-CKY9c_Vq-4KIJOI5Y.js +11 -0
  128. package/dist/sh-cyrl-BpCRFOmq-DSLQ4UY2.js +128 -0
  129. package/dist/sh-latn-sRy4Tuaj-UNQOR63V.js +128 -0
  130. package/dist/sk-_iOeDNrQ-NCTQKH25.js +17 -0
  131. package/dist/sl-DpiklF-D-6GG5TDVN.js +11 -0
  132. package/dist/sr-cyrl-Dpzrbd0W-4Q5226YJ.js +142 -0
  133. package/dist/sv-CFm5y56M-VTWNPZ7I.js +11 -0
  134. package/dist/ta-BcghgTbD-NRT35DW6.js +11 -0
  135. package/dist/te-B5Spl2Jk-5VE6CLN4.js +11 -0
  136. package/dist/th-DWX5iPSo-N5GMOQOP.js +11 -0
  137. package/dist/theme.d.ts +49 -0
  138. package/dist/theme.js +3 -0
  139. package/dist/tk-BMbKB10q-HGWWY5L3.js +11 -0
  140. package/dist/tr-CIHIuzqc-6ISBNYLV.js +11 -0
  141. package/dist/types-BDqLaBfH.d.ts +60 -0
  142. package/dist/uk-Dir3oxLs-YQ3QZRI4.js +11 -0
  143. package/dist/univer-workbook-BSSUE5TG.css +3555 -0
  144. package/dist/univer-workbook-N5IIN7CH.js +290849 -0
  145. package/dist/vega-chart-block-NQADYNWQ.js +2857 -0
  146. package/dist/zh-latn-pinyin-BdYb-Ey_-RB542AHF.js +11 -0
  147. package/package.json +137 -0
  148. package/src/styles.css +996 -0
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright 2026 Sebati
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,348 @@
1
+ # @frontera-sdk/chat-ui
2
+
3
+ A Frontera agent's conversation, as a React component in your own application.
4
+ Streamed replies, tool activity, attachments, the files the agent produces,
5
+ knowledge citations, approvals and personal-account connections.
6
+
7
+ It is a **component, not an iframe**: it renders in your DOM, uses your React,
8
+ and your CSS can reach it (see [Hazards](#hazards)).
9
+
10
+ ---
11
+
12
+ ## Install
13
+
14
+ ```bash
15
+ npm i @frontera-sdk/chat-ui react react-dom
16
+ ```
17
+
18
+ React 19, ESM only. `react` and `react-dom` are the only packages the
19
+ **component** needs from you — two copies of React in one page break hooks.
20
+ Everything else it renders with installs as a dependency of this package.
21
+
22
+ ```bash
23
+ npm ls react # expect one version
24
+ ```
25
+
26
+ If your token endpoint lives in the same project, the **server** side needs two
27
+ more, because your own code imports them directly (see [Tokens](#tokens)):
28
+
29
+ ```bash
30
+ npm i @frontera-sdk/chat @frontera-sdk/core
31
+ ```
32
+
33
+ Both already arrive with this package, so the install is a no-op in practice.
34
+ Declare them anyway: a package your source imports belongs in your manifest,
35
+ or the day this package stops depending on them your build breaks.
36
+
37
+ ---
38
+
39
+ ## Quick start
40
+
41
+ Two things are required: **both stylesheets**, and a **container with a
42
+ height**.
43
+
44
+ ```tsx
45
+ 'use client'
46
+ import { FronteraChat } from '@frontera-sdk/chat-ui/chat'
47
+ import '@frontera-sdk/chat-ui/platform.css'
48
+ import '@frontera-sdk/chat-ui/styles.css'
49
+
50
+ export function Support() {
51
+ return (
52
+ <div className="h-dvh">
53
+ <FronteraChat tokenEndpoint="/api/chat-token" />
54
+ </div>
55
+ )
56
+ }
57
+ ```
58
+
59
+ `tokenEndpoint` is a route on **your** server returning
60
+ `{ token: string, expiresAt: string }` for the signed-in person. Building that
61
+ route is the other half of the integration — see [Tokens](#tokens).
62
+
63
+ ---
64
+
65
+ ## Credential
66
+
67
+ Pass exactly one. All four are mutually exclusive in the type.
68
+
69
+ | Prop | Type | Notes |
70
+ |---|---|---|
71
+ | `tokenEndpoint` | `string` | **Recommended.** URL on your server. Renewal handled for you; the API origin arrives with the token. |
72
+ | `token` + `apiBaseUrl` | `string` + `string` | You own replacing it before it expires. The chat stops when it does. |
73
+ | `getToken` | `() => Promise<{ token, expiresAt, apiBaseUrl? }>` | Called again on renewal. |
74
+ | `client` | `FronteraClient \| (() => FronteraClient \| null)` | You built one yourself, e.g. from `useChatClient`. |
75
+
76
+ ---
77
+
78
+ ## Props
79
+
80
+ Everything below is optional.
81
+
82
+ ### Composer
83
+
84
+ | Prop | Type | Default | What it does |
85
+ |---|---|---|---|
86
+ | `approvalSelector` | `boolean` | `true` | Approval-mode picker. `full` ("run without approval") only appears if the token carries the `approval-mode` capability. |
87
+ | `fileUpload` | `boolean` | `true` | Paperclip **and** drop-anywhere-on-the-conversation. `false` makes the whole surface inert. |
88
+ | `appsButton` | `boolean` | `false` | Plugins button — connect accounts before asking. Requires `connectRedirectUri`. |
89
+ | `shortcuts` | `Shortcut[]` | none | Starter cards on an empty conversation. Off by default: each default card needs a computer-equipped agent. |
90
+ | `modes` | `Record<string, ModelConfig>` | none | Model picker. Omit to hide it. |
91
+ | `modelMode` | `string` | — | Controlled mode key. |
92
+ | `defaultMode` | `string` | — | Initial mode key. |
93
+ | `placeholder` | `string` | `"Assign a task or ask anything..."` | Composer placeholder. |
94
+
95
+ ```ts
96
+ interface Shortcut {
97
+ id: string
98
+ label: string
99
+ description: string
100
+ prompt: string // dropped into the composer, not sent
101
+ }
102
+ ```
103
+
104
+ ### Conversation and agent
105
+
106
+ | Prop | Type | Default | What it does |
107
+ |---|---|---|---|
108
+ | `conversationId` | `string` | new each mount | Resume a thread. Key the component by it if you own a thread list. |
109
+ | `agentName` | `string` | person chooses | **Selects** the agent by slug or id, and hides the picker. Ignored when the credential already fixes the agent. |
110
+ | `agentLabel` | `string` | agent's own name | **Display** name above replies. The cosmetic one. |
111
+ | `agentId` | `string` | — | Agent UUID. Lets the composer offer that agent's apps and `@` mentions. |
112
+ | `agentPicker` | `boolean` | `true` | Shown only when the credential reaches more than one agent. |
113
+ | `body` | `Partial<StartChatRequest>` | — | Extra fields on every send, read at send time. `messages` and `conversationId` excluded. |
114
+
115
+ ### Layout and appearance
116
+
117
+ | Prop | Type | Default | What it does |
118
+ |---|---|---|---|
119
+ | `header` | `boolean` | `true` | The conversation's own header. |
120
+ | `sidePanel` | `boolean` | `true` | Artifact pane (desktop) / full-screen sheet (mobile), and the control that opens it. |
121
+ | `theme` | `FronteraChatTheme` | inherits | Design tokens, applied to the shell **and** the portal root. |
122
+ | `dark` | `boolean` | OS preference | Pin the scheme. **Pass it if your app has a theme toggle**, or the two disagree. |
123
+ | `className` | `string` | — | Added to the shell element. |
124
+ | `empty` | `ReactNode` | platform greeting | Replaces the new-session screen. |
125
+ | `mobileMenu` | `ReactNode` | none | Leading control in the mobile header — your session list. Nothing renders if omitted. Ignored ≥768px. |
126
+
127
+ ```ts
128
+ interface FronteraChatTheme {
129
+ background?: string; surface?: string; border?: string
130
+ text?: string; muted?: string
131
+ accent?: string; accentText?: string; danger?: string
132
+ radius?: string; fontFamily?: string
133
+ }
134
+ ```
135
+
136
+ ### Connect flow
137
+
138
+ | Prop | Type | What it does |
139
+ |---|---|---|
140
+ | `connectRedirectUri` | `string` | Your OAuth callback page. Without it the connect card explains what is missing instead of offering a dead button. |
141
+ | `connectOrigin` | `string` | Origin the callback posts from, when it differs from the redirect's. |
142
+
143
+ ### Events
144
+
145
+ | Prop | Type | When |
146
+ |---|---|---|
147
+ | `onStart` | `(info: { conversationId: string; runId: string }) => void` | A run starts. The hook for your own thread list. |
148
+ | `onError` | `(error: Error) => void` | Every transport and stream error. **Wire this** — without it failures are visible to the user and nowhere in your logs. |
149
+
150
+ ---
151
+
152
+ ## Tokens
153
+
154
+ The browser never holds your agent key. Your server exchanges it for a
155
+ short-lived, per-user `cht_` token.
156
+
157
+ Server-side only. Needs `@frontera-sdk/chat` and `@frontera-sdk/core` in your
158
+ manifest — see [Install](#install).
159
+
160
+ ```ts
161
+ // POST /api/chat-token — your server
162
+ import { FronteraClient } from '@frontera-sdk/core/client'
163
+ import { exchangeChatToken } from '@frontera-sdk/chat/auth'
164
+
165
+ const frontera = new FronteraClient({
166
+ apiBaseUrl: process.env.FRONTERA_API_URL!,
167
+ // Either key kind goes here, same shape — see "Which key" below.
168
+ credential: { kind: 'apiKey', key: process.env.FRONTERA_WORKSPACE_KEY! },
169
+ })
170
+
171
+ export async function POST(req: Request) {
172
+ const user = await currentUser(req) // YOUR session
173
+ if (!user) return new Response('unauthorized', { status: 401 })
174
+
175
+ return Response.json(
176
+ await exchangeChatToken(frontera, {
177
+ externalUserId: user.id, // never from the body
178
+ ttlSeconds: 1800, // 60–86400, default 3600
179
+ capabilities: ['plugin-connect'],
180
+ }),
181
+ )
182
+ }
183
+ ```
184
+
185
+ ### Which key
186
+
187
+ | | Agent key `sak_…` | Workspace key `sk-ws-…` |
188
+ |---|---|---|
189
+ | Reaches | exactly one agent, always | every chat agent in the workspace |
190
+ | Per-user choice | none — `agentId` naming a different agent is `403`, `agentIds` is `403` | `agentId` for one, `agentIds` for a subset (max 50) |
191
+ | Agent picker | never shown, nothing to pick | shown, limited to what you minted |
192
+ | If leaked | one agent | every chat agent |
193
+ | Extra requirement | — | must be scoped **`chat`**; an `mcp`-scoped key is refused, naming its scope |
194
+
195
+ One surface, one agent → agent key, and stop there. A picker, or different
196
+ agents for different customers → workspace key.
197
+
198
+ ```ts
199
+ // Workspace key only — narrowing what this person's token may reach.
200
+ await exchangeChatToken(frontera, {
201
+ externalUserId: user.id,
202
+ agentId: 'support-bot', // exactly one
203
+ // or
204
+ agentIds: ['support-bot', 'billing-bot'], // a subset; the picker shows these
205
+ })
206
+ ```
207
+
208
+ `agentId` and `agentName` both accept the agent's UUID or its slug; an unknown
209
+ one is `404`, never a silent fallback. Narrowing is enforced server-side —
210
+ filtering a picker in the browser looks identical and protects nothing.
211
+
212
+ ### Capabilities
213
+
214
+ | Capability | Default | Opens |
215
+ |---|---|---|
216
+ | *(base)* | always | Chat, history, own conversations, answering approvals |
217
+ | `plugin-connect` | on | Connecting their own account for a plugin |
218
+ | `schedule` | off | The agent's scheduled tasks |
219
+ | `agent-mode` | off | Work items, exchanges, handoffs |
220
+ | `approval-mode` | off | Choosing "run without approval" |
221
+
222
+ `externalUserId`, `capabilities`, `agentId` and `ttlSeconds` are privilege
223
+ decisions. Take each from your own session — if the caller can name the user,
224
+ any signed-in person can read someone else's conversations.
225
+
226
+ Renewal is automatic, up to a 12-hour session ceiling; after that your server
227
+ mints again.
228
+
229
+ ---
230
+
231
+ ## Other entry points
232
+
233
+ | Import | Gives you |
234
+ |---|---|
235
+ | `@frontera-sdk/chat-ui/chat` | `FronteraChat` — the whole surface |
236
+ | `@frontera-sdk/chat-ui/client` | `useChatClient`, `ChatClient`, public types — for your own sidebar |
237
+ | `@frontera-sdk/chat-ui/oauth-callback` | `FronteraOAuthCallback` — the connect callback page |
238
+ | `@frontera-sdk/chat-ui/new-session` | `buildDefaultShortcuts`, `Shortcut` |
239
+ | `@frontera-sdk/chat-ui/message`, `/composer`, `/parts`, `/header` | Compose your own layout |
240
+ | `@frontera-sdk/chat-ui/theme` | `FronteraChatTheme` |
241
+
242
+ Reading the conversation from your own chrome:
243
+
244
+ ```tsx
245
+ import { useChatClient, type Session } from '@frontera-sdk/chat-ui/client'
246
+
247
+ const { client, getClient } = useChatClient({ tokenEndpoint: '/api/chat-token' })
248
+ useEffect(() => {
249
+ client?.listSessions({ limit: 20 }).then(p => setThreads(p.data))
250
+ }, [client])
251
+
252
+ // Share the credential instead of minting a second token for the same person:
253
+ <FronteraChat client={getClient} conversationId={openId} />
254
+ ```
255
+
256
+ ---
257
+
258
+ ## Connecting a user's own account
259
+
260
+ For plugins that act as the person (their mail, their files). Four
261
+ prerequisites, all required:
262
+
263
+ 1. Register your callback URL with the provider (Google, Microsoft…).
264
+ 2. Add **your own** OAuth client in Frontera → Settings → Secrets. A provider
265
+ only authorises redirects on a domain its owner verified, so it cannot be
266
+ ours.
267
+ 3. Add the callback URL **and** your app's origin to the embed allowlist
268
+ (`POST /v1/apps/embed-allowlist`, needs a workspace member with
269
+ `app:configure`). No default, no wildcard.
270
+ 4. Mint tokens with `plugin-connect`.
271
+
272
+ ```tsx
273
+ // app/oauth/callback/page.tsx
274
+ 'use client'
275
+ import { FronteraOAuthCallback } from '@frontera-sdk/chat-ui/oauth-callback'
276
+ export default function Page() { return <FronteraOAuthCallback /> }
277
+ ```
278
+
279
+ ```tsx
280
+ <FronteraChat
281
+ tokenEndpoint="/api/chat-token"
282
+ connectRedirectUri="https://app.example.com/oauth/callback"
283
+ appsButton
284
+ />
285
+ ```
286
+
287
+ Popup by default, full-page redirect when popups are blocked.
288
+
289
+ ---
290
+
291
+ ## Mobile
292
+
293
+ Under 768px the component follows the platform rather than shrinking the
294
+ desktop layout:
295
+
296
+ - the side panel becomes a **full-screen sheet**, not a column;
297
+ - the header is **solid and in the flow**, with the title, a summary sheet and
298
+ a files list;
299
+ - `mobileMenu` renders at the head of that bar — your session list, your
300
+ component;
301
+ - the bar stays on a new session, captioned "New Session".
302
+
303
+ ---
304
+
305
+ ## Hazards
306
+
307
+ | | |
308
+ |---|---|
309
+ | **Your CSS reaches in** | A rule like `button { padding: 8px }` restyles every control in the chat. Scope yours: `button:not(.fr-shell *)`. Portalled dialogs carry `.fr-shell` too. |
310
+ | **One React** | Two copies break hooks — `Cannot read properties of null (reading 'useState')`. Check `npm ls react`. |
311
+ | **Height** | `.fr-shell` is `height: 100%`. A container without height collapses it. |
312
+ | **CSP** | Allow your Frontera API origin in `connect-src`. |
313
+
314
+ ---
315
+
316
+ ## Troubleshooting
317
+
318
+ | Symptom | Cause |
319
+ |---|---|
320
+ | Blank chat, no error | `onError` not wired |
321
+ | Nothing renders / zero height | Container has no height |
322
+ | `401` immediately | Token endpoint returned the wrong shape — must be `{ token, expiresAt }` |
323
+ | Chat stops after an hour | Using `token` without refresh; use `tokenEndpoint` |
324
+ | `useState` of null | Two Reacts |
325
+ | Controls look wrong | Host CSS styling bare elements |
326
+ | Connect button does nothing | `connectRedirectUri` missing, or URL not on the allowlist |
327
+ | Conversation stops with nothing to click | A parked approval — `GET /v1/chat/approvals?conversationId=…` with the same token |
328
+
329
+ ---
330
+
331
+ ## What the browser calls
332
+
333
+ For a CSP allowlist or a proxy. All against your Frontera API origin, with the
334
+ `cht_` token:
335
+
336
+ ```
337
+ POST /v1/chat conversation stream (SSE)
338
+ POST /v1/chat-tokens/renew refresh
339
+ GET /v1/chat-agents agent picker
340
+ GET /v1/sessions, /v1/sessions/:id history
341
+ PATCH /v1/sessions/:id title, approval mode
342
+ GET /v1/chat/approvals?conversationId=… parked decisions
343
+ POST /v1/chat/approvals/:id answer one
344
+ POST /v1/chat/app-connections/start|exchange|resume
345
+ POST /v1/chat-uploads attachments
346
+ GET /v1/chat-artifacts/:id[/file|/preview|/versions…]
347
+ PATCH /v1/chat-artifacts/:id save an edit
348
+ ```