@tangle-network/ui 11.12.0 → 11.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (276) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/dist/_virtual/_rolldown/runtime.js +13 -0
  3. package/dist/auth/auth.d.ts +53 -0
  4. package/dist/{auth-DOETfnd9.js → auth/auth.js} +7 -37
  5. package/dist/auth/login-layout.d.ts +20 -0
  6. package/dist/auth/login-layout.js +36 -0
  7. package/dist/auth.d.ts +2 -1
  8. package/dist/auth.js +2 -1
  9. package/dist/chat/agent-timeline.d.ts +83 -0
  10. package/dist/chat/agent-timeline.js +236 -0
  11. package/dist/chat/chat-container.d.ts +51 -0
  12. package/dist/chat/chat-container.js +309 -0
  13. package/dist/chat/chat-message.d.ts +22 -0
  14. package/dist/chat/chat-message.js +38 -0
  15. package/dist/chat/message-list.d.ts +32 -0
  16. package/dist/chat/message-list.js +37 -0
  17. package/dist/chat/thinking-indicator.d.ts +6 -0
  18. package/dist/chat/thinking-indicator.js +38 -0
  19. package/dist/chat/user-message.d.ts +21 -0
  20. package/dist/chat/user-message.js +42 -0
  21. package/dist/chat.d.ts +6 -1
  22. package/dist/chat.js +6 -1
  23. package/dist/editor/document-editor-pane.d.ts +37 -0
  24. package/dist/editor/document-editor-pane.js +199 -0
  25. package/dist/editor/editor-lazy.js +37 -0
  26. package/dist/editor/editor-loading.js +21 -0
  27. package/dist/editor/editor-peers.d.ts +6 -0
  28. package/dist/editor/editor-peers.js +155 -0
  29. package/dist/editor/editor-provider.d.ts +97 -0
  30. package/dist/editor/editor-provider.js +253 -0
  31. package/dist/editor/editor-toolbar.d.ts +11 -0
  32. package/dist/editor/editor-toolbar.js +106 -0
  33. package/dist/editor/markdown-conversion.js +23 -0
  34. package/dist/editor/markdown-document-editor.js +103 -0
  35. package/dist/editor/tiptap-editor.d.ts +45 -0
  36. package/dist/editor/tiptap-editor.js +271 -0
  37. package/dist/editor/use-editor.d.ts +67 -0
  38. package/dist/editor/use-editor.js +158 -0
  39. package/dist/editor.d.ts +6 -119
  40. package/dist/editor.js +5 -1
  41. package/dist/files/file-artifact-pane.d.ts +47 -0
  42. package/dist/files/file-artifact-pane.js +114 -0
  43. package/dist/files/file-format.d.ts +51 -0
  44. package/dist/{file-format-BgXbr-Ib.js → files/file-format.js} +1 -1
  45. package/dist/files/file-preview.d.ts +27 -0
  46. package/dist/files/file-preview.js +359 -0
  47. package/dist/files/file-tabs.d.ts +19 -0
  48. package/dist/files/file-tabs.js +48 -0
  49. package/dist/files/file-tree.d.ts +31 -0
  50. package/dist/files/file-tree.js +135 -0
  51. package/dist/files/rich-file-tree.d.ts +62 -0
  52. package/dist/files/rich-file-tree.js +122 -0
  53. package/dist/files.d.ts +6 -1
  54. package/dist/files.js +6 -2
  55. package/dist/hooks/use-auth.d.ts +40 -0
  56. package/dist/hooks/use-auth.js +91 -0
  57. package/dist/hooks/use-auto-scroll.d.ts +11 -0
  58. package/dist/hooks/use-auto-scroll.js +48 -0
  59. package/dist/hooks/use-dropdown-menu.d.ts +12 -0
  60. package/dist/hooks/use-dropdown-menu.js +31 -0
  61. package/dist/hooks/use-live-time.d.ts +7 -0
  62. package/dist/hooks/use-live-time.js +22 -0
  63. package/dist/hooks/use-realtime-session.d.ts +32 -0
  64. package/dist/hooks/use-realtime-session.js +235 -0
  65. package/dist/hooks/use-run-collapse-state.d.ts +13 -0
  66. package/dist/hooks/use-run-collapse-state.js +24 -0
  67. package/dist/hooks/use-run-groups.d.ts +11 -0
  68. package/dist/hooks/use-run-groups.js +85 -0
  69. package/dist/hooks/use-sdk-session.d.ts +59 -0
  70. package/dist/hooks/use-sdk-session.js +322 -0
  71. package/dist/hooks/use-sse-stream.d.ts +124 -0
  72. package/dist/hooks/use-sse-stream.js +229 -0
  73. package/dist/hooks/use-tool-call-stream.d.ts +23 -0
  74. package/dist/hooks/use-tool-call-stream.js +75 -0
  75. package/dist/hooks.d.ts +11 -49
  76. package/dist/hooks.js +10 -110
  77. package/dist/index.d.ts +99 -25
  78. package/dist/index.js +86 -36
  79. package/dist/lib/focus.d.ts +55 -0
  80. package/dist/{focus-BcE_SHqz.js → lib/focus.js} +1 -1
  81. package/dist/lib/utils.d.ts +4 -0
  82. package/dist/{utils-C_uf36nf.js → lib/utils.js} +1 -1
  83. package/dist/{code-block-B9miUPht.d.ts → markdown/code-block.d.ts} +5 -6
  84. package/dist/{code-block-B36KVUSN.js → markdown/code-block.js} +60 -55
  85. package/dist/{markdown-C0atSabr.d.ts → markdown/markdown.d.ts} +4 -5
  86. package/dist/{markdown-Db08KAYF.js → markdown/markdown.js} +3 -3
  87. package/dist/markdown.d.ts +2 -2
  88. package/dist/markdown.js +2 -2
  89. package/dist/{openui-artifact-renderer-fkBQaoLO.d.ts → openui/openui-artifact-renderer.d.ts} +20 -21
  90. package/dist/{openui-artifact-renderer-DG_i2lOR.js → openui/openui-artifact-renderer.js} +9 -7
  91. package/dist/{schema-BpW9rSSG.js → openui/schema-compiled.js} +2 -354
  92. package/dist/{schema-DAstk-J4.d.ts → openui/schema-data.d.ts} +3 -24
  93. package/dist/openui/schema-data.js +206 -0
  94. package/dist/openui-schema.d.ts +22 -3
  95. package/dist/openui-schema.js +138 -1
  96. package/dist/openui.d.ts +3 -2
  97. package/dist/openui.js +3 -2
  98. package/dist/{artifact-pane-BL_DFWNl.d.ts → primitives/artifact-pane.d.ts} +3 -4
  99. package/dist/{artifact-pane-DMXT9a8U.js → primitives/artifact-pane.js} +2 -2
  100. package/dist/primitives/avatar.d.ts +8 -0
  101. package/dist/primitives/avatar.js +25 -0
  102. package/dist/primitives/badge.d.ts +22 -0
  103. package/dist/primitives/badge.js +47 -0
  104. package/dist/{button-yoIv77e2.d.ts → primitives/button.d.ts} +2 -2
  105. package/dist/primitives/button.js +113 -0
  106. package/dist/primitives/card.d.ts +18 -0
  107. package/dist/primitives/card.js +52 -0
  108. package/dist/primitives/code-block.d.ts +6 -0
  109. package/dist/primitives/code-block.js +13 -0
  110. package/dist/primitives/dialog.d.ts +23 -0
  111. package/dist/primitives/dialog.js +59 -0
  112. package/dist/primitives/drop-zone.d.ts +23 -0
  113. package/dist/primitives/drop-zone.js +104 -0
  114. package/dist/primitives/dropdown-menu.d.ts +29 -0
  115. package/dist/{dropdown-menu-BpcLa5vF.js → primitives/dropdown-menu.js} +2 -23
  116. package/dist/primitives/empty-state.d.ts +11 -0
  117. package/dist/primitives/empty-state.js +32 -0
  118. package/dist/primitives/heading.d.ts +23 -0
  119. package/dist/primitives/heading.js +38 -0
  120. package/dist/primitives/input.d.ts +23 -0
  121. package/dist/primitives/input.js +110 -0
  122. package/dist/primitives/label.d.ts +6 -0
  123. package/dist/primitives/label.js +16 -0
  124. package/dist/primitives/metric-strip.d.ts +48 -0
  125. package/dist/primitives/metric-strip.js +52 -0
  126. package/dist/primitives/page-header.d.ts +25 -0
  127. package/dist/primitives/page-header.js +47 -0
  128. package/dist/primitives/page-shell.d.ts +14 -0
  129. package/dist/primitives/page-shell.js +17 -0
  130. package/dist/primitives/progress.d.ts +9 -0
  131. package/dist/primitives/progress.js +29 -0
  132. package/dist/primitives/segmented-control.d.ts +40 -0
  133. package/dist/primitives/segmented-control.js +57 -0
  134. package/dist/primitives/select.d.ts +15 -0
  135. package/dist/primitives/select.js +74 -0
  136. package/dist/primitives/sidebar-drop-zone.d.ts +21 -0
  137. package/dist/primitives/sidebar-drop-zone.js +88 -0
  138. package/dist/primitives/skeleton.d.ts +10 -0
  139. package/dist/primitives/skeleton.js +50 -0
  140. package/dist/primitives/stat-card.d.ts +16 -0
  141. package/dist/primitives/stat-card.js +60 -0
  142. package/dist/primitives/status-pill.d.ts +44 -0
  143. package/dist/primitives/status-pill.js +119 -0
  144. package/dist/primitives/switch.d.ts +6 -0
  145. package/dist/primitives/switch.js +16 -0
  146. package/dist/primitives/table.d.ts +22 -0
  147. package/dist/primitives/table.js +63 -0
  148. package/dist/primitives/tabs.d.ts +13 -0
  149. package/dist/{tabs-BVHR6NkO.js → primitives/tabs.js} +3 -3
  150. package/dist/primitives/terminal-display.d.ts +25 -0
  151. package/dist/primitives/terminal-display.js +109 -0
  152. package/dist/primitives/text-shimmer.d.ts +16 -0
  153. package/dist/{text-shimmer-BUUo6I-g.js → primitives/text-shimmer.js} +2 -2
  154. package/dist/primitives/theme-toggle.d.ts +11 -0
  155. package/dist/primitives/theme-toggle.js +154 -0
  156. package/dist/primitives/toast.d.ts +29 -0
  157. package/dist/primitives/toast.js +142 -0
  158. package/dist/primitives/toolbar.d.ts +55 -0
  159. package/dist/primitives/toolbar.js +37 -0
  160. package/dist/primitives/upload-progress.d.ts +23 -0
  161. package/dist/primitives/upload-progress.js +72 -0
  162. package/dist/primitives.d.ts +35 -5
  163. package/dist/primitives.js +35 -9
  164. package/dist/{index-COgqsFAQ.d.ts → redaction/redacted-document.d.ts} +6 -7
  165. package/dist/{redaction-CGGB2ENG.js → redaction/redacted-document.js} +2 -2
  166. package/dist/redaction.d.ts +1 -1
  167. package/dist/redaction.js +1 -1
  168. package/dist/run/expandable-content.js +41 -0
  169. package/dist/run/expanded-tool-detail.d.ts +12 -0
  170. package/dist/run/expanded-tool-detail.js +163 -0
  171. package/dist/run/inline-thinking-item.d.ts +11 -0
  172. package/dist/run/inline-thinking-item.js +60 -0
  173. package/dist/run/inline-tool-item.d.ts +25 -0
  174. package/dist/run/inline-tool-item.js +63 -0
  175. package/dist/run/run-group.d.ts +26 -0
  176. package/dist/{run-group-BWGeesgs.js → run/run-group.js} +9 -60
  177. package/dist/run/run-item-primitives.d.ts +5 -0
  178. package/dist/{run-ZsIKPA6J.js → run/run-item-primitives.js} +2 -2
  179. package/dist/run/run-row-shell.d.ts +53 -0
  180. package/dist/run/run-row-shell.js +114 -0
  181. package/dist/{tool-call-feed-BeB1_4pX.d.ts → run/tool-call-feed.d.ts} +7 -12
  182. package/dist/{tool-call-feed-BpmMLpPX.js → run/tool-call-feed.js} +4 -4
  183. package/dist/run/tool-call-step.d.ts +5 -0
  184. package/dist/run/tool-call-step.js +82 -0
  185. package/dist/run.d.ts +8 -2
  186. package/dist/run.js +7 -4
  187. package/dist/sdk-hooks.d.ts +8 -1
  188. package/dist/sdk-hooks.js +8 -2
  189. package/dist/stores/active-sessions-store.d.ts +83 -0
  190. package/dist/{active-sessions-store-Gt1R0rFG.js → stores/active-sessions-store.js} +1 -1
  191. package/dist/stores/chat-store.d.ts +14 -0
  192. package/dist/stores/chat-store.js +33 -0
  193. package/dist/stores.d.ts +3 -16
  194. package/dist/stores.js +2 -33
  195. package/dist/tool-previews/command-preview.d.ts +11 -0
  196. package/dist/tool-previews/command-preview.js +91 -0
  197. package/dist/tool-previews/diff-preview.d.ts +7 -0
  198. package/dist/tool-previews/diff-preview.js +76 -0
  199. package/dist/tool-previews/glob-results-preview.d.ts +7 -0
  200. package/dist/tool-previews/glob-results-preview.js +53 -0
  201. package/dist/tool-previews/grep-results-preview.d.ts +7 -0
  202. package/dist/tool-previews/grep-results-preview.js +99 -0
  203. package/dist/tool-previews/preview-primitives.js +58 -0
  204. package/dist/tool-previews/question-preview.d.ts +7 -0
  205. package/dist/tool-previews/question-preview.js +63 -0
  206. package/dist/tool-previews/web-search-preview.d.ts +7 -0
  207. package/dist/tool-previews/web-search-preview.js +78 -0
  208. package/dist/tool-previews/write-file-preview.d.ts +11 -0
  209. package/dist/tool-previews/write-file-preview.js +52 -0
  210. package/dist/tool-previews.d.ts +7 -1
  211. package/dist/tool-previews.js +7 -1
  212. package/dist/{branding-26d5ARIr.d.ts → types/branding.d.ts} +2 -3
  213. package/dist/{message-vhUI0c5G.d.ts → types/message.d.ts} +2 -3
  214. package/dist/{parts-5mhy9yJ3.d.ts → types/parts.d.ts} +8 -9
  215. package/dist/{run-OyWmIDqu.d.ts → types/run.d.ts} +9 -10
  216. package/dist/{tool-display-DgmL5rIU.d.ts → types/tool-display.d.ts} +5 -6
  217. package/dist/types.d.ts +5 -5
  218. package/dist/utils/copy-text.d.ts +7 -0
  219. package/dist/{utils-Bl_CZ0Qp.js → utils/copy-text.js} +1 -11
  220. package/dist/utils/format.d.ts +22 -0
  221. package/dist/{format-DfcLWqMa.js → utils/format.js} +1 -1
  222. package/dist/utils/time-ago.d.ts +3 -0
  223. package/dist/utils/time-ago.js +11 -0
  224. package/dist/utils/tool-display.d.ts +16 -0
  225. package/dist/{tool-display-BAuAVa43.js → utils/tool-display.js} +1 -1
  226. package/dist/utils.d.ts +6 -1
  227. package/dist/utils.js +6 -5
  228. package/package.json +2 -2
  229. package/src/files/rich-file-tree.stories.tsx +1 -1
  230. package/src/files/rich-file-tree.tsx +12 -9
  231. package/src/markdown/code-block.test.tsx +80 -2
  232. package/src/markdown/code-block.tsx +76 -80
  233. package/src/primitives/button.stories.tsx +37 -1
  234. package/src/primitives/button.test.tsx +230 -0
  235. package/src/primitives/button.tsx +62 -14
  236. package/src/primitives/card-anatomy.stories.tsx +51 -0
  237. package/src/primitives/card.test.tsx +71 -0
  238. package/src/primitives/card.tsx +25 -13
  239. package/src/primitives/heading.stories.tsx +35 -0
  240. package/src/primitives/heading.test.tsx +56 -0
  241. package/src/primitives/heading.tsx +76 -0
  242. package/src/primitives/index.ts +8 -0
  243. package/src/primitives/input.stories.tsx +28 -0
  244. package/src/primitives/input.test.tsx +161 -0
  245. package/src/primitives/input.tsx +34 -28
  246. package/src/primitives/page-header.stories.tsx +51 -0
  247. package/src/primitives/page-header.test.tsx +48 -0
  248. package/src/primitives/page-header.tsx +35 -35
  249. package/src/primitives/page-shell.stories.tsx +89 -0
  250. package/src/primitives/page-shell.test.tsx +24 -0
  251. package/src/primitives/page-shell.tsx +26 -0
  252. package/src/primitives/table-wrapper.stories.tsx +54 -0
  253. package/src/primitives/table.test.tsx +72 -0
  254. package/src/primitives/table.tsx +33 -12
  255. package/src/primitives/theme-toggle.test.tsx +167 -0
  256. package/src/primitives/theme-toggle.tsx +111 -39
  257. package/dist/active-sessions-store-nl70ZnMC.d.ts +0 -84
  258. package/dist/button-C87nEe2R.js +0 -78
  259. package/dist/chat-DDvF2oGQ.js +0 -672
  260. package/dist/diff-preview-BcK3nRXb.js +0 -533
  261. package/dist/document-editor-pane-BilJfiCo.d.ts +0 -136
  262. package/dist/document-editor-pane-POsq5Q0o.js +0 -1279
  263. package/dist/files-hywocVZz.js +0 -753
  264. package/dist/index-2UntyjBb.d.ts +0 -52
  265. package/dist/index-BgUHilZm.d.ts +0 -108
  266. package/dist/index-CJ8wRfiC.d.ts +0 -236
  267. package/dist/index-CPDET_s1.d.ts +0 -549
  268. package/dist/index-Cg6gYAqh.d.ts +0 -73
  269. package/dist/index-Cs7j8V7l.d.ts +0 -203
  270. package/dist/index-DjKxO357.d.ts +0 -128
  271. package/dist/primitives-Bx59fT-U.js +0 -1239
  272. package/dist/table-Bss73DhB.js +0 -146
  273. package/dist/tool-call-step-DNebqhmX.js +0 -434
  274. package/dist/use-auto-scroll-C5Pjeqon.js +0 -153
  275. package/dist/use-sse-stream-DjqRuDft.js +0 -884
  276. package/dist/use-sse-stream-Dm6R5YWz.d.ts +0 -282
