@jini-ai/chat 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (444) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +109 -0
  3. package/dist/core/agentic/chat-capabilities.d.ts +19 -0
  4. package/dist/core/agentic/chat-capabilities.d.ts.map +1 -0
  5. package/dist/core/agentic/chat-capabilities.js +106 -0
  6. package/dist/core/agentic/chat-capabilities.js.map +1 -0
  7. package/dist/core/agentic/index.d.ts +22 -0
  8. package/dist/core/agentic/index.d.ts.map +1 -0
  9. package/dist/core/agentic/index.js +21 -0
  10. package/dist/core/agentic/index.js.map +1 -0
  11. package/dist/core/events.d.ts +84 -0
  12. package/dist/core/events.d.ts.map +1 -0
  13. package/dist/core/events.js +14 -0
  14. package/dist/core/events.js.map +1 -0
  15. package/dist/core/index.d.ts +40 -0
  16. package/dist/core/index.d.ts.map +1 -0
  17. package/dist/core/index.js +40 -0
  18. package/dist/core/index.js.map +1 -0
  19. package/dist/core/messages.d.ts +53 -0
  20. package/dist/core/messages.d.ts.map +1 -0
  21. package/dist/core/messages.js +16 -0
  22. package/dist/core/messages.js.map +1 -0
  23. package/dist/core/partial-json.d.ts +36 -0
  24. package/dist/core/partial-json.d.ts.map +1 -0
  25. package/dist/core/partial-json.js +119 -0
  26. package/dist/core/partial-json.js.map +1 -0
  27. package/dist/core/persistence/index.d.ts +11 -0
  28. package/dist/core/persistence/index.d.ts.map +1 -0
  29. package/dist/core/persistence/index.js +11 -0
  30. package/dist/core/persistence/index.js.map +1 -0
  31. package/dist/core/persistence/ports.d.ts +124 -0
  32. package/dist/core/persistence/ports.d.ts.map +1 -0
  33. package/dist/core/persistence/ports.js +2 -0
  34. package/dist/core/persistence/ports.js.map +1 -0
  35. package/dist/core/persistence/title.d.ts +35 -0
  36. package/dist/core/persistence/title.d.ts.map +1 -0
  37. package/dist/core/persistence/title.js +137 -0
  38. package/dist/core/persistence/title.js.map +1 -0
  39. package/dist/core/question-form/format.d.ts +27 -0
  40. package/dist/core/question-form/format.d.ts.map +1 -0
  41. package/dist/core/question-form/format.js +45 -0
  42. package/dist/core/question-form/format.js.map +1 -0
  43. package/dist/core/question-form/normalize.d.ts +30 -0
  44. package/dist/core/question-form/normalize.d.ts.map +1 -0
  45. package/dist/core/question-form/normalize.js +192 -0
  46. package/dist/core/question-form/normalize.js.map +1 -0
  47. package/dist/core/question-form/scan.d.ts +50 -0
  48. package/dist/core/question-form/scan.d.ts.map +1 -0
  49. package/dist/core/question-form/scan.js +404 -0
  50. package/dist/core/question-form/scan.js.map +1 -0
  51. package/dist/core/question-form/types.d.ts +83 -0
  52. package/dist/core/question-form/types.d.ts.map +1 -0
  53. package/dist/core/question-form/types.js +11 -0
  54. package/dist/core/question-form/types.js.map +1 -0
  55. package/dist/core/question-form.d.ts +39 -0
  56. package/dist/core/question-form.d.ts.map +1 -0
  57. package/dist/core/question-form.js +4 -0
  58. package/dist/core/question-form.js.map +1 -0
  59. package/dist/core/todos.d.ts +70 -0
  60. package/dist/core/todos.d.ts.map +1 -0
  61. package/dist/core/todos.js +175 -0
  62. package/dist/core/todos.js.map +1 -0
  63. package/dist/core/tool-events.d.ts +18 -0
  64. package/dist/core/tool-events.d.ts.map +1 -0
  65. package/dist/core/tool-events.js +36 -0
  66. package/dist/core/tool-events.js.map +1 -0
  67. package/dist/core/tools.d.ts +51 -0
  68. package/dist/core/tools.d.ts.map +1 -0
  69. package/dist/core/tools.js +41 -0
  70. package/dist/core/tools.js.map +1 -0
  71. package/dist/core/transcript.d.ts +81 -0
  72. package/dist/core/transcript.d.ts.map +1 -0
  73. package/dist/core/transcript.js +133 -0
  74. package/dist/core/transcript.js.map +1 -0
  75. package/dist/core/transport.d.ts +109 -0
  76. package/dist/core/transport.d.ts.map +1 -0
  77. package/dist/core/transport.js +2 -0
  78. package/dist/core/transport.js.map +1 -0
  79. package/dist/core/util/index.d.ts +16 -0
  80. package/dist/core/util/index.d.ts.map +1 -0
  81. package/dist/core/util/index.js +16 -0
  82. package/dist/core/util/index.js.map +1 -0
  83. package/dist/core/util/manifest.d.ts +39 -0
  84. package/dist/core/util/manifest.d.ts.map +1 -0
  85. package/dist/core/util/manifest.js +173 -0
  86. package/dist/core/util/manifest.js.map +1 -0
  87. package/dist/core/util/markdown-context.d.ts +47 -0
  88. package/dist/core/util/markdown-context.d.ts.map +1 -0
  89. package/dist/core/util/markdown-context.js +125 -0
  90. package/dist/core/util/markdown-context.js.map +1 -0
  91. package/dist/core/util/markup-attributes.d.ts +20 -0
  92. package/dist/core/util/markup-attributes.d.ts.map +1 -0
  93. package/dist/core/util/markup-attributes.js +33 -0
  94. package/dist/core/util/markup-attributes.js.map +1 -0
  95. package/dist/core/util/parser.d.ts +42 -0
  96. package/dist/core/util/parser.d.ts.map +1 -0
  97. package/dist/core/util/parser.js +238 -0
  98. package/dist/core/util/parser.js.map +1 -0
  99. package/dist/core/util/pointer.d.ts +28 -0
  100. package/dist/core/util/pointer.d.ts.map +1 -0
  101. package/dist/core/util/pointer.js +75 -0
  102. package/dist/core/util/pointer.js.map +1 -0
  103. package/dist/core/util/recover.d.ts +40 -0
  104. package/dist/core/util/recover.d.ts.map +1 -0
  105. package/dist/core/util/recover.js +117 -0
  106. package/dist/core/util/recover.js.map +1 -0
  107. package/dist/core/util/strip.d.ts +112 -0
  108. package/dist/core/util/strip.d.ts.map +1 -0
  109. package/dist/core/util/strip.js +333 -0
  110. package/dist/core/util/strip.js.map +1 -0
  111. package/dist/core/util/types.d.ts +31 -0
  112. package/dist/core/util/types.d.ts.map +1 -0
  113. package/dist/core/util/types.js +2 -0
  114. package/dist/core/util/types.js.map +1 -0
  115. package/dist/core/util/validate.d.ts +50 -0
  116. package/dist/core/util/validate.d.ts.map +1 -0
  117. package/dist/core/util/validate.js +202 -0
  118. package/dist/core/util/validate.js.map +1 -0
  119. package/dist/react/agent-bridge/frontend-session-bridge.d.ts +45 -0
  120. package/dist/react/agent-bridge/frontend-session-bridge.d.ts.map +1 -0
  121. package/dist/react/agent-bridge/frontend-session-bridge.js +214 -0
  122. package/dist/react/agent-bridge/frontend-session-bridge.js.map +1 -0
  123. package/dist/react/artifact-types.d.ts +61 -0
  124. package/dist/react/artifact-types.d.ts.map +1 -0
  125. package/dist/react/artifact-types.js +33 -0
  126. package/dist/react/artifact-types.js.map +1 -0
  127. package/dist/react/chat-pane.d.ts +21 -0
  128. package/dist/react/chat-pane.d.ts.map +1 -0
  129. package/dist/react/chat-pane.js +20 -0
  130. package/dist/react/chat-pane.js.map +1 -0
  131. package/dist/react/components/A2uiSurfaceCard.d.ts +35 -0
  132. package/dist/react/components/A2uiSurfaceCard.d.ts.map +1 -0
  133. package/dist/react/components/A2uiSurfaceCard.js +272 -0
  134. package/dist/react/components/A2uiSurfaceCard.js.map +1 -0
  135. package/dist/react/components/AttachmentTray.d.ts +6 -0
  136. package/dist/react/components/AttachmentTray.d.ts.map +1 -0
  137. package/dist/react/components/AttachmentTray.js +30 -0
  138. package/dist/react/components/AttachmentTray.js.map +1 -0
  139. package/dist/react/components/ChatFab.d.ts +8 -0
  140. package/dist/react/components/ChatFab.d.ts.map +1 -0
  141. package/dist/react/components/ChatFab.js +24 -0
  142. package/dist/react/components/ChatFab.js.map +1 -0
  143. package/dist/react/components/Composer.d.ts +34 -0
  144. package/dist/react/components/Composer.d.ts.map +1 -0
  145. package/dist/react/components/Composer.js +300 -0
  146. package/dist/react/components/Composer.js.map +1 -0
  147. package/dist/react/components/ComposerDiscovery.d.ts +46 -0
  148. package/dist/react/components/ComposerDiscovery.d.ts.map +1 -0
  149. package/dist/react/components/ComposerDiscovery.js +38 -0
  150. package/dist/react/components/ComposerDiscovery.js.map +1 -0
  151. package/dist/react/components/ConversationList.d.ts +31 -0
  152. package/dist/react/components/ConversationList.d.ts.map +1 -0
  153. package/dist/react/components/ConversationList.js +221 -0
  154. package/dist/react/components/ConversationList.js.map +1 -0
  155. package/dist/react/components/ExtEventErrorBoundary.d.ts +35 -0
  156. package/dist/react/components/ExtEventErrorBoundary.d.ts.map +1 -0
  157. package/dist/react/components/ExtEventErrorBoundary.js +38 -0
  158. package/dist/react/components/ExtEventErrorBoundary.js.map +1 -0
  159. package/dist/react/components/Icon.d.ts +17 -0
  160. package/dist/react/components/Icon.d.ts.map +1 -0
  161. package/dist/react/components/Icon.js +46 -0
  162. package/dist/react/components/Icon.js.map +1 -0
  163. package/dist/react/components/JiniChatProvider.d.ts +45 -0
  164. package/dist/react/components/JiniChatProvider.d.ts.map +1 -0
  165. package/dist/react/components/JiniChatProvider.js +44 -0
  166. package/dist/react/components/JiniChatProvider.js.map +1 -0
  167. package/dist/react/components/Markdown.d.ts +5 -0
  168. package/dist/react/components/Markdown.d.ts.map +1 -0
  169. package/dist/react/components/Markdown.js +390 -0
  170. package/dist/react/components/Markdown.js.map +1 -0
  171. package/dist/react/components/McpUiSurfaceCard.d.ts +51 -0
  172. package/dist/react/components/McpUiSurfaceCard.d.ts.map +1 -0
  173. package/dist/react/components/McpUiSurfaceCard.js +159 -0
  174. package/dist/react/components/McpUiSurfaceCard.js.map +1 -0
  175. package/dist/react/components/MessageList.d.ts +15 -0
  176. package/dist/react/components/MessageList.d.ts.map +1 -0
  177. package/dist/react/components/MessageList.js +81 -0
  178. package/dist/react/components/MessageList.js.map +1 -0
  179. package/dist/react/components/MessageRow.d.ts +60 -0
  180. package/dist/react/components/MessageRow.d.ts.map +1 -0
  181. package/dist/react/components/MessageRow.js +156 -0
  182. package/dist/react/components/MessageRow.js.map +1 -0
  183. package/dist/react/components/NextStepActions.d.ts +34 -0
  184. package/dist/react/components/NextStepActions.d.ts.map +1 -0
  185. package/dist/react/components/NextStepActions.js +9 -0
  186. package/dist/react/components/NextStepActions.js.map +1 -0
  187. package/dist/react/components/QuestionForm.d.ts +26 -0
  188. package/dist/react/components/QuestionForm.d.ts.map +1 -0
  189. package/dist/react/components/QuestionForm.js +238 -0
  190. package/dist/react/components/QuestionForm.js.map +1 -0
  191. package/dist/react/components/QuestionsPanel.d.ts +13 -0
  192. package/dist/react/components/QuestionsPanel.d.ts.map +1 -0
  193. package/dist/react/components/QuestionsPanel.js +33 -0
  194. package/dist/react/components/QuestionsPanel.js.map +1 -0
  195. package/dist/react/components/TodoCard.d.ts +8 -0
  196. package/dist/react/components/TodoCard.d.ts.map +1 -0
  197. package/dist/react/components/TodoCard.js +29 -0
  198. package/dist/react/components/TodoCard.js.map +1 -0
  199. package/dist/react/components/ToolCard.d.ts +22 -0
  200. package/dist/react/components/ToolCard.d.ts.map +1 -0
  201. package/dist/react/components/ToolCard.js +298 -0
  202. package/dist/react/components/ToolCard.js.map +1 -0
  203. package/dist/react/components/composer-discovery.d.ts +107 -0
  204. package/dist/react/components/composer-discovery.d.ts.map +1 -0
  205. package/dist/react/components/composer-discovery.js +176 -0
  206. package/dist/react/components/composer-discovery.js.map +1 -0
  207. package/dist/react/ext-event-renderer-registry.d.ts +51 -0
  208. package/dist/react/ext-event-renderer-registry.d.ts.map +1 -0
  209. package/dist/react/ext-event-renderer-registry.js +20 -0
  210. package/dist/react/ext-event-renderer-registry.js.map +1 -0
  211. package/dist/react/features/chat-pane/agent-tools.d.ts +14 -0
  212. package/dist/react/features/chat-pane/agent-tools.d.ts.map +1 -0
  213. package/dist/react/features/chat-pane/agent-tools.js +22 -0
  214. package/dist/react/features/chat-pane/agent-tools.js.map +1 -0
  215. package/dist/react/features/chat-pane/components/AgentRuntimePicker.d.ts +12 -0
  216. package/dist/react/features/chat-pane/components/AgentRuntimePicker.d.ts.map +1 -0
  217. package/dist/react/features/chat-pane/components/AgentRuntimePicker.js +106 -0
  218. package/dist/react/features/chat-pane/components/AgentRuntimePicker.js.map +1 -0
  219. package/dist/react/features/chat-pane/components/ChatPane.d.ts +10 -0
  220. package/dist/react/features/chat-pane/components/ChatPane.d.ts.map +1 -0
  221. package/dist/react/features/chat-pane/components/ChatPane.js +169 -0
  222. package/dist/react/features/chat-pane/components/ChatPane.js.map +1 -0
  223. package/dist/react/features/chat-pane/create-daemon-attachment-uploader.d.ts +21 -0
  224. package/dist/react/features/chat-pane/create-daemon-attachment-uploader.d.ts.map +1 -0
  225. package/dist/react/features/chat-pane/create-daemon-attachment-uploader.js +213 -0
  226. package/dist/react/features/chat-pane/create-daemon-attachment-uploader.js.map +1 -0
  227. package/dist/react/features/chat-pane/create-mcp-ui-tool-caller.d.ts +70 -0
  228. package/dist/react/features/chat-pane/create-mcp-ui-tool-caller.d.ts.map +1 -0
  229. package/dist/react/features/chat-pane/create-mcp-ui-tool-caller.js +76 -0
  230. package/dist/react/features/chat-pane/create-mcp-ui-tool-caller.js.map +1 -0
  231. package/dist/react/features/chat-pane/hooks/useAgentRuntimePicker.hooks.d.ts +133 -0
  232. package/dist/react/features/chat-pane/hooks/useAgentRuntimePicker.hooks.d.ts.map +1 -0
  233. package/dist/react/features/chat-pane/hooks/useAgentRuntimePicker.hooks.js +258 -0
  234. package/dist/react/features/chat-pane/hooks/useAgentRuntimePicker.hooks.js.map +1 -0
  235. package/dist/react/features/chat-pane/hooks/useChatPane.hooks.d.ts +66 -0
  236. package/dist/react/features/chat-pane/hooks/useChatPane.hooks.d.ts.map +1 -0
  237. package/dist/react/features/chat-pane/hooks/useChatPane.hooks.js +224 -0
  238. package/dist/react/features/chat-pane/hooks/useChatPane.hooks.js.map +1 -0
  239. package/dist/react/features/chat-pane/hooks/useChatPaneAgentControl.hooks.d.ts +38 -0
  240. package/dist/react/features/chat-pane/hooks/useChatPaneAgentControl.hooks.d.ts.map +1 -0
  241. package/dist/react/features/chat-pane/hooks/useChatPaneAgentControl.hooks.js +252 -0
  242. package/dist/react/features/chat-pane/hooks/useChatPaneAgentControl.hooks.js.map +1 -0
  243. package/dist/react/features/chat-pane/hooks/useChatPaneControlsHeight.hooks.d.ts +16 -0
  244. package/dist/react/features/chat-pane/hooks/useChatPaneControlsHeight.hooks.d.ts.map +1 -0
  245. package/dist/react/features/chat-pane/hooks/useChatPaneControlsHeight.hooks.js +59 -0
  246. package/dist/react/features/chat-pane/hooks/useChatPaneControlsHeight.hooks.js.map +1 -0
  247. package/dist/react/features/chat-pane/hooks/useChatPaneFileDrop.hooks.d.ts +26 -0
  248. package/dist/react/features/chat-pane/hooks/useChatPaneFileDrop.hooks.d.ts.map +1 -0
  249. package/dist/react/features/chat-pane/hooks/useChatPaneFileDrop.hooks.js +74 -0
  250. package/dist/react/features/chat-pane/hooks/useChatPaneFileDrop.hooks.js.map +1 -0
  251. package/dist/react/features/chat-pane/hooks/useChatPaneRuntimeInventory.hooks.d.ts +25 -0
  252. package/dist/react/features/chat-pane/hooks/useChatPaneRuntimeInventory.hooks.d.ts.map +1 -0
  253. package/dist/react/features/chat-pane/hooks/useChatPaneRuntimeInventory.hooks.js +88 -0
  254. package/dist/react/features/chat-pane/hooks/useChatPaneRuntimeInventory.hooks.js.map +1 -0
  255. package/dist/react/features/chat-pane/hooks/useChatPaneWorkingDirectory.hooks.d.ts +38 -0
  256. package/dist/react/features/chat-pane/hooks/useChatPaneWorkingDirectory.hooks.d.ts.map +1 -0
  257. package/dist/react/features/chat-pane/hooks/useChatPaneWorkingDirectory.hooks.js +184 -0
  258. package/dist/react/features/chat-pane/hooks/useChatPaneWorkingDirectory.hooks.js.map +1 -0
  259. package/dist/react/features/chat-pane/index.d.ts +12 -0
  260. package/dist/react/features/chat-pane/index.d.ts.map +1 -0
  261. package/dist/react/features/chat-pane/index.js +11 -0
  262. package/dist/react/features/chat-pane/index.js.map +1 -0
  263. package/dist/react/features/chat-pane/react/components/AgentRuntimePicker.d.ts +12 -0
  264. package/dist/react/features/chat-pane/react/components/AgentRuntimePicker.d.ts.map +1 -0
  265. package/dist/react/features/chat-pane/react/components/AgentRuntimePicker.js +102 -0
  266. package/dist/react/features/chat-pane/react/components/AgentRuntimePicker.js.map +1 -0
  267. package/dist/react/features/chat-pane/react/components/ChatPane.d.ts +10 -0
  268. package/dist/react/features/chat-pane/react/components/ChatPane.d.ts.map +1 -0
  269. package/dist/react/features/chat-pane/react/components/ChatPane.js +137 -0
  270. package/dist/react/features/chat-pane/react/components/ChatPane.js.map +1 -0
  271. package/dist/react/features/chat-pane/react/hooks/useAgentRuntimePicker.hooks.d.ts +133 -0
  272. package/dist/react/features/chat-pane/react/hooks/useAgentRuntimePicker.hooks.d.ts.map +1 -0
  273. package/dist/react/features/chat-pane/react/hooks/useAgentRuntimePicker.hooks.js +258 -0
  274. package/dist/react/features/chat-pane/react/hooks/useAgentRuntimePicker.hooks.js.map +1 -0
  275. package/dist/react/features/chat-pane/react/hooks/useChatPane.hooks.d.ts +66 -0
  276. package/dist/react/features/chat-pane/react/hooks/useChatPane.hooks.d.ts.map +1 -0
  277. package/dist/react/features/chat-pane/react/hooks/useChatPane.hooks.js +223 -0
  278. package/dist/react/features/chat-pane/react/hooks/useChatPane.hooks.js.map +1 -0
  279. package/dist/react/features/chat-pane/react/hooks/useChatPaneAgentControl.hooks.d.ts +38 -0
  280. package/dist/react/features/chat-pane/react/hooks/useChatPaneAgentControl.hooks.d.ts.map +1 -0
  281. package/dist/react/features/chat-pane/react/hooks/useChatPaneAgentControl.hooks.js +252 -0
  282. package/dist/react/features/chat-pane/react/hooks/useChatPaneAgentControl.hooks.js.map +1 -0
  283. package/dist/react/features/chat-pane/react/hooks/useChatPaneFileDrop.hooks.d.ts +26 -0
  284. package/dist/react/features/chat-pane/react/hooks/useChatPaneFileDrop.hooks.d.ts.map +1 -0
  285. package/dist/react/features/chat-pane/react/hooks/useChatPaneFileDrop.hooks.js +60 -0
  286. package/dist/react/features/chat-pane/react/hooks/useChatPaneFileDrop.hooks.js.map +1 -0
  287. package/dist/react/features/chat-pane/react/hooks/useChatPaneRuntimeInventory.hooks.d.ts +25 -0
  288. package/dist/react/features/chat-pane/react/hooks/useChatPaneRuntimeInventory.hooks.d.ts.map +1 -0
  289. package/dist/react/features/chat-pane/react/hooks/useChatPaneRuntimeInventory.hooks.js +83 -0
  290. package/dist/react/features/chat-pane/react/hooks/useChatPaneRuntimeInventory.hooks.js.map +1 -0
  291. package/dist/react/features/chat-pane/react/hooks/useChatPaneWorkingDirectory.hooks.d.ts +38 -0
  292. package/dist/react/features/chat-pane/react/hooks/useChatPaneWorkingDirectory.hooks.d.ts.map +1 -0
  293. package/dist/react/features/chat-pane/react/hooks/useChatPaneWorkingDirectory.hooks.js +184 -0
  294. package/dist/react/features/chat-pane/react/hooks/useChatPaneWorkingDirectory.hooks.js.map +1 -0
  295. package/dist/react/features/chat-pane/react/styles.d.ts +2 -0
  296. package/dist/react/features/chat-pane/react/styles.d.ts.map +1 -0
  297. package/dist/react/features/chat-pane/react/styles.js +863 -0
  298. package/dist/react/features/chat-pane/react/styles.js.map +1 -0
  299. package/dist/react/features/chat-pane/rules.d.ts +31 -0
  300. package/dist/react/features/chat-pane/rules.d.ts.map +1 -0
  301. package/dist/react/features/chat-pane/rules.js +81 -0
  302. package/dist/react/features/chat-pane/rules.js.map +1 -0
  303. package/dist/react/features/chat-pane/styles.d.ts +2 -0
  304. package/dist/react/features/chat-pane/styles.d.ts.map +1 -0
  305. package/dist/react/features/chat-pane/styles.js +1327 -0
  306. package/dist/react/features/chat-pane/styles.js.map +1 -0
  307. package/dist/react/features/chat-pane/types.d.ts +248 -0
  308. package/dist/react/features/chat-pane/types.d.ts.map +1 -0
  309. package/dist/react/features/chat-pane/types.js +2 -0
  310. package/dist/react/features/chat-pane/types.js.map +1 -0
  311. package/dist/react/features/model-picker/components/CredentialStatusBadge.d.ts +7 -0
  312. package/dist/react/features/model-picker/components/CredentialStatusBadge.d.ts.map +1 -0
  313. package/dist/react/features/model-picker/components/CredentialStatusBadge.js +20 -0
  314. package/dist/react/features/model-picker/components/CredentialStatusBadge.js.map +1 -0
  315. package/dist/react/features/model-picker/components/ModelPicker.d.ts +9 -0
  316. package/dist/react/features/model-picker/components/ModelPicker.d.ts.map +1 -0
  317. package/dist/react/features/model-picker/components/ModelPicker.js +34 -0
  318. package/dist/react/features/model-picker/components/ModelPicker.js.map +1 -0
  319. package/dist/react/features/model-picker/constants.d.ts +6 -0
  320. package/dist/react/features/model-picker/constants.d.ts.map +1 -0
  321. package/dist/react/features/model-picker/constants.js +9 -0
  322. package/dist/react/features/model-picker/constants.js.map +1 -0
  323. package/dist/react/features/model-picker/dependencies.d.ts +11 -0
  324. package/dist/react/features/model-picker/dependencies.d.ts.map +1 -0
  325. package/dist/react/features/model-picker/dependencies.js +10 -0
  326. package/dist/react/features/model-picker/dependencies.js.map +1 -0
  327. package/dist/react/features/model-picker/hooks/useModelPicker.hooks.d.ts +27 -0
  328. package/dist/react/features/model-picker/hooks/useModelPicker.hooks.d.ts.map +1 -0
  329. package/dist/react/features/model-picker/hooks/useModelPicker.hooks.js +62 -0
  330. package/dist/react/features/model-picker/hooks/useModelPicker.hooks.js.map +1 -0
  331. package/dist/react/features/model-picker/index.d.ts +32 -0
  332. package/dist/react/features/model-picker/index.d.ts.map +1 -0
  333. package/dist/react/features/model-picker/index.js +29 -0
  334. package/dist/react/features/model-picker/index.js.map +1 -0
  335. package/dist/react/features/model-picker/ports.d.ts +11 -0
  336. package/dist/react/features/model-picker/ports.d.ts.map +1 -0
  337. package/dist/react/features/model-picker/ports.js +2 -0
  338. package/dist/react/features/model-picker/ports.js.map +1 -0
  339. package/dist/react/features/model-picker/react/components/CredentialStatusBadge.d.ts +7 -0
  340. package/dist/react/features/model-picker/react/components/CredentialStatusBadge.d.ts.map +1 -0
  341. package/dist/react/features/model-picker/react/components/CredentialStatusBadge.js +20 -0
  342. package/dist/react/features/model-picker/react/components/CredentialStatusBadge.js.map +1 -0
  343. package/dist/react/features/model-picker/react/components/ModelPicker.d.ts +9 -0
  344. package/dist/react/features/model-picker/react/components/ModelPicker.d.ts.map +1 -0
  345. package/dist/react/features/model-picker/react/components/ModelPicker.js +34 -0
  346. package/dist/react/features/model-picker/react/components/ModelPicker.js.map +1 -0
  347. package/dist/react/features/model-picker/react/hooks/useModelPicker.hooks.d.ts +27 -0
  348. package/dist/react/features/model-picker/react/hooks/useModelPicker.hooks.d.ts.map +1 -0
  349. package/dist/react/features/model-picker/react/hooks/useModelPicker.hooks.js +62 -0
  350. package/dist/react/features/model-picker/react/hooks/useModelPicker.hooks.js.map +1 -0
  351. package/dist/react/features/model-picker/rules.d.ts +26 -0
  352. package/dist/react/features/model-picker/rules.d.ts.map +1 -0
  353. package/dist/react/features/model-picker/rules.js +84 -0
  354. package/dist/react/features/model-picker/rules.js.map +1 -0
  355. package/dist/react/features/model-picker/types.d.ts +38 -0
  356. package/dist/react/features/model-picker/types.d.ts.map +1 -0
  357. package/dist/react/features/model-picker/types.js +2 -0
  358. package/dist/react/features/model-picker/types.js.map +1 -0
  359. package/dist/react/hooks/composer-draft-cache.d.ts +65 -0
  360. package/dist/react/hooks/composer-draft-cache.d.ts.map +1 -0
  361. package/dist/react/hooks/composer-draft-cache.js +89 -0
  362. package/dist/react/hooks/composer-draft-cache.js.map +1 -0
  363. package/dist/react/hooks/context.d.ts +18 -0
  364. package/dist/react/hooks/context.d.ts.map +1 -0
  365. package/dist/react/hooks/context.js +60 -0
  366. package/dist/react/hooks/context.js.map +1 -0
  367. package/dist/react/hooks/testing/fake-transport.d.ts +34 -0
  368. package/dist/react/hooks/testing/fake-transport.d.ts.map +1 -0
  369. package/dist/react/hooks/testing/fake-transport.js +46 -0
  370. package/dist/react/hooks/testing/fake-transport.js.map +1 -0
  371. package/dist/react/hooks/useArtifactStream.d.ts +18 -0
  372. package/dist/react/hooks/useArtifactStream.d.ts.map +1 -0
  373. package/dist/react/hooks/useArtifactStream.js +55 -0
  374. package/dist/react/hooks/useArtifactStream.js.map +1 -0
  375. package/dist/react/hooks/useChatFabDrag.d.ts +25 -0
  376. package/dist/react/hooks/useChatFabDrag.d.ts.map +1 -0
  377. package/dist/react/hooks/useChatFabDrag.js +88 -0
  378. package/dist/react/hooks/useChatFabDrag.js.map +1 -0
  379. package/dist/react/hooks/useComposer.d.ts +48 -0
  380. package/dist/react/hooks/useComposer.d.ts.map +1 -0
  381. package/dist/react/hooks/useComposer.js +121 -0
  382. package/dist/react/hooks/useComposer.js.map +1 -0
  383. package/dist/react/hooks/useConversation.d.ts +34 -0
  384. package/dist/react/hooks/useConversation.d.ts.map +1 -0
  385. package/dist/react/hooks/useConversation.js +163 -0
  386. package/dist/react/hooks/useConversation.js.map +1 -0
  387. package/dist/react/hooks/useCopyToClipboard.d.ts +14 -0
  388. package/dist/react/hooks/useCopyToClipboard.d.ts.map +1 -0
  389. package/dist/react/hooks/useCopyToClipboard.js +98 -0
  390. package/dist/react/hooks/useCopyToClipboard.js.map +1 -0
  391. package/dist/react/hooks/useExtEventGroups.d.ts +7 -0
  392. package/dist/react/hooks/useExtEventGroups.d.ts.map +1 -0
  393. package/dist/react/hooks/useExtEventGroups.js +32 -0
  394. package/dist/react/hooks/useExtEventGroups.js.map +1 -0
  395. package/dist/react/hooks/useLatestOperation.d.ts +31 -0
  396. package/dist/react/hooks/useLatestOperation.d.ts.map +1 -0
  397. package/dist/react/hooks/useLatestOperation.js +74 -0
  398. package/dist/react/hooks/useLatestOperation.js.map +1 -0
  399. package/dist/react/hooks/usePinnedTodos.d.ts +15 -0
  400. package/dist/react/hooks/usePinnedTodos.d.ts.map +1 -0
  401. package/dist/react/hooks/usePinnedTodos.js +43 -0
  402. package/dist/react/hooks/usePinnedTodos.js.map +1 -0
  403. package/dist/react/hooks/useQuestionForms.d.ts +28 -0
  404. package/dist/react/hooks/useQuestionForms.d.ts.map +1 -0
  405. package/dist/react/hooks/useQuestionForms.js +113 -0
  406. package/dist/react/hooks/useQuestionForms.js.map +1 -0
  407. package/dist/react/hooks/useRunStream.d.ts +27 -0
  408. package/dist/react/hooks/useRunStream.d.ts.map +1 -0
  409. package/dist/react/hooks/useRunStream.js +180 -0
  410. package/dist/react/hooks/useRunStream.js.map +1 -0
  411. package/dist/react/hooks/useToolTimeline.d.ts +33 -0
  412. package/dist/react/hooks/useToolTimeline.d.ts.map +1 -0
  413. package/dist/react/hooks/useToolTimeline.js +47 -0
  414. package/dist/react/hooks/useToolTimeline.js.map +1 -0
  415. package/dist/react/index.d.ts +158 -0
  416. package/dist/react/index.d.ts.map +1 -0
  417. package/dist/react/index.js +118 -0
  418. package/dist/react/index.js.map +1 -0
  419. package/dist/react/message-blocks.d.ts +86 -0
  420. package/dist/react/message-blocks.d.ts.map +1 -0
  421. package/dist/react/message-blocks.js +78 -0
  422. package/dist/react/message-blocks.js.map +1 -0
  423. package/dist/react/poc-mcp-ui-official/PocMcpUiCard.d.ts +9 -0
  424. package/dist/react/poc-mcp-ui-official/PocMcpUiCard.d.ts.map +1 -0
  425. package/dist/react/poc-mcp-ui-official/PocMcpUiCard.js +29 -0
  426. package/dist/react/poc-mcp-ui-official/PocMcpUiCard.js.map +1 -0
  427. package/dist/react/poc-mcp-ui-official/create-poc-resource.d.ts +30 -0
  428. package/dist/react/poc-mcp-ui-official/create-poc-resource.d.ts.map +1 -0
  429. package/dist/react/poc-mcp-ui-official/create-poc-resource.js +44 -0
  430. package/dist/react/poc-mcp-ui-official/create-poc-resource.js.map +1 -0
  431. package/dist/react/slots.d.ts +215 -0
  432. package/dist/react/slots.d.ts.map +1 -0
  433. package/dist/react/slots.js +2 -0
  434. package/dist/react/slots.js.map +1 -0
  435. package/dist/react/styles/reference.css +298 -0
  436. package/dist/react/tool-renderer-registry.d.ts +41 -0
  437. package/dist/react/tool-renderer-registry.d.ts.map +1 -0
  438. package/dist/react/tool-renderer-registry.js +22 -0
  439. package/dist/react/tool-renderer-registry.js.map +1 -0
  440. package/dist/react/util/defined-props.d.ts +31 -0
  441. package/dist/react/util/defined-props.d.ts.map +1 -0
  442. package/dist/react/util/defined-props.js +28 -0
  443. package/dist/react/util/defined-props.js.map +1 -0
  444. package/package.json +99 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"title.js","sourceRoot":"","sources":["../../../src/core/persistence/title.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,MAAM,eAAe,GAAG,CAAC,CAAC;AAC1B,MAAM,cAAc,GAAG,EA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ED,SAAS,YAAY,CAAC,KAAa;IACjC,IAAI,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IACzB,KAAK,MAAM,OAAO,IAAI,kBAAkB;QAAE,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACpF,8FAA8F;IAC9F,KAAK,GAAG,KAAK,CAAC,OAAO,CAAC,mBAAmB,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACnE,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,cAAc,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,uBAAuB,CAAC,MAAc;IACpD,MAAM,OAAO,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,CAAC,OAAO;QAAE,OAAO,EAAE,CAAC;IACxB,MAAM,WAAW,GAAG,OAAO,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,OAAO,CAAC;IACvE,IAAI,CAAC,WAAW;QAAE,OAAO,EAAE,CAAC;IAC5B,MAAM,KAAK,GAAG,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,YAAY,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,WAAW,CAAC,CAAC;IACtG,mGAAmG;IACnG,uCAAuC;IACvC,OAAO,KAAK,CAAC,MAAM,GAAG,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC;AAC5F,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * @module question-form/format
3
+ *
4
+ * Answer presentation: turning a submitted answer set into the prose the
5
+ * agent reads on its next turn, plus the label/value lookups also used by
6
+ * `normalize.ts`'s default-value resolution. Split out of the original
7
+ * single-file `question-form.ts`; see `../question-form.ts` for the public
8
+ * facade.
9
+ */
10
+ import type { FormOption, QuestionForm } from './types.js';
11
+ /**
12
+ * Format a finished set of answers into a prose user message the agent can
13
+ * read on its next turn. The shape is stable enough that the agent can
14
+ * recognize "the form was answered" without any structured wrapper.
15
+ *
16
+ * @complexity O(q) in the number of questions on the form.
17
+ */
18
+ export declare function formatFormAnswers(form: QuestionForm, answers: Record<string, string | string[]>): string;
19
+ /** Resolve a submitted answer value back to its display label, or the value itself when unmatched. */
20
+ export declare function formOptionLabelForValue(question: {
21
+ options?: FormOption[] | undefined;
22
+ }, value: string): string;
23
+ /** Resolve a label or value to the canonical option `value`, or the input itself when unmatched. */
24
+ export declare function formOptionValueForLabel(question: {
25
+ options?: FormOption[] | undefined;
26
+ }, labelOrValue: string): string;
27
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../../src/core/question-form/format.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE3D;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,GAAG,MAAM,CAgBxG;AASD,sGAAsG;AACtG,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE;IAAE,OAAO,CAAC,EAAE,UAAU,EAAE,GAAG,SAAS,CAAA;CAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAG/G;AAED,oGAAoG;AACpG,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE;IAAE,OAAO,CAAC,EAAE,UAAU,EAAE,GAAG,SAAS,CAAA;CAAE,EAAE,YAAY,EAAE,MAAM,GAAG,MAAM,CAGtH"}
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Format a finished set of answers into a prose user message the agent can
3
+ * read on its next turn. The shape is stable enough that the agent can
4
+ * recognize "the form was answered" without any structured wrapper.
5
+ *
6
+ * @complexity O(q) in the number of questions on the form.
7
+ */
8
+ export function formatFormAnswers(form, answers) {
9
+ const lines = [];
10
+ lines.push(`[form answers — ${form.id}]`);
11
+ for (const q of form.questions) {
12
+ const v = answers[q.id];
13
+ let display;
14
+ if (Array.isArray(v)) {
15
+ display = v.length > 0 ? v.map((value) => formOptionDisplayForValue(q, value)).join(', ') : '(skipped)';
16
+ }
17
+ else if (typeof v === 'string') {
18
+ display = v.trim().length > 0 ? formOptionDisplayForValue(q, v.trim()) : '(skipped)';
19
+ }
20
+ else {
21
+ display = '(skipped)';
22
+ }
23
+ lines.push(`- ${q.label}: ${display}`);
24
+ }
25
+ return lines.join('\n');
26
+ }
27
+ function formOptionDisplayForValue(question, value) {
28
+ const match = question.options?.find((option) => option.value === value || option.label === value);
29
+ if (!match)
30
+ return value;
31
+ if (match.value === match.label)
32
+ return match.label;
33
+ return `${match.label} [value: ${match.value}]`;
34
+ }
35
+ /** Resolve a submitted answer value back to its display label, or the value itself when unmatched. */
36
+ export function formOptionLabelForValue(question, value) {
37
+ const match = question.options?.find((option) => option.value === value || option.label === value);
38
+ return match?.label ?? value;
39
+ }
40
+ /** Resolve a label or value to the canonical option `value`, or the input itself when unmatched. */
41
+ export function formOptionValueForLabel(question, labelOrValue) {
42
+ const match = question.options?.find((option) => option.value === labelOrValue || option.label === labelOrValue);
43
+ return match?.value ?? labelOrValue;
44
+ }
45
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../../src/core/question-form/format.ts"],"names":[],"mappings":"AAWA;;;;;;GAMG;AACH,MAAM,UAAU,iBAAiB,CAAC,IAAkB,EAAE,OAA0C;IAC9F,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,CAAC,IAAI,CAAC,mBAAmB,IAAI,C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AAC,KAAK;QAAE,OAAO,KAAK,CAAC,KAAK,CAAC;IACpD,OAAO,GAAG,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,KAAK,GAAG,CAAC;AAClD,CAAC;AAED,sGAAsG;AACtG,MAAM,UAAU,uBAAuB,CAAC,QAAgD,EAAE,KAAa;IACrG,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,KAAK,IAAI,MAAM,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;IACnG,OAAO,KAAK,EAAE,KAAK,IAAI,KAAK,CAAC;AAC/B,CAAC;AAED,oGAAoG;AACpG,MAAM,UAAU,uBAAuB,CAAC,QAAgD,EAAE,YAAoB;IAC5G,MAAM,KAAK,GAAG,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,KAAK,YAAY,IAAI,MAAM,CAAC,KAAK,KAAK,YAAY,CAAC,CAAC;IACjH,OAAO,KAAK,EAAE,KAAK,IAAI,YAAY,CAAC;AACtC,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @module question-form/normalize
3
+ *
4
+ * Normalization of a raw (already-JSON-parsed) question object into this
5
+ * package's stable `FormQuestion`/`DirectionCard` shape — tolerant of the
6
+ * looser vocabulary a model tends to emit (`"multi"` for `checkbox`,
7
+ * `"default"` for `defaultValue`, etc). Split out of the original
8
+ * single-file `question-form.ts`; see `../question-form.ts` for the public
9
+ * facade and `./scan.ts` for the caller that turns raw JSON into these
10
+ * question objects.
11
+ */
12
+ import type { FormQuestion } from './types.js';
13
+ export declare function mapRawQuestion(q: unknown, index: number): FormQuestion | null;
14
+ /**
15
+ * Whether a model-supplied palette entry may be written into a CSS value.
16
+ *
17
+ * `palette` reaches `QuestionForm`'s swatch as `style={{ background: c }}`, and `background` is a
18
+ * SHORTHAND — it accepts far more than a colour. An agent (or anything that can influence one)
19
+ * emitting `url(https://attacker.example/pixel)` therefore got the browser to issue a request the
20
+ * moment the card rendered: a tracking beacon inside the chat transcript, needing no click. Neither
21
+ * React nor the CSSOM filters this; React passes style values through, and the CSSOM happily
22
+ * accepts a valid shorthand.
23
+ *
24
+ * Enforced HERE rather than at the swatch, because this is the normalization boundary and the
25
+ * component is not the only thing that could ever read `palette`. An entry that fails is DROPPED
26
+ * rather than substituted: a silently recoloured swatch would misrepresent the agent's proposal,
27
+ * and a card with fewer swatches is honest about what survived validation.
28
+ */
29
+ export declare function isRenderableColor(value: string): boolean;
30
+ //# sourceMappingURL=normalize.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.d.ts","sourceRoot":"","sources":["../../../src/core/question-form/normalize.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,KAAK,EAA6B,YAAY,EAAgB,MAAM,YAAY,CAAC;AAGxF,wBAAgB,cAAc,CAAC,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CA6C7E;AA0FD;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAMxD"}
@@ -0,0 +1,192 @@
1
+ import { formOptionValueForLabel } from './format.js';
2
+ export function mapRawQuestion(q, index) {
3
+ if (!q || typeof q !== 'object')
4
+ return null;
5
+ const qo = q;
6
+ const id = typeof qo.id === 'string' && qo.id.trim().length > 0 ? qo.id.trim() : `q${index + 1}`;
7
+ const label = typeof qo.label === 'string' ? qo.label : id;
8
+ const type = normalizeType(qo.type);
9
+ const options = parseOptions(qo.options);
10
+ const placeholder = typeof qo.placeholder === 'string' ? qo.placeholder : undefined;
11
+ const help = typeof qo.help === 'string' ? qo.help : undefined;
12
+ const required = qo.required === true;
13
+ const maxSelections = typeof qo.maxSelections === 'number' && Number.isInteger(qo.maxSelections) && qo.maxSelections > 0
14
+ ? qo.maxSelections
15
+ : undefined;
16
+ const cards = parseDirectionCards(qo.cards);
17
+ const defaultValue = parseDefaultValue(qo, options);
18
+ const allowCustom = qo.allowCustom === false ? false : qo.allowCustom === true || qo.custom === true ? true : undefined;
19
+ const customLabel = typeof qo.customLabel === 'string' ? qo.customLabel : undefined;
20
+ const customPlaceholder = typeof qo.customPlaceholder === 'string' ? qo.customPlaceholder : undefined;
21
+ const min = parseNumberAttr(qo.min);
22
+ const max = parseNumberAttr(qo.max);
23
+ const step = parseNumberAttr(qo.step);
24
+ const multiple = qo.multiple === true;
25
+ const accept = typeof qo.accept === 'string' ? qo.accept : undefined;
26
+ return {
27
+ id,
28
+ label,
29
+ type,
30
+ ...(options ? { options } : {}),
31
+ ...(placeholder ? { placeholder } : {}),
32
+ ...(help ? { help } : {}),
33
+ ...(required ? { required } : {}),
34
+ ...(defaultValue !== undefined ? { defaultValue } : {}),
35
+ ...(maxSelections !== undefined && type === 'checkbox' ? { maxSelections } : {}),
36
+ ...(allowCustom !== undefined ? { allowCustom } : {}),
37
+ ...(customLabel ? { customLabel } : {}),
38
+ ...(customPlaceholder ? { customPlaceholder } : {}),
39
+ ...(min !== undefined ? { min } : {}),
40
+ ...(max !== undefined ? { max } : {}),
41
+ ...(step !== undefined ? { step } : {}),
42
+ ...(multiple && type === 'file' ? { multiple } : {}),
43
+ ...(accept && type === 'file' ? { accept } : {}),
44
+ ...(cards ? { cards } : {}),
45
+ };
46
+ }
47
+ function normalizeType(raw) {
48
+ if (typeof raw !== 'string')
49
+ return 'text';
50
+ const lower = raw.toLowerCase().trim();
51
+ if (lower === 'radio' || lower === 'single' || lower === 'choice')
52
+ return 'radio';
53
+ if (lower === 'checkbox' || lower === 'multi' || lower === 'multiple')
54
+ return 'checkbox';
55
+ if (lower === 'select' || lower === 'dropdown')
56
+ return 'select';
57
+ if (lower === 'textarea' || lower === 'long' || lower === 'paragraph')
58
+ return 'textarea';
59
+ if (lower === 'number' || lower === 'numeric')
60
+ return 'number';
61
+ if (lower === 'range' || lower === 'slider')
62
+ return 'range';
63
+ if (lower === 'date')
64
+ return 'date';
65
+ if (lower === 'time')
66
+ return 'time';
67
+ if (lower === 'datetime-local' || lower === 'datetime' || lower === 'date-time' || lower === 'datetime_local') {
68
+ return 'datetime-local';
69
+ }
70
+ if (lower === 'color' || lower === 'colour' || lower === 'color-picker')
71
+ return 'color';
72
+ if (lower === 'url' || lower === 'link')
73
+ return 'url';
74
+ if (lower === 'email')
75
+ return 'email';
76
+ if (lower === 'tel' || lower === 'phone')
77
+ return 'tel';
78
+ if (lower === 'file' || lower === 'upload' || lower === 'attachment')
79
+ return 'file';
80
+ if (lower === 'switch' || lower === 'toggle' || lower === 'boolean')
81
+ return 'switch';
82
+ if (lower === 'direction-cards' || lower === 'directions' || lower === 'cards' || lower === 'direction') {
83
+ return 'direction-cards';
84
+ }
85
+ return 'text';
86
+ }
87
+ function parseNumberAttr(raw) {
88
+ if (typeof raw === 'number' && Number.isFinite(raw))
89
+ return raw;
90
+ if (typeof raw !== 'string')
91
+ return undefined;
92
+ const n = Number(raw);
93
+ return Number.isFinite(n) ? n : undefined;
94
+ }
95
+ function parseOptions(raw) {
96
+ if (!Array.isArray(raw))
97
+ return undefined;
98
+ const options = raw.map(parseOption).filter((option) => option !== null);
99
+ return options.length > 0 ? options : undefined;
100
+ }
101
+ function parseOption(raw) {
102
+ if (typeof raw === 'string') {
103
+ const label = raw.trim();
104
+ return label.length > 0 ? { label, value: label } : null;
105
+ }
106
+ if (!raw || typeof raw !== 'object')
107
+ return null;
108
+ const obj = raw;
109
+ const label = typeof obj.label === 'string' ? obj.label.trim() : '';
110
+ if (label.length === 0)
111
+ return null;
112
+ const value = typeof obj.value === 'string' && obj.value.trim().length > 0 ? obj.value.trim() : label;
113
+ const description = typeof obj.description === 'string' && obj.description.trim().length > 0 ? obj.description.trim() : undefined;
114
+ return {
115
+ label,
116
+ value,
117
+ ...(description ? { description } : {}),
118
+ };
119
+ }
120
+ function parseDefaultValue(question, options) {
121
+ const raw = typeof question.defaultValue === 'string' || Array.isArray(question.defaultValue)
122
+ ? question.defaultValue
123
+ : typeof question.defaultValue === 'number' || typeof question.defaultValue === 'boolean'
124
+ ? String(question.defaultValue)
125
+ : typeof question.default === 'string'
126
+ ? question.default
127
+ : typeof question.default === 'number' || typeof question.default === 'boolean'
128
+ ? String(question.default)
129
+ : undefined;
130
+ if (typeof raw === 'string')
131
+ return formOptionValueForLabel({ options }, raw);
132
+ if (Array.isArray(raw)) {
133
+ return raw.filter((value) => typeof value === 'string').map((value) => formOptionValueForLabel({ options }, value));
134
+ }
135
+ return undefined;
136
+ }
137
+ /** `#rgb`, `#rgba`, `#rrggbb`, `#rrggbbaa`. */
138
+ const HEX_COLOR = /^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/i;
139
+ /** A bare CSS colour keyword. Letters only — with no parenthesis it cannot become a function call. */
140
+ const COLOR_KEYWORD = /^[a-z]+$/i;
141
+ /**
142
+ * A colour function. The argument charset deliberately excludes `(`, so no nested function —
143
+ * `var()`, `url()`, `image-set()`, `attr()` — can appear inside one of these either.
144
+ */
145
+ const COLOR_FUNCTION = /^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)\(\s*[0-9a-z%.,/\s+-]*\)$/i;
146
+ /**
147
+ * Whether a model-supplied palette entry may be written into a CSS value.
148
+ *
149
+ * `palette` reaches `QuestionForm`'s swatch as `style={{ background: c }}`, and `background` is a
150
+ * SHORTHAND — it accepts far more than a colour. An agent (or anything that can influence one)
151
+ * emitting `url(https://attacker.example/pixel)` therefore got the browser to issue a request the
152
+ * moment the card rendered: a tracking beacon inside the chat transcript, needing no click. Neither
153
+ * React nor the CSSOM filters this; React passes style values through, and the CSSOM happily
154
+ * accepts a valid shorthand.
155
+ *
156
+ * Enforced HERE rather than at the swatch, because this is the normalization boundary and the
157
+ * component is not the only thing that could ever read `palette`. An entry that fails is DROPPED
158
+ * rather than substituted: a silently recoloured swatch would misrepresent the agent's proposal,
159
+ * and a card with fewer swatches is honest about what survived validation.
160
+ */
161
+ export function isRenderableColor(value) {
162
+ const candidate = value.trim();
163
+ // Bounded before any regex runs: these come from model output, and the function pattern's `\s*`
164
+ // plus a character class is the shape that makes a pathological input worth not accepting at all.
165
+ if (candidate.length === 0 || candidate.length > 64)
166
+ return false;
167
+ return HEX_COLOR.test(candidate) || COLOR_KEYWORD.test(candidate) || COLOR_FUNCTION.test(candidate);
168
+ }
169
+ function parseDirectionCards(raw) {
170
+ if (!Array.isArray(raw))
171
+ return undefined;
172
+ const out = [];
173
+ for (const entry of raw) {
174
+ if (!entry || typeof entry !== 'object')
175
+ continue;
176
+ const e = entry;
177
+ const id = typeof e.id === 'string' && e.id.trim().length > 0 ? e.id.trim() : null;
178
+ const label = typeof e.label === 'string' ? e.label : null;
179
+ if (id === null || label === null)
180
+ continue;
181
+ const mood = typeof e.mood === 'string' ? e.mood : '';
182
+ const references = Array.isArray(e.references) ? e.references.filter((r) => typeof r === 'string').slice(0, 6) : [];
183
+ const palette = Array.isArray(e.palette)
184
+ ? e.palette.filter((p) => typeof p === 'string' && isRenderableColor(p)).slice(0, 8)
185
+ : [];
186
+ const displayFont = typeof e.displayFont === 'string' ? e.displayFont : 'Georgia, serif';
187
+ const bodyFont = typeof e.bodyFont === 'string' ? e.bodyFont : '-apple-system, system-ui, sans-serif';
188
+ out.push({ id, label, mood, references, palette, displayFont, bodyFont });
189
+ }
190
+ return out.length > 0 ? out : undefined;
191
+ }
192
+ //# sourceMappingURL=normalize.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize.js","sourceRoot":"","sources":["../../../src/core/question-form/normalize.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAEtD,MAAM,UAAU,cAAc,CAAC,CAAU,EAAE,KAAa;IACtD,IAAI,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC7C,MAA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AE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACjI,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC;YACtC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;YACjG,CAAC,CAAC,EAAE,CAAC;QACP,MAAM,WAAW,GAAG,OAAO,CAAC,CAAC,WAAW,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,gBAAgB,CAAC;QACzF,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,sCAAsC,CAAC;QACtG,GAAG,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,CAAC,CAAC;IAC5E,CAAC;IACD,OAAO,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,SAAS,CAAC;AAC1C,CAAC"}
@@ -0,0 +1,50 @@
1
+ import type { FormSegment, QuestionForm } from './types.js';
2
+ /**
3
+ * Split `input` into ordered prose/form segments. Scans repeatedly for
4
+ * `question-form`/`ask-question` opens; for each, locates the matching close
5
+ * tag and tries to parse the JSON body. A block that doesn't parse cleanly,
6
+ * or has no close tag yet, is left in the prose stream verbatim.
7
+ *
8
+ * @complexity O(n) amortized in `input.length` — each iteration advances the
9
+ * cursor past the segment it just emitted.
10
+ */
11
+ export declare function splitOnQuestionForms(input: string): FormSegment[];
12
+ /** The first complete, parseable `<question-form>` in `input`, or `null`. */
13
+ export declare function findFirstQuestionForm(input: string): {
14
+ form: QuestionForm;
15
+ raw: string;
16
+ } | null;
17
+ /**
18
+ * Convenience wrapper over {@link findFirstQuestionForm} matching the
19
+ * `parseQuestionForm()` name from the target API — returns just the form
20
+ * (dropping the matched raw text), or `null` when `input` has no complete
21
+ * question-form block. For a still-streaming block use
22
+ * {@link parsePartialQuestionForm} instead.
23
+ */
24
+ export declare function parseQuestionForm(input: string): QuestionForm | null;
25
+ /**
26
+ * Drop a trailing, not-yet-closed question-form block from streaming text so
27
+ * a chat surface doesn't flash raw `<question-form>{…` markup before the
28
+ * JSON finishes. Returns the visible text plus whether such an open block
29
+ * existed (meaning a form is mid-generation).
30
+ */
31
+ export declare function stripTrailingOpenQuestionForm(input: string): {
32
+ text: string;
33
+ hadOpenForm: boolean;
34
+ };
35
+ /** `true` when a question-form open tag is present but its close tag hasn't streamed in yet. */
36
+ export declare function hasUnterminatedQuestionForm(input: string): boolean;
37
+ /**
38
+ * Tolerant parser for a still-streaming `<question-form>` block. Unlike
39
+ * {@link tryParseForm} it does not require valid, complete JSON: it reads the
40
+ * title/id from the open tag's attrs (available the instant the tag streams
41
+ * in) and extracts however many *complete* question objects have arrived so
42
+ * far, so a Questions panel can render a frame immediately and fill
43
+ * questions in progressively. Returns `null` only when no open tag is
44
+ * present at all.
45
+ *
46
+ * @complexity O(n) in `input.length` (one regex scan plus a linear
47
+ * string-aware brace walk via {@link parsePartialJson}).
48
+ */
49
+ export declare function parsePartialQuestionForm(input: string): QuestionForm | null;
50
+ //# sourceMappingURL=scan.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scan.d.ts","sourceRoot":"","sources":["../../../src/core/question-form/scan.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAgB,WAAW,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAiB1E;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE,CAoCjE;AAED,6EAA6E;AAC7E,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAK/F;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAEpE;AAED;;;;;GAKG;AACH,wBAAgB,6BAA6B,CAAC,KAAK,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,OAAO,CAAA;CAAE,CAiBnG;AAED,gGAAgG;AAChG,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAElE;AAoDD;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAoC3E"}