@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
@@ -1,220 +1,4 @@
1
- //#region \0rolldown/runtime.js
2
- var __defProp = Object.defineProperty;
3
- var __exportAll = (all, no_symbols) => {
4
- let target = {};
5
- for (var name in all) __defProp(target, name, {
6
- get: all[name],
7
- enumerable: true
8
- });
9
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
10
- return target;
11
- };
12
- //#endregion
13
- //#region src/openui/schema-data.ts
14
- const OPENUI_NODE_TYPES = [
15
- "heading",
16
- "text",
17
- "badge",
18
- "stat",
19
- "key_value",
20
- "code",
21
- "markdown",
22
- "table",
23
- "actions",
24
- "separator",
25
- "stack",
26
- "grid",
27
- "card"
28
- ];
29
- const string = { type: "string" };
30
- const boolean = { type: "boolean" };
31
- const gap = { enum: [
32
- "sm",
33
- "md",
34
- "lg"
35
- ] };
36
- const primitive = { type: [
37
- "string",
38
- "number",
39
- "boolean",
40
- "null"
41
- ] };
42
- const children = {
43
- type: "array",
44
- minItems: 1,
45
- items: { $ref: "#/$defs/node" }
46
- };
47
- const actions$1 = {
48
- type: "array",
49
- minItems: 1,
50
- items: { $ref: "#/$defs/action" }
51
- };
52
- function node(type, fields, required = []) {
53
- return {
54
- type: "object",
55
- required: ["type", ...required],
56
- properties: {
57
- type: { const: type },
58
- id: string,
59
- ...fields
60
- },
61
- additionalProperties: false
62
- };
63
- }
64
- /**
65
- * The model-facing shape and the persistence gate share this exact schema.
66
- * It covers JSON authored by an agent, not the renderer's programmatic ReactNode
67
- * cells or onPress callbacks.
68
- */
69
- const OPENUI_NODE_JSON_SCHEMA = {
70
- type: "object",
71
- $ref: "#/$defs/node",
72
- $defs: {
73
- node: { oneOf: OPENUI_NODE_TYPES.map((type) => ({ $ref: `#/$defs/${type}` })) },
74
- action: {
75
- type: "object",
76
- required: ["id", "label"],
77
- properties: {
78
- id: string,
79
- label: string,
80
- tone: { enum: [
81
- "default",
82
- "secondary",
83
- "outline",
84
- "ghost",
85
- "destructive"
86
- ] },
87
- disabled: boolean
88
- },
89
- additionalProperties: false
90
- },
91
- heading: node("heading", {
92
- text: string,
93
- level: { enum: [
94
- 1,
95
- 2,
96
- 3,
97
- 4
98
- ] },
99
- kicker: string,
100
- meta: string
101
- }, ["text"]),
102
- text: node("text", {
103
- text: string,
104
- tone: { enum: [
105
- "default",
106
- "muted",
107
- "success",
108
- "warning",
109
- "error"
110
- ] },
111
- mono: boolean
112
- }, ["text"]),
113
- badge: node("badge", {
114
- label: string,
115
- tone: { enum: [
116
- "default",
117
- "secondary",
118
- "success",
119
- "warning",
120
- "error",
121
- "info",
122
- "sandbox"
123
- ] }
124
- }, ["label"]),
125
- stat: node("stat", {
126
- label: string,
127
- value: string,
128
- change: string,
129
- tone: { enum: [
130
- "default",
131
- "success",
132
- "warning",
133
- "error",
134
- "info"
135
- ] }
136
- }, ["label", "value"]),
137
- key_value: node("key_value", { items: {
138
- type: "array",
139
- minItems: 1,
140
- items: {
141
- type: "object",
142
- required: ["label", "value"],
143
- properties: {
144
- id: string,
145
- label: string,
146
- value: primitive,
147
- tone: { enum: ["default", "muted"] }
148
- },
149
- additionalProperties: false
150
- }
151
- } }, ["items"]),
152
- code: node("code", {
153
- code: string,
154
- language: string,
155
- title: string,
156
- showLineNumbers: boolean
157
- }, ["code"]),
158
- markdown: node("markdown", { content: string }, ["content"]),
159
- table: node("table", {
160
- columns: {
161
- type: "array",
162
- minItems: 1,
163
- items: {
164
- type: "object",
165
- required: ["key", "header"],
166
- properties: {
167
- key: string,
168
- header: string,
169
- align: { enum: ["left", "right"] }
170
- },
171
- additionalProperties: false
172
- }
173
- },
174
- rows: {
175
- type: "array",
176
- items: {
177
- type: "object",
178
- additionalProperties: primitive
179
- }
180
- },
181
- caption: string
182
- }, ["columns", "rows"]),
183
- actions: node("actions", { actions: actions$1 }, ["actions"]),
184
- separator: node("separator", { label: string }),
185
- stack: node("stack", {
186
- direction: { enum: ["row", "column"] },
187
- gap,
188
- align: { enum: [
189
- "start",
190
- "center",
191
- "end",
192
- "stretch"
193
- ] },
194
- wrap: boolean,
195
- children
196
- }, ["children"]),
197
- grid: node("grid", {
198
- columns: { enum: [
199
- 1,
200
- 2,
201
- 3,
202
- 4
203
- ] },
204
- gap,
205
- children
206
- }, ["children"]),
207
- card: node("card", {
208
- title: string,
209
- description: string,
210
- eyebrow: string,
211
- badge: { $ref: "#/$defs/badge" },
212
- actions: actions$1,
213
- children
214
- })
215
- }
216
- };
217
- //#endregion
1
+ import { __exportAll } from "../_virtual/_rolldown/runtime.js";
218
2
  //#region src/openui/schema-compiled.ts