@@ -0,0 +1,135 @@
1
+ import { cn } from "../lib/utils.js";
2
+ import { useState } from "react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
+ import { ChevronRight, File, FileCode, FileImage, FileJson, FileSpreadsheet, FileText, Folder, FolderOpen } from "lucide-react";
5
+ //#region src/files/file-tree.tsx
6
+ /**
7
+ * FileTree — directory browser with file type icons.
8
+ *
9
+ * Renders a hierarchical file system view. Clicking a file
10
+ * triggers onSelect with the full path.
11
+ */
12
+ function isNodeVisible(node, visibility) {
13
+ if (!visibility) return true;
14
+ if (visibility.hiddenPaths?.includes(node.path)) return false;
15
+ if (visibility.hiddenPathPrefixes?.some((prefix) => node.path === prefix || node.path.startsWith(`${prefix}/`))) return false;
16
+ return visibility.isVisible ? visibility.isVisible(node) : true;
17
+ }
18
+ function filterFileTree(root, visibility) {
19
+ if (!isNodeVisible(root, visibility)) return null;
20
+ if (root.type === "file") return root;
21
+ const children = (root.children ?? []).map((child) => filterFileTree(child, visibility)).filter((child) => child !== null);
22
+ if (root.children && root.children.length > 0 && children.length === 0) return null;
23
+ return {
24
+ ...root,
25
+ children
26
+ };
27
+ }
28
+ const FILE_ICONS = {
29
+ pdf: FileText,
30
+ csv: FileSpreadsheet,
31
+ xlsx: FileSpreadsheet,
32
+ xls: FileSpreadsheet,
33
+ py: FileCode,
34
+ ts: FileCode,
35
+ js: FileCode,
36
+ json: FileJson,
37
+ yaml: FileCode,
38
+ yml: FileCode,
39
+ md: FileText,
40
+ txt: FileText,
41
+ png: FileImage,
42
+ jpg: FileImage,
43
+ jpeg: FileImage,
44
+ gif: FileImage,
45
+ svg: FileImage
46
+ };
47
+ function getFileIcon(name) {
48
+ const ext = name.split(".").pop()?.toLowerCase() || "";
49
+ return FILE_ICONS[ext] || File;
50
+ }
51
+ function getFileColor(name) {
52
+ switch (name.split(".").pop()?.toLowerCase() || "") {
53
+ case "pdf": return "text-red-400";
54
+ case "py": return "text-yellow-400";
55
+ case "ts":
56
+ case "js": return "text-blue-400";
57
+ case "json": return "text-green-400";
58
+ case "yaml":
59
+ case "yml": return "text-[var(--accent-text)]";
60
+ case "csv":
61
+ case "xlsx": return "text-emerald-400";
62
+ case "md": return "text-foreground";
63
+ default: return "text-muted-foreground";
64
+ }
65
+ }
66
+ function TreeNode({ node, depth, selectedPath, onSelect, defaultExpanded }) {
67
+ const [expanded, setExpanded] = useState(defaultExpanded);
68
+ const isSelected = node.path === selectedPath;
69
+ const isDir = node.type === "directory";
70
+ const handleClick = () => {
71
+ if (isDir) setExpanded(!expanded);
72
+ onSelect?.(node.path, node);
73
+ };
74
+ const Icon = isDir ? expanded ? FolderOpen : Folder : getFileIcon(node.name);
75
+ const iconColor = isDir ? "text-primary" : getFileColor(node.name);
76
+ return /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("button", {
77
+ type: "button",
78
+ className: cn("flex items-center gap-1.5 w-full text-left px-2 py-[2px] cursor-pointer text-[13px] transition-colors", "appearance-none bg-transparent border-none", "hover:bg-accent", isSelected ? "bg-primary/15 text-foreground" : "text-foreground"),
79
+ style: { paddingLeft: `${depth * 16 + 8}px` },
80
+ onClick: handleClick,
81
+ "aria-expanded": isDir ? expanded : void 0,
82
+ children: [
83
+ isDir && /* @__PURE__ */ jsx(ChevronRight, { className: cn("h-3 w-3 shrink-0 text-muted-foreground transition-transform", expanded && "rotate-90") }),
84
+ !isDir && /* @__PURE__ */ jsx("span", { className: "w-3" }),
85
+ /* @__PURE__ */ jsx(Icon, { className: cn("h-4 w-4 shrink-0", iconColor) }),
86
+ /* @__PURE__ */ jsx("span", {
87
+ className: "truncate",
88
+ children: node.name
89
+ }),
90
+ node.size !== void 0 && !isDir && /* @__PURE__ */ jsx("span", {
91
+ className: "text-muted-foreground text-xs ml-auto tabular-nums",
92
+ children: formatSize(node.size)
93
+ })
94
+ ]
95
+ }), isDir && expanded && node.children && /* @__PURE__ */ jsx("div", { children: node.children.sort((a, b) => {
96
+ if (a.type !== b.type) return a.type === "directory" ? -1 : 1;
97
+ return a.name.localeCompare(b.name);
98
+ }).map((child) => /* @__PURE__ */ jsx(TreeNode, {
99
+ node: child,
100
+ depth: depth + 1,
101
+ selectedPath,
102
+ onSelect,
103
+ defaultExpanded
104
+ }, child.path)) })] });
105
+ }
106
+ function formatSize(bytes) {
107
+ if (bytes < 1024) return `${bytes}B`;
108
+ if (bytes < 1048576) return `${(bytes / 1024).toFixed(0)}K`;
109
+ return `${(bytes / 1048576).toFixed(1)}M`;
110
+ }
111
+ function FileTree({ root, selectedPath, onSelect, className, defaultExpanded = true, visibility }) {
112
+ const visibleRoot = filterFileTree(root, visibility);
113
+ if (!visibleRoot) return null;
114
+ return /* @__PURE__ */ jsx("div", {
115
+ className: cn("text-sm font-sans", className),
116
+ children: visibleRoot.children ? visibleRoot.children.sort((a, b) => {
117
+ if (a.type !== b.type) return a.type === "directory" ? -1 : 1;
118
+ return a.name.localeCompare(b.name);
119
+ }).map((child) => /* @__PURE__ */ jsx(TreeNode, {
120
+ node: child,
121
+ depth: 0,
122
+ selectedPath,
123
+ onSelect,
124
+ defaultExpanded
125
+ }, child.path)) : /* @__PURE__ */ jsx(TreeNode, {
126
+ node: visibleRoot,
127
+ depth: 0,
128
+ selectedPath,
129
+ onSelect,
130
+ defaultExpanded
131
+ })
132
+ });
133
+ }
134
+ //#endregion
135
+ export { FileTree, filterFileTree };
@@ -0,0 +1,62 @@
1
+ import { FileNode } from "./file-tree.js";
2
+ import { CSSProperties, ReactNode } from "react";
3
+ import { ContextMenuItem, ContextMenuOpenContext, GitStatus, GitStatusEntry } from "@pierre/trees";
4
+ //#region src/files/rich-file-tree.d.ts
5
+ /**
6
+ * Re-export Pierre's git-status union under a stable name so consumers
7
+ * don't import directly from the dep. If we ever swap the underlying
8
+ * implementation, only this file changes.
9
+ */
10
+ export type RichFileTreeGitStatus = GitStatus;
11
+ export type RichFileTreeGitEntry = GitStatusEntry;
12
+ export interface RichFileTreeProps {
13
+ /**
14
+ * Either a recursive `FileNode` tree (matches the existing FileTree
15
+ * input) or a flat list of canonical paths. Pass exactly one.
16
+ */
17
+ root?: FileNode;
18
+ paths?: ReadonlyArray<string>;
19
+ /** Currently-selected path. Pierre supports multi-select internally; the
20
+ * wrapper exposes a single string for parity with FileTree. */
21
+ selectedPath?: string;
22
+ /** Called whenever the selection changes (single-select fan-out). */
23
+ onSelect?: (path: string) => void;
24
+ /** Show the inline search input. Defaults to true. */
25
+ search?: boolean;
26
+ /** Open / closed initial expansion. Defaults to "open" — match FileTree. */
27
+ initialExpansion?: "open" | "closed";
28
+ /** Optional git-status decorations per path. */
29
+ gitStatus?: ReadonlyArray<RichFileTreeGitEntry>;
30
+ /**
31
+ * Right-click / button-lane menu content. Receives the row and the
32
+ * trigger context (which interaction opened the menu).
33
+ */
34
+ renderContextMenu?: (item: ContextMenuItem, context: ContextMenuOpenContext) => ReactNode;
35
+ /** Optional header rendered above the tree rows. */
36
+ header?: ReactNode;
37
+ /**
38
+ * Theme override map for shadow-DOM CSS variables. Most consumers can
39
+ * leave this — defaults reference the host's canonical color tokens.
40
+ */
41
+ themeOverrides?: Partial<RichFileTreeThemeVars>;
42
+ className?: string;
43
+ style?: CSSProperties;
44
+ /** Inline height (or set via `style.height`). Defaults to 100% of parent. */
45
+ height?: number | string;
46
+ }
47
+ export interface RichFileTreeThemeVars {
48
+ /** Selected-row background. */
49
+ selectedBg: string;
50
+ /** Selected-row foreground. */
51
+ selectedFg: string;
52
+ /** Default row foreground. */
53
+ fg: string;
54
+ /** Hover background. */
55
+ hoverBg: string;
56
+ /** Border / divider color. */
57
+ border: string;
58
+ /** Muted (parent path, breadcrumb) foreground. */
59
+ mutedFg: string;
60
+ }
61
+ export declare function RichFileTree({ root, paths, selectedPath, onSelect, search, initialExpansion, gitStatus, renderContextMenu, header, themeOverrides, className, style, height }: RichFileTreeProps): import("react").JSX.Element;
62
+ //#endregion
@@ -0,0 +1,122 @@
1
+ import { useEffect, useMemo } from "react";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { FileTree, useFileTree } from "@pierre/trees/react";
4
+ //#region src/files/rich-file-tree.tsx
5
+ /**
6
+ * RichFileTree — feature-rich file browser built on @pierre/trees.
7
+ *
8
+ * Why this exists alongside the existing FileTree:
9
+ * - Built-in search (cmd-K-style fuzzy filter)
10
+ * - Virtualized rendering for vaults with thousands of files
11
+ * - Git-status overlays per row (modified / added / staged)
12
+ * - Right-click + button-lane context menus with custom item rendering
13
+ * - VS Code-style icons via @pierre/vscode-icons (optional)
14
+ *
15
+ * The existing FileTree stays as-is for simple cases. RichFileTree is the
16
+ * upgrade path when a consumer's vault grows past a few hundred files or
17
+ * needs richer affordances.
18
+ *
19
+ * Pierre renders inside a shadow DOM to keep its CSS isolated. We bridge
20
+ * the host theme via CSS variables on the host element below — the tree
21
+ * picks them up through `--trees-*-override` overrides.
22
+ */
23
+ /**
24
+ * Map a Brand design token (e.g. `--accent-surface-soft`) to a CSS
25
+ * `var(--token)` reference. Pierre's CSS-variable surface accepts any
26
+ * valid CSS color expression, so passing `var(--token)` lets the host
27
+ * theme propagate through without us having to read computed styles.
28
+ */
29
+ function cssVarFromToken(name) {
30
+ return `var(${name})`;
31
+ }
32
+ const DEFAULT_THEME = {
33
+ selectedBg: cssVarFromToken("--accent-surface-soft"),
34
+ selectedFg: cssVarFromToken("--accent-text"),
35
+ fg: cssVarFromToken("--text-primary"),
36
+ hoverBg: cssVarFromToken("--bg-hover"),
37
+ border: cssVarFromToken("--border-default"),
38
+ mutedFg: cssVarFromToken("--text-muted")
39
+ };
40
+ /**
41
+ * Walk a recursive FileNode and return a flat list of canonical paths.
42
+ *
43
+ * Pierre infers directory structure from path segments — passing both
44
+ * `dir` and `dir/file.md` collides because `dir` looks like a file.
45
+ * We emit only files; pure-directory leaves get a trailing slash so
46
+ * Pierre keeps them as folders even when they have no children.
47
+ */
48
+ function flattenFileNode(node, out = []) {
49
+ if (node.type === "file" && node.path) {
50
+ out.push(node.path);
51
+ return out;
52
+ }
53
+ if (node.type === "directory") {
54
+ if (node.children?.length) {
55
+ for (const child of node.children) flattenFileNode(child, out);
56
+ return out;
57
+ }
58
+ if (node.path) out.push(`${node.path}/`);
59
+ }
60
+ return out;
61
+ }
62
+ function RichFileTree({ root, paths, selectedPath, onSelect, search = true, initialExpansion = "open", gitStatus, renderContextMenu, header, themeOverrides, className, style, height }) {
63
+ if (root && paths) throw new Error("RichFileTree: pass `root` or `paths`, not both");
64
+ const flatPaths = useMemo(() => {
65
+ if (paths) return Array.from(paths);
66
+ if (root) return flattenFileNode(root);
67
+ return [];
68
+ }, [paths, root]);
69
+ const { model } = useFileTree({
70
+ paths: flatPaths,
71
+ search,
72
+ initialExpansion,
73
+ onSelectionChange: (selected) => {
74
+ const next = selected[0];
75
+ if (next && next !== selectedPath) onSelect?.(next);
76
+ }
77
+ });
78
+ useEffect(() => {
79
+ if (!gitStatus) return;
80
+ model.setGitStatus(gitStatus);
81
+ }, [model, gitStatus]);
82
+ useEffect(() => {
83
+ model.resetPaths(flatPaths);
84
+ }, [model, flatPaths]);
85
+ useEffect(() => {
86
+ if (!selectedPath) return;
87
+ const current = model.getSelectedPaths();
88
+ if (current.length === 1 && current[0] === selectedPath) return;
89
+ model.setSelectedPaths?.([selectedPath]);
90
+ }, [model, selectedPath]);
91
+ const theme = {
92
+ ...DEFAULT_THEME,
93
+ ...themeOverrides
94
+ };
95
+ const themeStyle = useMemo(() => ({
96
+ ["--trees-selected-bg-override"]: theme.selectedBg,
97
+ ["--trees-selected-fg-override"]: theme.selectedFg,
98
+ ["--trees-focus-ring-color-override"]: theme.selectedFg,
99
+ ["--trees-selected-focused-border-color-override"]: theme.selectedFg,
100
+ ["--trees-bg-override"]: cssVarFromToken("--bg-root"),
101
+ ["--trees-input-bg-override"]: cssVarFromToken("--bg-input"),
102
+ ["--trees-fg-override"]: theme.fg,
103
+ ["--trees-bg-muted-override"]: theme.hoverBg,
104
+ ["--trees-border-color-override"]: theme.border,
105
+ ["--trees-fg-muted-override"]: theme.mutedFg,
106
+ height: height ?? "100%",
107
+ ...style
108
+ }), [
109
+ theme,
110
+ height,
111
+ style
112
+ ]);
113
+ return /* @__PURE__ */ jsx(FileTree, {
114
+ model,
115
+ header,
116
+ renderContextMenu,
117
+ className,
118
+ style: themeStyle
119
+ });
120
+ }
121
+ //#endregion
122
+ export { RichFileTree };
package/dist/files.d.ts CHANGED
@@ -1,2 +1,7 @@
1
- import { C as FileNode, D as filterFileTree, E as FileTreeVisibilityOptions, S as RichFileTreeThemeVars, T as FileTreeProps, _ as parseCsv, a as getCodeLanguage, b as RichFileTreeGitStatus, c as resolveFilePreviewKind, d as FileTabData, f as FileTabs, g as FilePreviewProps, h as FilePreview, i as fileExtension, l as FileArtifactPane, m as CSV_PREVIEW_ROW_LIMIT, n as FilePreviewKind, o as getFormatLabel, p as FileTabsProps, r as detectFileFormat, s as getSyntaxLanguage, t as FileFormat, u as FileArtifactPaneProps, v as RichFileTree, w as FileTree, x as RichFileTreeProps, y as RichFileTreeGitEntry } from "./index-CJ8wRfiC.js";
1
+ import { FileNode, FileTree, FileTreeProps, FileTreeVisibilityOptions, filterFileTree } from "./files/file-tree.js";
2
+ import { RichFileTree, RichFileTreeGitEntry, RichFileTreeGitStatus, RichFileTreeProps, RichFileTreeThemeVars } from "./files/rich-file-tree.js";
3
+ import { CSV_PREVIEW_ROW_LIMIT, FilePreview, FilePreviewProps, parseCsv } from "./files/file-preview.js";
4
+ import { FileTabData, FileTabs, FileTabsProps } from "./files/file-tabs.js";
5
+ import { FileArtifactPane, FileArtifactPaneProps } from "./files/file-artifact-pane.js";
6
+ import { FileFormat, FilePreviewKind, detectFileFormat, fileExtension, getCodeLanguage, getFormatLabel, getSyntaxLanguage, resolveFilePreviewKind } from "./files/file-format.js";
2
7
  export { CSV_PREVIEW_ROW_LIMIT, FileArtifactPane, type FileArtifactPaneProps, type FileFormat, type FileNode, FilePreview, type FilePreviewKind, type FilePreviewProps, type FileTabData, FileTabs, type FileTabsProps, FileTree, type FileTreeProps, type FileTreeVisibilityOptions, RichFileTree, type RichFileTreeGitEntry, type RichFileTreeGitStatus, type RichFileTreeProps, type RichFileTreeThemeVars, detectFileFormat, fileExtension, filterFileTree, getCodeLanguage, getFormatLabel, getSyntaxLanguage, parseCsv, resolveFilePreviewKind };
package/dist/files.js CHANGED
@@ -1,3 +1,7 @@
1
- import { a as getSyntaxLanguage, i as getFormatLabel, n as fileExtension, o as resolveFilePreviewKind, r as getCodeLanguage, t as detectFileFormat } from "./file-format-BgXbr-Ib.js";
2
- import { a as parseCsv, c as filterFileTree, i as FilePreview, n as FileTabs, o as RichFileTree, r as CSV_PREVIEW_ROW_LIMIT, s as FileTree, t as FileArtifactPane } from "./files-hywocVZz.js";
1
+ import { detectFileFormat, fileExtension, getCodeLanguage, getFormatLabel, getSyntaxLanguage, resolveFilePreviewKind } from "./files/file-format.js";
2
+ import { FileTree, filterFileTree } from "./files/file-tree.js";
3
+ import { RichFileTree } from "./files/rich-file-tree.js";
4
+ import { CSV_PREVIEW_ROW_LIMIT, FilePreview, parseCsv } from "./files/file-preview.js";
5
+ import { FileTabs } from "./files/file-tabs.js";
6
+ import { FileArtifactPane } from "./files/file-artifact-pane.js";
3
7
  export { CSV_PREVIEW_ROW_LIMIT, FileArtifactPane, FilePreview, FileTabs, FileTree, RichFileTree, detectFileFormat, fileExtension, filterFileTree, getCodeLanguage, getFormatLabel, getSyntaxLanguage, parseCsv, resolveFilePreviewKind };