219
3
  var schema_compiled_exports = /* @__PURE__ */ __exportAll({
220
4
  actions: () => actions,
@@ -9615,140 +9399,4 @@ function validate44(data, { instancePath = "", parentData, parentDataProperty, r
9615
9399
  return errors === 0;
9616
9400
  }
9617
9401
  //#endregion
9618
- //#region src/openui/schema.ts
9619
- const nodeTypes = new Set(OPENUI_NODE_TYPES);
9620
- /** Find an unsupported node at any depth before the renderer can omit it. */
9621
- function findUnsupportedOpenUINode(value) {
9622
- const seen = /* @__PURE__ */ new WeakSet();
9623
- let count = 0;
9624
- function visit(candidate, path, depth) {
9625
- if (depth > 32 || ++count > 1e3) return {
9626
- path,
9627
- message: "OpenUI exceeds the 32-level or 1000-node limit."
9628
- };
9629
- if (!candidate || typeof candidate !== "object" || Array.isArray(candidate)) return {
9630
- path,
9631
- message: "Expected an OpenUI node object."
9632
- };
9633
- if (seen.has(candidate)) return {
9634
- path,
9635
- message: "OpenUI nodes must not contain cycles."
9636
- };
9637
- seen.add(candidate);
9638
- const record = candidate;
9639
- if (typeof record.type !== "string" || !nodeTypes.has(record.type)) return {
9640
- path,
9641
- message: `Unsupported OpenUI node type: ${String(record.type)}.`
9642
- };
9643
- if (record.type === "stack" || record.type === "grid" || record.type === "card") {
9644
- if (Array.isArray(record.children)) for (const [index, child] of record.children.entries()) {
9645
- const issue = visit(child, `${path}.children[${index}]`, depth + 1);
9646
- if (issue) return issue;
9647
- }
9648
- }
9649
- if (record.type === "card" && record.badge !== void 0) return visit(record.badge, `${path}.badge`, depth + 1);
9650
- return null;
9651
- }
9652
- if (Array.isArray(value)) {
9653
- for (const [index, candidate] of value.entries()) {
9654
- const issue = visit(candidate, `$[${index}]`, 0);
9655
- if (issue) return issue;
9656
- }
9657
- return null;
9658
- }
9659
- return visit(value, "$", 0);
9660
- }
9661
- /** Validate one model-authored JSON node before a product persists or spends on it. */
9662
- function validateOpenUIJsonNode(value) {
9663
- if (Array.isArray(value)) return {
9664
- ok: false,
9665
- issue: {
9666
- path: "$",
9667
- message: "Expected one OpenUI node object; use validateOpenUIJsonArtifact for arrays."
9668
- }
9669
- };
9670
- const unsupported = findUnsupportedOpenUINode(value);
9671
- if (unsupported) return {
9672
- ok: false,
9673
- issue: unsupported
9674
- };
9675
- const result = validateNode(value, "$", 0);
9676
- return result.ok ? {
9677
- ok: true,
9678
- value
9679
- } : result;
9680
- }
9681
- /** Validate the renderer's single-node or nonempty node-array artifact shape. */
9682
- function validateOpenUIJsonArtifact(value) {
9683
- if (!Array.isArray(value)) return validateOpenUIJsonNode(value);
9684
- if (value.length === 0) return {
9685
- ok: false,
9686
- issue: {
9687
- path: "$",
9688
- message: "An OpenUI artifact needs at least one node."
9689
- }
9690
- };
9691
- const unsupported = findUnsupportedOpenUINode(value);
9692
- if (unsupported) return {
9693
- ok: false,
9694
- issue: unsupported
9695
- };
9696
- for (const [index, node] of value.entries()) {
9697
- const result = validateOpenUIJsonNode(node);
9698
- if (!result.ok) return {
9699
- ok: false,
9700
- issue: {
9701
- ...result.issue,
9702
- path: `$[${index}]${result.issue.path.slice(1)}`
9703
- }
9704
- };
9705
- }
9706
- return {
9707
- ok: true,
9708
- value
9709
- };
9710
- }
9711
- function validateNode(record, path, depth) {
9712
- if (depth > 32) return {
9713
- ok: false,
9714
- issue: {
9715
- path,
9716
- message: "OpenUI exceeds the 32-level limit."
9717
- }
9718
- };
9719
- if (record.type === "stack" || record.type === "grid" || record.type === "card") {
9720
- if (Array.isArray(record.children)) for (const [index, child] of record.children.entries()) {
9721
- const result = validateNode(child, `${path}.children[${index}]`, depth + 1);
9722
- if (!result.ok) return result;
9723
- }
9724
- }
9725
- if (record.type === "card" && record.badge && typeof record.badge === "object") {
9726
- const result = validateNode(record.badge, `${path}.badge`, depth + 1);
9727
- if (!result.ok) return result;
9728
- }
9729
- const validator = schema_compiled_exports[record.type];
9730
- if (!validator(record)) {
9731
- const error = validator.errors?.[0];
9732
- const field = error?.keyword === "required" ? String(error.params.missingProperty) : error?.keyword === "additionalProperties" ? String(error.params.additionalProperty) : null;
9733
- return {
9734
- ok: false,
9735
- issue: {
9736
- path: `${path}${`${error?.instancePath ?? ""}${field ? `/${field}` : ""}`.replaceAll(/\/(\d+)/g, "[$1]").replaceAll("/", ".")}`,
9737
- message: error?.message ?? "Invalid OpenUI node."
9738
- }
9739
- };
9740
- }
9741
- if (record.type === "table") {
9742
- const columns = new Set(record.columns.map((column) => column.key));
9743
- for (const [index, row] of record.rows.entries()) for (const key of Object.keys(row)) if (!columns.has(key)) return {
9744
- ok: false,
9745
- issue: {
9746
- path: `${path}.rows[${index}].${key}`,
9747
- message: `Table cell ${key} has no displayed column.`
9748
- }
9749
- };
9750
- }
9751
- return { ok: true };
9752
- }
9753
- //#endregion
9754
- export { OPENUI_NODE_TYPES as a, OPENUI_NODE_JSON_SCHEMA as i, validateOpenUIJsonArtifact as n, __exportAll as o, validateOpenUIJsonNode as r, findUnsupportedOpenUINode as t };
9402
+ export { actions, badge, card, code, grid, heading, key_value, markdown, schema_compiled_exports, separator, stack, stat, table, text };
@@ -1,12 +1,11 @@
1
- import { c as OpenUIComponentNode } from "./openui-artifact-renderer-fkBQaoLO.js";
2
1
  //#region src/openui/schema-data.d.ts
3
- declare const OPENUI_NODE_TYPES: readonly ["heading", "text", "badge", "stat", "key_value", "code", "markdown", "table", "actions", "separator", "stack", "grid", "card"];
2
+ export declare const OPENUI_NODE_TYPES: readonly ["heading", "text", "badge", "stat", "key_value", "code", "markdown", "table", "actions", "separator", "stack", "grid", "card"];
4
3
  /**
5
4
  * The model-facing shape and the persistence gate share this exact schema.
6
5
  * It covers JSON authored by an agent, not the renderer's programmatic ReactNode
7
6
  * cells or onPress callbacks.
8
7
  */
9
- declare const OPENUI_NODE_JSON_SCHEMA: {
8
+ export declare const OPENUI_NODE_JSON_SCHEMA: {
10
9
  readonly type: "object";
11
10
  readonly $ref: "#/$defs/node";
12
11
  readonly $defs: {
@@ -205,24 +204,4 @@ declare const OPENUI_NODE_JSON_SCHEMA: {
205
204
  };
206
205
  };
207
206
  };
208
- //#endregion
209
- //#region src/openui/schema.d.ts
210
- interface OpenUISchemaIssue {
211
- path: string;
212
- message: string;
213
- }
214
- type OpenUISchemaValidation<T> = {
215
- ok: true;
216
- value: T;
217
- } | {
218
- ok: false;
219
- issue: OpenUISchemaIssue;
220
- };
221
- /** Find an unsupported node at any depth before the renderer can omit it. */
222
- declare function findUnsupportedOpenUINode(value: unknown): OpenUISchemaIssue | null;
223
- /** Validate one model-authored JSON node before a product persists or spends on it. */
224
- declare function validateOpenUIJsonNode(value: unknown): OpenUISchemaValidation<OpenUIComponentNode>;
225
- /** Validate the renderer's single-node or nonempty node-array artifact shape. */
226
- declare function validateOpenUIJsonArtifact(value: unknown): OpenUISchemaValidation<OpenUIComponentNode | OpenUIComponentNode[]>;
227
- //#endregion
228
- export { validateOpenUIJsonNode as a, validateOpenUIJsonArtifact as i, OpenUISchemaValidation as n, OPENUI_NODE_JSON_SCHEMA as o, findUnsupportedOpenUINode as r, OPENUI_NODE_TYPES as s, OpenUISchemaIssue as t };
207
+ //#endregion
@@ -0,0 +1,206 @@
1
+ //#region src/openui/schema-data.ts
2
+ const OPENUI_NODE_TYPES = [
3
+ "heading",
4
+ "text",
5
+ "badge",
6
+ "stat",
7
+ "key_value",
8
+ "code",
9
+ "markdown",
10
+ "table",
11
+ "actions",
12
+ "separator",
13
+ "stack",
14
+ "grid",
15
+ "card"
16
+ ];
17
+ const string = { type: "string" };
18
+ const boolean = { type: "boolean" };
19
+ const gap = { enum: [
20
+ "sm",
21
+ "md",
22
+ "lg"
23
+ ] };
24
+ const primitive = { type: [
25
+ "string",
26
+ "number",
27
+ "boolean",
28
+ "null"
29
+ ] };
30
+ const children = {
31
+ type: "array",
32
+ minItems: 1,
33
+ items: { $ref: "#/$defs/node" }
34
+ };
35
+ const actions = {
36
+ type: "array",
37
+ minItems: 1,
38
+ items: { $ref: "#/$defs/action" }
39
+ };
40
+ function node(type, fields, required = []) {
41
+ return {
42
+ type: "object",
43
+ required: ["type", ...required],
44
+ properties: {
45
+ type: { const: type },
46
+ id: string,
47
+ ...fields
48
+ },
49
+ additionalProperties: false
50
+ };
51
+ }
52
+ /**
53
+ * The model-facing shape and the persistence gate share this exact schema.
54
+ * It covers JSON authored by an agent, not the renderer's programmatic ReactNode
55
+ * cells or onPress callbacks.
56
+ */
57
+ const OPENUI_NODE_JSON_SCHEMA = {
58
+ type: "object",
59
+ $ref: "#/$defs/node",
60
+ $defs: {
61
+ node: { oneOf: OPENUI_NODE_TYPES.map((type) => ({ $ref: `#/$defs/${type}` })) },
62
+ action: {
63
+ type: "object",
64
+ required: ["id", "label"],
65
+ properties: {
66
+ id: string,
67
+ label: string,
68
+ tone: { enum: [
69
+ "default",
70
+ "secondary",
71
+ "outline",
72
+ "ghost",
73
+ "destructive"
74
+ ] },
75
+ disabled: boolean
76
+ },
77
+ additionalProperties: false
78
+ },
79
+ heading: node("heading", {
80
+ text: string,
81
+ level: { enum: [
82
+ 1,
83
+ 2,
84
+ 3,
85
+ 4
86
+ ] },
87
+ kicker: string,
88
+ meta: string
89
+ }, ["text"]),
90
+ text: node("text", {
91
+ text: string,
92
+ tone: { enum: [
93
+ "default",
94
+ "muted",
95
+ "success",
96
+ "warning",
97
+ "error"
98
+ ] },
99
+ mono: boolean
100
+ }, ["text"]),
101
+ badge: node("badge", {
102
+ label: string,
103
+ tone: { enum: [
104
+ "default",
105
+ "secondary",
106
+ "success",
107
+ "warning",
108
+ "error",
109
+ "info",
110
+ "sandbox"
111
+ ] }
112
+ }, ["label"]),
113
+ stat: node("stat", {
114
+ label: string,
115
+ value: string,
116
+ change: string,
117
+ tone: { enum: [
118
+ "default",
119
+ "success",
120
+ "warning",
121
+ "error",
122
+ "info"
123
+ ] }
124
+ }, ["label", "value"]),
125
+ key_value: node("key_value", { items: {
126
+ type: "array",
127
+ minItems: 1,
128
+ items: {
129
+ type: "object",
130
+ required: ["label", "value"],
131
+ properties: {
132
+ id: string,
133
+ label: string,
134
+ value: primitive,
135
+ tone: { enum: ["default", "muted"] }
136
+ },
137
+ additionalProperties: false
138
+ }
139
+ } }, ["items"]),
140
+ code: node("code", {
141
+ code: string,
142
+ language: string,
143
+ title: string,
144
+ showLineNumbers: boolean
145
+ }, ["code"]),
146
+ markdown: node("markdown", { content: string }, ["content"]),
147
+ table: node("table", {
148
+ columns: {
149
+ type: "array",
150
+ minItems: 1,
151
+ items: {
152
+ type: "object",
153
+ required: ["key", "header"],
154
+ properties: {
155
+ key: string,
156
+ header: string,
157
+ align: { enum: ["left", "right"] }
158
+ },
159
+ additionalProperties: false
160
+ }
161
+ },
162
+ rows: {
163
+ type: "array",
164
+ items: {
165
+ type: "object",
166
+ additionalProperties: primitive
167
+ }
168
+ },
169
+ caption: string
170
+ }, ["columns", "rows"]),
171
+ actions: node("actions", { actions }, ["actions"]),
172
+ separator: node("separator", { label: string }),
173
+ stack: node("stack", {
174
+ direction: { enum: ["row", "column"] },
175
+ gap,
176
+ align: { enum: [
177
+ "start",
178
+ "center",
179
+ "end",
180
+ "stretch"
181
+ ] },
182
+ wrap: boolean,
183
+ children
184
+ }, ["children"]),
185
+ grid: node("grid", {
186
+ columns: { enum: [
187
+ 1,
188
+ 2,
189
+ 3,
190
+ 4
191
+ ] },
192
+ gap,
193
+ children
194
+ }, ["children"]),
195
+ card: node("card", {
196
+ title: string,
197
+ description: string,
198
+ eyebrow: string,
199
+ badge: { $ref: "#/$defs/badge" },
200
+ actions,
201
+ children
202
+ })
203
+ }
204
+ };
205
+ //#endregion
206
+ export { OPENUI_NODE_JSON_SCHEMA, OPENUI_NODE_TYPES };
@@ -1,3 +1,22 @@
1
- import { c as OpenUIComponentNode } from "./openui-artifact-renderer-fkBQaoLO.js";
2
- import { a as validateOpenUIJsonNode, i as validateOpenUIJsonArtifact, n as OpenUISchemaValidation, o as OPENUI_NODE_JSON_SCHEMA, r as findUnsupportedOpenUINode, s as OPENUI_NODE_TYPES, t as OpenUISchemaIssue } from "./schema-DAstk-J4.js";
3
- export { OPENUI_NODE_JSON_SCHEMA, OPENUI_NODE_TYPES, type OpenUIComponentNode, OpenUISchemaIssue, OpenUISchemaValidation, findUnsupportedOpenUINode, validateOpenUIJsonArtifact, validateOpenUIJsonNode };
1
+ import { OpenUIComponentNode } from "./openui/openui-artifact-renderer.js";
2
+ import { OPENUI_NODE_JSON_SCHEMA, OPENUI_NODE_TYPES } from "./openui/schema-data.js";
3
+ //#region src/openui/schema.d.ts
4
+ export interface OpenUISchemaIssue {
5
+ path: string;
6
+ message: string;
7
+ }
8
+ export type OpenUISchemaValidation<T> = {
9
+ ok: true;
10
+ value: T;
11
+ } | {
12
+ ok: false;
13
+ issue: OpenUISchemaIssue;
14
+ };
15
+ /** Find an unsupported node at any depth before the renderer can omit it. */
16
+ export declare function findUnsupportedOpenUINode(value: unknown): OpenUISchemaIssue | null;
17
+ /** Validate one model-authored JSON node before a product persists or spends on it. */
18
+ export declare function validateOpenUIJsonNode(value: unknown): OpenUISchemaValidation<OpenUIComponentNode>;
19
+ /** Validate the renderer's single-node or nonempty node-array artifact shape. */
20
+ export declare function validateOpenUIJsonArtifact(value: unknown): OpenUISchemaValidation<OpenUIComponentNode | OpenUIComponentNode[]>;
21
+ //#endregion
22
+ export { OPENUI_NODE_JSON_SCHEMA, OPENUI_NODE_TYPES, type OpenUIComponentNode };