@@ -0,0 +1,40 @@
1
+ //#region src/hooks/use-auth.d.ts
2
+ export interface AuthUser {
3
+ customer_id: string;
4
+ email: string;
5
+ name?: string;
6
+ tier: string;
7
+ github?: {
8
+ login: string;
9
+ connected: boolean;
10
+ } | null;
11
+ session_expires_at?: string;
12
+ }
13
+ export interface UseAuthOptions {
14
+ apiBaseUrl: string;
15
+ revalidateOnFocus?: boolean;
16
+ shouldRetryOnError?: boolean;
17
+ }
18
+ export interface UseAuthResult {
19
+ user: AuthUser | null;
20
+ isLoading: boolean;
21
+ isError: boolean;
22
+ error: Error | null;
23
+ mutate: () => Promise<void>;
24
+ }
25
+ /**
26
+ * Hook for managing authentication state.
27
+ * Fetches user session from the API and provides loading/error states.
28
+ */
29
+ export declare function useAuth({ apiBaseUrl, revalidateOnFocus, shouldRetryOnError }: UseAuthOptions): UseAuthResult;
30
+ /**
31
+ * Creates a fetcher function that includes auth credentials.
32
+ * Uses both cookie-based session and localStorage API key for backwards compatibility.
33
+ */
34
+ export declare function createAuthFetcher(_apiBaseUrl: string): <T = unknown>(url: string, options?: RequestInit) => Promise<T>;
35
+ /**
36
+ * Hook to get the API key from localStorage.
37
+ * For backwards compatibility with API key-based auth.
38
+ */
39
+ export declare function useApiKey(): string | null;
40
+ //#endregion
@@ -0,0 +1,91 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ //#region src/hooks/use-auth.ts
4
+ /**
5
+ * Hook for managing authentication state.
6
+ * Fetches user session from the API and provides loading/error states.
7
+ */
8
+ function useAuth({ apiBaseUrl, revalidateOnFocus = false, shouldRetryOnError = false }) {
9
+ const [user, setUser] = React.useState(null);
10
+ const [isLoading, setIsLoading] = React.useState(true);
11
+ const [error, setError] = React.useState(null);
12
+ const retryTimerRef = React.useRef(null);
13
+ const abortRef = React.useRef(null);
14
+ const fetchSession = React.useCallback(async () => {
15
+ abortRef.current?.abort();
16
+ const controller = new AbortController();
17
+ abortRef.current = controller;
18
+ setIsLoading(true);
19
+ setError(null);
20
+ try {
21
+ const res = await fetch(`${apiBaseUrl}/auth/session`, {
22
+ credentials: "include",
23
+ signal: controller.signal
24
+ });
25
+ if (!res.ok) throw new Error("Not authenticated");
26
+ const data = await res.json();
27
+ if (data.success && data.data) setUser(data.data);
28
+ else setUser(null);
29
+ } catch (err) {
30
+ if (err.name === "AbortError") return;
31
+ setError(err instanceof Error ? err : /* @__PURE__ */ new Error("Unknown error"));
32
+ setUser(null);
33
+ if (shouldRetryOnError) {
34
+ if (retryTimerRef.current) clearTimeout(retryTimerRef.current);
35
+ retryTimerRef.current = setTimeout(fetchSession, 5e3);
36
+ }
37
+ } finally {
38
+ if (!controller.signal.aborted) setIsLoading(false);
39
+ }
40
+ }, [apiBaseUrl, shouldRetryOnError]);
41
+ React.useEffect(() => {
42
+ fetchSession();
43
+ return () => {
44
+ abortRef.current?.abort();
45
+ if (retryTimerRef.current) clearTimeout(retryTimerRef.current);
46
+ };
47
+ }, [fetchSession]);
48
+ React.useEffect(() => {
49
+ if (!revalidateOnFocus) return;
50
+ const handleFocus = () => {
51
+ fetchSession();
52
+ };
53
+ window.addEventListener("focus", handleFocus);
54
+ return () => window.removeEventListener("focus", handleFocus);
55
+ }, [revalidateOnFocus, fetchSession]);
56
+ return {
57
+ user,
58
+ isLoading,
59
+ isError: !!error,
60
+ error,
61
+ mutate: fetchSession
62
+ };
63
+ }
64
+ /**
65
+ * Creates a fetcher function that includes auth credentials.
66
+ * Uses both cookie-based session and localStorage API key for backwards compatibility.
67
+ */
68
+ function createAuthFetcher(_apiBaseUrl) {
69
+ return async function authFetcher(url, options) {
70
+ const res = await fetch(url, {
71
+ ...options,
72
+ credentials: "include",
73
+ headers: { ...options?.headers }
74
+ });
75
+ if (!res.ok) throw new Error(`Request failed with status ${res.status}`);
76
+ return res.json();
77
+ };
78
+ }
79
+ /**
80
+ * Hook to get the API key from localStorage.
81
+ * For backwards compatibility with API key-based auth.
82
+ */
83
+ function useApiKey() {
84
+ const [apiKey, setApiKey] = React.useState(null);
85
+ React.useEffect(() => {
86
+ if (typeof window !== "undefined") setApiKey(localStorage.getItem("apiKey"));
87
+ }, []);
88
+ return apiKey;
89
+ }
90
+ //#endregion
91
+ export { createAuthFetcher, useApiKey, useAuth };
@@ -0,0 +1,11 @@
1
+ import { RefObject } from "react";
2
+ //#region src/hooks/use-auto-scroll.d.ts
3
+ /**
4
+ * Scroll-to-bottom behaviour: sticks to the bottom while streaming,
5
+ * pauses when user scrolls up, resumes when user scrolls back down.
6
+ */
7
+ export declare function useAutoScroll(containerRef: RefObject<HTMLElement | null>, deps?: unknown[]): {
8
+ isAtBottom: boolean;
9
+ scrollToBottom: () => void;
10
+ };
11
+ //#endregion
@@ -0,0 +1,48 @@
1
+ import { useCallback, useEffect, useRef, useState } from "react";
2
+ //#region src/hooks/use-auto-scroll.ts
3
+ const BOTTOM_THRESHOLD = 40;
4
+ /**
5
+ * Scroll-to-bottom behaviour: sticks to the bottom while streaming,
6
+ * pauses when user scrolls up, resumes when user scrolls back down.
7
+ */
8
+ function useAutoScroll(containerRef, deps = []) {
9
+ const [isAtBottom, setIsAtBottom] = useState(true);
10
+ const userScrolledUp = useRef(false);
11
+ const checkBottom = useCallback(() => {
12
+ const el = containerRef.current;
13
+ if (!el) return true;
14
+ return el.scrollHeight - el.scrollTop - el.clientHeight < BOTTOM_THRESHOLD;
15
+ }, [containerRef]);
16
+ useEffect(() => {
17
+ const el = containerRef.current;
18
+ if (!el) return;
19
+ const onScroll = () => {
20
+ const atBottom = checkBottom();
21
+ setIsAtBottom(atBottom);
22
+ userScrolledUp.current = !atBottom;
23
+ };
24
+ el.addEventListener("scroll", onScroll, { passive: true });
25
+ return () => el.removeEventListener("scroll", onScroll);
26
+ }, [containerRef, checkBottom]);
27
+ useEffect(() => {
28
+ if (userScrolledUp.current) return;
29
+ const el = containerRef.current;
30
+ if (!el) return;
31
+ el.scrollTop = el.scrollHeight;
32
+ }, deps);
33
+ return {
34
+ isAtBottom,
35
+ scrollToBottom: useCallback(() => {
36
+ const el = containerRef.current;
37
+ if (!el) return;
38
+ userScrolledUp.current = false;
39
+ el.scrollTo({
40
+ top: el.scrollHeight,
41
+ behavior: "smooth"
42
+ });
43
+ setIsAtBottom(true);
44
+ }, [containerRef])
45
+ };
46
+ }
47
+ //#endregion
48
+ export { useAutoScroll };
@@ -0,0 +1,12 @@
1
+ //#region src/hooks/use-dropdown-menu.d.ts
2
+ interface UseDropdownMenuOptions {
3
+ closeOnEsc?: boolean;
4
+ }
5
+ export declare function useDropdownMenu(options?: UseDropdownMenuOptions): {
6
+ open: boolean;
7
+ setOpen: import("react").Dispatch<import("react").SetStateAction<boolean>>;
8
+ ref: import("react").RefObject<HTMLDivElement | null>;
9
+ toggle: () => void;
10
+ close: () => void;
11
+ };
12
+ //#endregion
@@ -0,0 +1,31 @@
1
+ import { useEffect, useRef, useState } from "react";
2
+ //#region src/hooks/use-dropdown-menu.ts
3
+ function useDropdownMenu(options) {
4
+ const closeOnEsc = options?.closeOnEsc ?? true;
5
+ const [open, setOpen] = useState(false);
6
+ const ref = useRef(null);
7
+ useEffect(() => {
8
+ function handleClick(e) {
9
+ if (ref.current && !ref.current.contains(e.target)) setOpen(false);
10
+ }
11
+ if (open) document.addEventListener("mousedown", handleClick);
12
+ return () => document.removeEventListener("mousedown", handleClick);
13
+ }, [open]);
14
+ useEffect(() => {
15
+ if (!open || !closeOnEsc) return;
16
+ function handleKey(e) {
17
+ if (e.key === "Escape") setOpen(false);
18
+ }
19
+ document.addEventListener("keydown", handleKey);
20
+ return () => document.removeEventListener("keydown", handleKey);
21
+ }, [open, closeOnEsc]);
22
+ return {
23
+ open,
24
+ setOpen,
25
+ ref,
26
+ toggle: () => setOpen((prev) => !prev),
27
+ close: () => setOpen(false)
28
+ };
29
+ }
30
+ //#endregion
31
+ export { useDropdownMenu };
@@ -0,0 +1,7 @@
1
+ //#region src/hooks/use-live-time.d.ts
2
+ /**
3
+ * Returns `Date.now()` and re-renders every `intervalMs` so derived
4
+ * values like "uptime" tick forward without polling upstream data.
5
+ */
6
+ export declare function useLiveTime(intervalMs?: number): number;
7
+ //#endregion
@@ -0,0 +1,22 @@
1
+ "use client";
2
+ import * as React from "react";
3
+ //#region src/hooks/use-live-time.ts
4
+ /**
5
+ * Returns `Date.now()` and re-renders every `intervalMs` so derived
6
+ * values like "uptime" tick forward without polling upstream data.
7
+ */
8
+ function useLiveTime(intervalMs = 1e3) {
9
+ const [now, setNow] = React.useState(() => Date.now());
10
+ React.useEffect(() => {
11
+ const delay = Math.max(Number.isFinite(intervalMs) && intervalMs > 0 ? intervalMs : 1e3, 100);
12
+ const id = window.setInterval(() => {
13
+ setNow(Date.now());
14
+ }, delay);
15
+ return () => {
16
+ window.clearInterval(id);
17
+ };
18
+ }, [intervalMs]);
19
+ return now;
20
+ }
21
+ //#endregion
22
+ export { useLiveTime };
@@ -0,0 +1,32 @@
1
+ import { SdkSessionEvent } from "./use-sdk-session.js";
2
+ import { ActiveSessionConnectionState, ActiveSessionTransportMode, RegisterActiveSessionOptions } from "../stores/active-sessions-store.js";
3
+ //#region src/hooks/use-realtime-session.d.ts
4
+ export interface RealtimeSessionOptions extends RegisterActiveSessionOptions {
5
+ connectUrl?: string | null;
6
+ enabled?: boolean;
7
+ foreground?: boolean;
8
+ keepRegistered?: boolean;
9
+ reconnect?: boolean;
10
+ reconnectIntervalMs?: number;
11
+ maxReconnectAttempts?: number;
12
+ transportMode?: ActiveSessionTransportMode;
13
+ onEvent?: (event: SdkSessionEvent) => void;
14
+ onOpen?: () => void;
15
+ onClose?: () => void;
16
+ onError?: (error: Error) => void;
17
+ }
18
+ export interface RealtimeSessionState {
19
+ connectionState: ActiveSessionConnectionState;
20
+ lastError: string | null;
21
+ reconnectAttempts: number;
22
+ isConnected: boolean;
23
+ }
24
+ export interface RealtimeSessionTarget extends RealtimeSessionOptions {
25
+ key?: string;
26
+ }
27
+ export interface RealtimeSessionRegistryProps {
28
+ sessions: RealtimeSessionTarget[];
29
+ }
30
+ export declare function useRealtimeSession({ sessionId, projectId, projectLabel, title, href, metadata, connectUrl, enabled, foreground, keepRegistered, reconnect, reconnectIntervalMs, maxReconnectAttempts, transportMode, onEvent, onOpen, onClose, onError }: RealtimeSessionOptions): RealtimeSessionState;
31
+ export declare function RealtimeSessionRegistry({ sessions }: RealtimeSessionRegistryProps): import("react").FunctionComponentElement<RealtimeSessionTarget>[];
32
+ //#endregion