@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,109 @@
1
+ /**
2
+ * @module transport
3
+ *
4
+ * The `ChatTransport` port — the single seam a host uses to reach a real
5
+ * agent runtime (SSE/fetch, WebSocket, a local daemon, an in-memory fake for
6
+ * tests).
7
+ *
8
+ * Moved here from `@jini-ai/chat-react` on 2026-07-29. The port is pure types over
9
+ * `AbortSignal` — no React, no DOM, no transport implementation — so keeping it in the React
10
+ * adapter meant a non-React host had to depend on the React package just to name the seam it
11
+ * implements. `@jini-ai/chat-react` re-exports every name below, so nothing that already imported
12
+ * them from there needs to change; no hook or component there constructs an
13
+ * `EventSource`/`fetch`/`WebSocket` directly — each receives a `ChatTransport` (via
14
+ * `<JiniChatProvider transport={...}>` or as a direct hook argument) and calls through it.
15
+ *
16
+ * Generalizes OD's `providers/daemon.ts` `streamViaDaemon` +
17
+ * `DaemonStreamHandlers` (`daemon.ts:261`, `daemon.ts:594`) — verified
18
+ * against the real source at
19
+ * `apps/web/src/providers/daemon.ts` (branch `refactor/web-chat-pane-slice`,
20
+ * commit `58fe4358747bd08b82c36947f1ff05aa5fa6a02a`). See
21
+ * `ADS-memory/reports/jini-port/recon/r4b-webui-design.md` §2 for the target shape this
22
+ * module implements verbatim.
23
+ */
24
+ import type { AgentEvent } from './events.js';
25
+ import type { ChatAttachment, ChatMessage, ChatRunStatus } from './messages.js';
26
+ /**
27
+ * Per-run event handlers a `ChatTransport` invokes as a run streams.
28
+ * Mirrors `DaemonStreamHandlers` (`onAgentEvent`/`onToolInputDelta`) plus the
29
+ * generic `StreamHandlers` `onError`/`onDone` pair the OD original composed
30
+ * via `extends`.
31
+ */
32
+ export interface RunHandlers {
33
+ /** Fired once per renderable unit of agent output. */
34
+ onEvent: (ev: AgentEvent) => void;
35
+ /**
36
+ * Live-only incremental tool-input fragment (e.g. Claude's
37
+ * `input_json_delta`). Ephemeral — never persisted; a consumer accumulates
38
+ * by tool-use `id` for a live preview and discards it once the full
39
+ * `tool_use` event arrives.
40
+ */
41
+ onToolInputDelta?: (id: string, name: string, delta: string) => void;
42
+ onError: (err: Error) => void;
43
+ /** Fired once the run reaches a terminal state, with the full event log. */
44
+ onDone: (finalEvents: AgentEvent[]) => void;
45
+ }
46
+ /**
47
+ * Opaque per-host payload threaded through to the transport unmodified (OD:
48
+ * `projectId`/`skillIds`/`designSystemId`; another host: whatever its own
49
+ * run-scoping concept is). This package never reads its fields.
50
+ */
51
+ export type RunContext = Record<string, unknown>;
52
+ export interface StartRunInput {
53
+ history: ChatMessage[];
54
+ agentId?: string;
55
+ conversationId?: string | null;
56
+ attachments?: ChatAttachment[];
57
+ context?: RunContext;
58
+ /** Stops the browser-side subscription; the run continues host-side. */
59
+ signal: AbortSignal;
60
+ /** Explicit user cancellation — distinct from `signal` (see OD's `cancelSignal`). */
61
+ cancelSignal?: AbortSignal;
62
+ }
63
+ /**
64
+ * Per-reattachment options. Separate from the positional `runId`/`handlers` pair, and optional, so
65
+ * an existing implementation stays type-compatible without edits.
66
+ */
67
+ export interface ReattachRunOptions {
68
+ /**
69
+ * Stops the browser-side subscription; the run continues host-side. Exactly what
70
+ * `StartRunInput.signal` is to `startRun`.
71
+ *
72
+ * `reattachRun` had no cancellation seam at all until 2026-07-29, and that was a resource leak
73
+ * rather than a missing convenience: a reattached SSE/WebSocket stream can outlive the component
74
+ * that opened it by as long as the run itself runs, and the shipped `useRunStream` hook was
75
+ * already creating (and aborting on unmount/reset/replacement) a controller it had no way to hand
76
+ * to the transport. The connection and its read loop simply kept going.
77
+ */
78
+ readonly signal?: AbortSignal;
79
+ }
80
+ /**
81
+ * The transport port. A host binds exactly one implementation (a real
82
+ * SSE/fetch adapter, a WebSocket adapter, or a fake for tests/demos) and
83
+ * passes it to `<JiniChatProvider>`. Every headless hook in this package
84
+ * that performs I/O receives this port — none constructs its own transport.
85
+ */
86
+ export interface ChatTransport {
87
+ startRun(input: StartRunInput, handlers: RunHandlers): Promise<{
88
+ runId: string;
89
+ }>;
90
+ /**
91
+ * Resume listening to an already-started run (reconnect/replay).
92
+ *
93
+ * An implementation that opens a long-lived stream **must** honor `options.signal` — it is the
94
+ * only way a caller can detach. See {@link ReattachRunOptions.signal}.
95
+ */
96
+ reattachRun(runId: string, handlers: RunHandlers, options?: ReattachRunOptions): Promise<void>;
97
+ fetchRunStatus(runId: string): Promise<ChatRunStatus | null>;
98
+ stopRun(runId: string): Promise<void>;
99
+ reportFeedback?(change: FeedbackChange): Promise<void>;
100
+ }
101
+ export interface FeedbackChange {
102
+ messageId: string;
103
+ runId?: string;
104
+ rating: 'positive' | 'negative';
105
+ reasonCode?: string;
106
+ note?: string;
107
+ }
108
+ export type OnFeedback = (change: FeedbackChange) => void;
109
+ //# sourceMappingURL=transport.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/core/transport.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEhF;;;;;GAKG;AACH,MAAM,WAAW,WAAW;IAC1B,sDAAsD;IACtD,OAAO,EAAE,CAAC,EAAE,EAAE,UAAU,KAAK,IAAI,CAAC;IAClC;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACrE,OAAO,EAAE,CAAC,GAAG,EAAE,KAAK,KAAK,IAAI,CAAC;IAC9B,4EAA4E;IAC5E,MAAM,EAAE,CAAC,WAAW,EAAE,UAAU,EAAE,KAAK,IAAI,CAAC;CAC7C;AAED;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAEjD,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,WAAW,EAAE,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,WAAW,CAAC,EAAE,cAAc,EAAE,CAAC;IAC/B,OAAO,CAAC,EAAE,UAAU,CAAC;IACrB,wEAAwE;IACxE,MAAM,EAAE,WAAW,CAAC;IACpB,qFAAqF;IACrF,YAAY,CAAC,EAAE,WAAW,CAAC;CAC5B;AAED;;;GAGG;AACH,MAAM,WAAW,kBAAkB;IACjC;;;;;;;;;OASG;IACH,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;CAC/B;AAED;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,QAAQ,EAAE,WAAW,GAAG,OAAO,CAAC;QAAE,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAClF;;;;;OAKG;IACH,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/F,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC,CAAC;IAC7D,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,cAAc,CAAC,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACxD;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,UAAU,GAAG,UAAU,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,UAAU,GAAG,CAAC,MAAM,EAAE,cAAc,KAAK,IAAI,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=transport.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transport.js","sourceRoot":"","sources":["../../src/core/transport.ts"],"names":[],"mappings":""}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @module artifacts
3
+ * Barrel for the artifact parsing/validation/recovery surface. Deliberately
4
+ * omits `./markdown-context.js` and `./markup-attributes.js`, which are
5
+ * internal implementation details shared by `./parser.js` and `./strip.js`
6
+ * (and, for `markup-attributes.js`, `../question-form/scan.js`), not part
7
+ * of this package's public API.
8
+ */
9
+ export * from './types.js';
10
+ export * from './parser.js';
11
+ export * from './strip.js';
12
+ export * from './validate.js';
13
+ export * from './manifest.js';
14
+ export * from './recover.js';
15
+ export * from './pointer.js';
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/util/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * @module artifacts
3
+ * Barrel for the artifact parsing/validation/recovery surface. Deliberately
4
+ * omits `./markdown-context.js` and `./markup-attributes.js`, which are
5
+ * internal implementation details shared by `./parser.js` and `./strip.js`
6
+ * (and, for `markup-attributes.js`, `../question-form/scan.js`), not part
7
+ * of this package's public API.
8
+ */
9
+ export * from './types.js';
10
+ export * from './parser.js';
11
+ export * from './strip.js';
12
+ export * from './validate.js';
13
+ export * from './manifest.js';
14
+ export * from './recover.js';
15
+ export * from './pointer.js';
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/util/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC"}
@@ -0,0 +1,39 @@
1
+ /**
2
+ * @module manifest
3
+ *
4
+ * Create, serialize, parse, and infer the sidecar `ArtifactManifest` a
5
+ * generated file carries. See `./types.js` for the manifest shape itself.
6
+ */
7
+ import type { ArtifactManifest } from './types.js';
8
+ /** The manifest sidecar file name convention for a given artifact entry file name. */
9
+ export declare function artifactManifestNameFor(entry: string): string;
10
+ /** Build a fresh, complete manifest for a newly-persisted HTML artifact. */
11
+ export declare function createHtmlArtifactManifest(input: {
12
+ entry: string;
13
+ title: string;
14
+ metadata?: Record<string, unknown>;
15
+ sourceSkillId?: string;
16
+ designSystemId?: string | null;
17
+ }): ArtifactManifest;
18
+ export declare function serializeArtifactManifest(manifest: ArtifactManifest): string;
19
+ /**
20
+ * Parse and validate a manifest JSON string, rejecting anything that isn't a
21
+ * well-formed, currently-supported manifest (wrong version, missing
22
+ * required fields, or a `kind`/`renderer`/`status`/`exports` value outside
23
+ * the known sets).
24
+ *
25
+ * @returns The validated manifest, or `null` on any parse/shape failure.
26
+ * @complexity O(k) in the manifest's own field/array count — no I/O.
27
+ */
28
+ export declare function parseArtifactManifest(raw: string): ArtifactManifest | null;
29
+ /**
30
+ * Infer a manifest for a legacy artifact file that predates manifest
31
+ * sidecars, from its entry file name alone (extension → kind → renderer).
32
+ * @returns `null` when the extension isn't a recognized artifact kind.
33
+ */
34
+ export declare function inferLegacyManifest(input: {
35
+ entry: string;
36
+ title?: string;
37
+ metadata?: Record<string, unknown>;
38
+ }): ArtifactManifest | null;
39
+ //# sourceMappingURL=manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../../src/core/util/manifest.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAoC,gBAAgB,EAAsC,MAAM,YAAY,CAAC;AA2DzH,sFAAsF;AACtF,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE7D;AAED,4EAA4E;AAC5E,wBAAgB,0BAA0B,CAAC,KAAK,EAAE;IAChD,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACnC,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC,GAAG,gBAAgB,CAiBnB;AAED,wBAAgB,yBAAyB,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,CAE5E;AAED;;;;;;;;GAQG;AACH,wBAAgB,qBAAqB,CAAC,GAAG,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAoC1E;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAAE,GAAG,gBAAgB,GAAG,IAAI,CA4BzI"}
@@ -0,0 +1,173 @@
1
+ const MANIFEST_VERSION = 1;
2
+ const ALLOWED_KINDS = new Set([
3
+ 'html',
4
+ 'deck',
5
+ 'react-component',
6
+ 'markdown-document',
7
+ 'svg',
8
+ 'diagram',
9
+ 'code-snippet',
10
+ 'mini-app',
11
+ 'design-system',
12
+ ]);
13
+ const ALLOWED_RENDERERS = new Set([
14
+ 'html',
15
+ 'deck-html',
16
+ 'react-component',
17
+ 'markdown',
18
+ 'svg',
19
+ 'diagram',
20
+ 'code',
21
+ 'mini-app',
22
+ 'design-system',
23
+ ]);
24
+ const ALLOWED_EXPORTS = new Set(['html', 'pdf', 'zip', 'jsx', 'md', 'svg', 'txt']);
25
+ const ALLOWED_STATUS = new Set(['streaming', 'complete', 'error']);
26
+ function normalizeExt(name) {
27
+ const i = name.lastIndexOf('.');
28
+ return i >= 0 ? name.slice(i).toLowerCase() : '';
29
+ }
30
+ function inferKindFromEntry(entry) {
31
+ const ext = normalizeExt(entry);
32
+ if (['.html', '.htm'].includes(ext))
33
+ return 'html';
34
+ if (ext === '.svg')
35
+ return 'svg';
36
+ if (ext === '.md')
37
+ return 'markdown-document';
38
+ if (['.jsx', '.tsx'].includes(ext))
39
+ return 'react-component';
40
+ if (['.js', '.ts', '.json', '.css'].includes(ext))
41
+ return 'code-snippet';
42
+ return null;
43
+ }
44
+ function exportsForKind(kind) {
45
+ if (kind === 'deck')
46
+ return ['html', 'pdf', 'zip'];
47
+ if (kind === 'react-component')
48
+ return ['jsx', 'html', 'zip'];
49
+ if (kind === 'markdown-document')
50
+ return ['md', 'html', 'pdf', 'zip'];
51
+ if (kind === 'svg' || kind === 'diagram')
52
+ return ['svg', 'zip'];
53
+ if (kind === 'code-snippet')
54
+ return ['txt', 'zip'];
55
+ return ['html', 'pdf', 'zip'];
56
+ }
57
+ /** The manifest sidecar file name convention for a given artifact entry file name. */
58
+ export function artifactManifestNameFor(entry) {
59
+ return `${entry}.artifact.json`;
60
+ }
61
+ /** Build a fresh, complete manifest for a newly-persisted HTML artifact. */
62
+ export function createHtmlArtifactManifest(input) {
63
+ const now = new Date().toISOString();
64
+ return {
65
+ version: MANIFEST_VERSION,
66
+ kind: 'html',
67
+ title: input.title,
68
+ entry: input.entry,
69
+ renderer: 'html',
70
+ status: 'complete',
71
+ exports: ['html', 'pdf', 'zip'],
72
+ primary: true,
73
+ createdAt: now,
74
+ updatedAt: now,
75
+ sourceSkillId: input.sourceSkillId,
76
+ designSystemId: input.designSystemId,
77
+ metadata: input.metadata,
78
+ };
79
+ }
80
+ export function serializeArtifactManifest(manifest) {
81
+ return JSON.stringify(manifest, null, 2);
82
+ }
83
+ /**
84
+ * Parse and validate a manifest JSON string, rejecting anything that isn't a
85
+ * well-formed, currently-supported manifest (wrong version, missing
86
+ * required fields, or a `kind`/`renderer`/`status`/`exports` value outside
87
+ * the known sets).
88
+ *
89
+ * @returns The validated manifest, or `null` on any parse/shape failure.
90
+ * @complexity O(k) in the manifest's own field/array count — no I/O.
91
+ */
92
+ export function parseArtifactManifest(raw) {
93
+ try {
94
+ const parsed = JSON.parse(raw);
95
+ if (parsed?.version !== MANIFEST_VERSION)
96
+ return null;
97
+ if (typeof parsed.entry !== 'string' || !parsed.entry)
98
+ return null;
99
+ if (typeof parsed.title !== 'string' || !parsed.title)
100
+ return null;
101
+ if (!Array.isArray(parsed.exports))
102
+ return null;
103
+ if (typeof parsed.kind !== 'string' || typeof parsed.renderer !== 'string') {
104
+ return null;
105
+ }
106
+ if (!ALLOWED_KINDS.has(parsed.kind))
107
+ return null;
108
+ if (!ALLOWED_RENDERERS.has(parsed.renderer))
109
+ return null;
110
+ if (parsed.status !== undefined && !ALLOWED_STATUS.has(parsed.status)) {
111
+ return null;
112
+ }
113
+ if (parsed.exports.length === 0)
114
+ return null;
115
+ if (parsed.exports.some((value) => !ALLOWED_EXPORTS.has(value)))
116
+ return null;
117
+ return {
118
+ version: MANIFEST_VERSION,
119
+ kind: parsed.kind,
120
+ title: parsed.title,
121
+ entry: parsed.entry,
122
+ renderer: parsed.renderer,
123
+ status: ALLOWED_STATUS.has(parsed.status) ? parsed.status : 'complete',
124
+ exports: parsed.exports,
125
+ primary: parsed.primary === true || typeof parsed.primary === 'string' ? parsed.primary : undefined,
126
+ supportingFiles: Array.isArray(parsed.supportingFiles) ? parsed.supportingFiles.filter((x) => typeof x === 'string') : undefined,
127
+ createdAt: typeof parsed.createdAt === 'string' ? parsed.createdAt : undefined,
128
+ updatedAt: typeof parsed.updatedAt === 'string' ? parsed.updatedAt : undefined,
129
+ sourceSkillId: typeof parsed.sourceSkillId === 'string' ? parsed.sourceSkillId : undefined,
130
+ designSystemId: typeof parsed.designSystemId === 'string' || parsed.designSystemId === null ? parsed.designSystemId : undefined,
131
+ metadata: parsed.metadata && typeof parsed.metadata === 'object' && !Array.isArray(parsed.metadata) ? parsed.metadata : undefined,
132
+ };
133
+ }
134
+ catch {
135
+ return null;
136
+ }
137
+ }
138
+ /**
139
+ * Infer a manifest for a legacy artifact file that predates manifest
140
+ * sidecars, from its entry file name alone (extension → kind → renderer).
141
+ * @returns `null` when the extension isn't a recognized artifact kind.
142
+ */
143
+ export function inferLegacyManifest(input) {
144
+ const kind = inferKindFromEntry(input.entry);
145
+ if (!kind)
146
+ return null;
147
+ const lowerEntry = input.entry.toLowerCase();
148
+ const isDeck = kind === 'html' && (lowerEntry.includes('deck') || lowerEntry.includes('slides') || lowerEntry.includes('pitch'));
149
+ const renderer = isDeck
150
+ ? 'deck-html'
151
+ : kind === 'html'
152
+ ? 'html'
153
+ : kind === 'markdown-document'
154
+ ? 'markdown'
155
+ : kind === 'react-component'
156
+ ? 'react-component'
157
+ : kind === 'code-snippet'
158
+ ? 'code'
159
+ : kind; // only 'svg' remains — a valid ArtifactRendererId as-is
160
+ const resolvedKind = isDeck ? 'deck' : kind;
161
+ return {
162
+ version: MANIFEST_VERSION,
163
+ kind: resolvedKind,
164
+ title: input.title || input.entry,
165
+ entry: input.entry,
166
+ renderer,
167
+ status: 'complete',
168
+ exports: exportsForKind(resolvedKind),
169
+ primary: resolvedKind === 'html' || resolvedKind === 'deck' ? true : undefined,
170
+ metadata: input.metadata,
171
+ };
172
+ }
173
+ //# sourceMappingURL=manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest.js","sourceRoot":"","sources":["../../../src/core/util/manifest.ts"],"names":[],"mappings":"AAQA,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,MAAM,aAAa,GAA8B,IAAI,GAAG,CAAC;IACvD,MAAM;IACN,MAAM;IACN,iBAAiB;IACjB,mBAAmB;IACnB,KAAK;IACL,SAAS;IACT,cAAc;IACd,UAAU;IACV,eAAe;CAChB,CAAC,CAAC;AACH,MAAM,iBAAiB,GAAoC,IAAI,GAAG,CAAC;IACjE,MAAM;IACN,WAAW;IACX,iBAAiB;IACjB,UAAU;IACV,KAAK;IACL,SAAS;IACT,MAA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,KAAK;QACjC,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,QAAQ;QACR,MAAM,EAAE,UAAU;QAClB,OAAO,EAAE,cAAc,CAAC,YAAY,CAAC;QACrC,OAAO,EAAE,YAAY,KAAK,MAAM,IAAI,YAAY,KAAK,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS;QAC9E,QAAQ,EAAE,KAAK,CAAC,QAAQ;KACzB,CAAC;AACJ,CAAC"}
@@ -0,0 +1,47 @@
1
+ /**
2
+ * @module markdown-context
3
+ * @internal
4
+ *
5
+ * Shared Markdown-context helpers used by both the streaming artifact parser
6
+ * ({@link ./parser.js}) and the post-stream `<artifact>` stripper
7
+ * ({@link ./strip.js}). The single source of truth for what counts as a
8
+ * fenced code block or an inline code span, so the parser/stripper's view of
9
+ * a buffer matches what a Markdown-rendering chat surface will actually
10
+ * render — anything that "looks like" an artifact tag inside one of these
11
+ * regions is literal Markdown and must not be treated as a real protocol tag.
12
+ *
13
+ * Not part of the package's public surface (no `index.ts` re-export): it is
14
+ * an implementation detail shared by two sibling modules, not a name a
15
+ * consumer should depend on directly.
16
+ */
17
+ export declare const FENCE_OPEN_RE: RegExp;
18
+ export declare const FENCE_CLOSE_RE: RegExp;
19
+ export declare const INLINE_CODE_RE: RegExp;
20
+ /**
21
+ * `<artifact` followed by whitespace is a real protocol open tag; any other
22
+ * continuation (e.g. `<artifactual`) is a prefix-shared literal that must
23
+ * not be treated as a tag.
24
+ */
25
+ export declare function isRealArtifactOpenAt(content: string, idx: number): boolean;
26
+ export type Range = readonly [number, number];
27
+ /**
28
+ * Compute the half-open `[start, end)` ranges of `buffer` that a Markdown
29
+ * renderer would treat as fenced code blocks or inline code spans. The
30
+ * `unclosedFenceStart` is the index of an opening fence with no matching
31
+ * close in the buffer (or `null` if every fence is closed) — the streaming
32
+ * parser uses it to hold back rendering; the stripper ignores it.
33
+ *
34
+ * Lines without a terminating `\n` (a trailing partial line during
35
+ * streaming) are not classified as fence delimiters here; callers that care
36
+ * about partial-tail behavior inspect the tail themselves.
37
+ *
38
+ * @complexity O(n) in `buffer.length` — one line-by-line scan plus one
39
+ * backtick scan per accumulated paragraph block.
40
+ */
41
+ export declare function computeSkipRanges(buffer: string): {
42
+ ranges: Range[];
43
+ unclosedFenceStart: number | null;
44
+ };
45
+ /** `true` when position `p` falls inside one of `ranges` (half-open intervals). */
46
+ export declare function rangeContains(ranges: ReadonlyArray<Range>, p: number): boolean;
47
+ //# sourceMappingURL=markdown-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-context.d.ts","sourceRoot":"","sources":["../../../src/core/util/markdown-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,eAAO,MAAM,aAAa,QAAyB,CAAC;AACpD,eAAO,MAAM,cAAc,QAAa,CAAC;AAGzC,eAAO,MAAM,cAAc,QAAa,CAAC;AAUzC;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAG1E;AAED,MAAM,MAAM,KAAK,GAAG,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE9C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG;IACjD,MAAM,EAAE,KAAK,EAAE,CAAC;IAChB,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;CACnC,CAwDA;AAED,mFAAmF;AACnF,wBAAgB,aAAa,CAAC,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAK9E"}
@@ -0,0 +1,125 @@
1
+ /**
2
+ * @module markdown-context
3
+ * @internal
4
+ *
5
+ * Shared Markdown-context helpers used by both the streaming artifact parser
6
+ * ({@link ./parser.js}) and the post-stream `<artifact>` stripper
7
+ * ({@link ./strip.js}). The single source of truth for what counts as a
8
+ * fenced code block or an inline code span, so the parser/stripper's view of
9
+ * a buffer matches what a Markdown-rendering chat surface will actually
10
+ * render — anything that "looks like" an artifact tag inside one of these
11
+ * regions is literal Markdown and must not be treated as a real protocol tag.
12
+ *
13
+ * Not part of the package's public surface (no `index.ts` re-export): it is
14
+ * an implementation detail shared by two sibling modules, not a name a
15
+ * consumer should depend on directly.
16
+ */
17
+ // Line-anchored fence delimiters. Deliberately asymmetric: an opening fence
18
+ // may carry an info string (e.g. ```html), a closing fence must be a bare
19
+ // triple-backtick line. Neither permits leading indentation — an indented
20
+ // " ```" line renders as a paragraph, not a fence.
21
+ export const FENCE_OPEN_RE = /^```(\w[\w+-]*)?\s*$/;
22
+ export const FENCE_CLOSE_RE = /^```\s*$/;
23
+ // Inline code span (single-backtick pair).
24
+ export const INLINE_CODE_RE = /`[^`]+`/g;
25
+ // Paragraph-break recognizers — mirror a typical Markdown paragraph-block
26
+ // walker's block-starter set (heading / list item / blank line). A block
27
+ // boundary caps how far inline-code backtick pairing can reach: backticks
28
+ // never pair across it in the rendered output.
29
+ const HEADING_RE = /^#{1,4}\s+/;
30
+ const UL_ITEM_RE = /^\s*[-*+]\s+/;
31
+ const OL_ITEM_RE = /^\s*\d+\.\s+/;
32
+ /**
33
+ * `<artifact` followed by whitespace is a real protocol open tag; any other
34
+ * continuation (e.g. `<artifactual`) is a prefix-shared literal that must
35
+ * not be treated as a tag.
36
+ */
37
+ export function isRealArtifactOpenAt(content, idx) {
38
+ const next = content.charAt(idx + '<artifact'.length);
39
+ return next !== '' && /\s/.test(next);
40
+ }
41
+ /**
42
+ * Compute the half-open `[start, end)` ranges of `buffer` that a Markdown
43
+ * renderer would treat as fenced code blocks or inline code spans. The
44
+ * `unclosedFenceStart` is the index of an opening fence with no matching
45
+ * close in the buffer (or `null` if every fence is closed) — the streaming
46
+ * parser uses it to hold back rendering; the stripper ignores it.
47
+ *
48
+ * Lines without a terminating `\n` (a trailing partial line during
49
+ * streaming) are not classified as fence delimiters here; callers that care
50
+ * about partial-tail behavior inspect the tail themselves.
51
+ *
52
+ * @complexity O(n) in `buffer.length` — one line-by-line scan plus one
53
+ * backtick scan per accumulated paragraph block.
54
+ */
55
+ export function computeSkipRanges(buffer) {
56
+ const ranges = [];
57
+ // Paragraph-block regions are contiguous spans of paragraph lines outside
58
+ // any fenced code block; inline-code scanning is restricted to one block at
59
+ // a time so backticks never pair across a block boundary.
60
+ const blockRegions = [];
61
+ let pos = 0;
62
+ let inFence = false;
63
+ let fenceStart = -1;
64
+ let blockStart = -1;
65
+ const closeBlockBefore = (idx) => {
66
+ if (blockStart !== -1 && idx > blockStart)
67
+ blockRegions.push([blockStart, idx]);
68
+ blockStart = -1;
69
+ };
70
+ while (pos < buffer.length) {
71
+ const eol = buffer.indexOf('\n', pos);
72
+ const lineEnd = eol === -1 ? buffer.length : eol;
73
+ const line = buffer.slice(pos, lineEnd);
74
+ const lineHasNewline = eol !== -1;
75
+ if (!inFence) {
76
+ if (lineHasNewline && FENCE_OPEN_RE.test(line)) {
77
+ closeBlockBefore(pos);
78
+ inFence = true;
79
+ fenceStart = pos;
80
+ }
81
+ else if (line.trim() === '') {
82
+ closeBlockBefore(pos);
83
+ }
84
+ else if (HEADING_RE.test(line) || UL_ITEM_RE.test(line) || OL_ITEM_RE.test(line)) {
85
+ // Each heading/list-item line is its own inline-scan region rather
86
+ // than joining adjacent paragraphs.
87
+ closeBlockBefore(pos);
88
+ blockRegions.push([pos, lineEnd]);
89
+ }
90
+ else {
91
+ if (blockStart === -1)
92
+ blockStart = pos;
93
+ }
94
+ }
95
+ else if (lineHasNewline && FENCE_CLOSE_RE.test(line)) {
96
+ inFence = false;
97
+ ranges.push([fenceStart, eol + 1]);
98
+ fenceStart = -1;
99
+ }
100
+ if (!lineHasNewline)
101
+ break; // trailing partial line — already accounted for above
102
+ pos = eol + 1;
103
+ }
104
+ if (!inFence)
105
+ closeBlockBefore(buffer.length); // flush an open paragraph region at end-of-buffer
106
+ for (const [s, e] of blockRegions) {
107
+ INLINE_CODE_RE.lastIndex = 0;
108
+ const segment = buffer.slice(s, e);
109
+ let m = INLINE_CODE_RE.exec(segment);
110
+ while (m !== null) {
111
+ ranges.push([s + m.index, s + m.index + m[0].length]);
112
+ m = INLINE_CODE_RE.exec(segment);
113
+ }
114
+ }
115
+ return { ranges, unclosedFenceStart: inFence ? fenceStart : null };
116
+ }
117
+ /** `true` when position `p` falls inside one of `ranges` (half-open intervals). */
118
+ export function rangeContains(ranges, p) {
119
+ for (const [s, e] of ranges) {
120
+ if (p >= s && p < e)
121
+ return true;
122
+ }
123
+ return false;
124
+ }
125
+ //# sourceMappingURL=markdown-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markdown-context.js","sourceRoot":"","sources":["../../../src/core/util/markdown-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,4EAA4E;AAC5E,0EAA0E;AAC1E,0EAA0E;AAC1E,qDAAqD;AACrD,MAAM,CAAC,MAAM,aAAa,GAAG,sBAAsB,CAAC;AACpD,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;AAEzC,2CAA2C;AAC3C,MAAM,CAAC,MAAM,cAAc,GAAG,UAAU,CAAC;AAEzC,0EAA0E;AAC1E,yEAAyE;AACzE,0EAA0E;AAC1E,+CAA+C;AAC/C,MAAM,UAAU,GAAG,YAAY,CAAC;AAChC,MAAM,UAAU,GAAG,cAAc,CAAC;AAClC,MAAM,UAAU,GAAG,cAAc,CAAC;AAElC;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe,EAAE,GAAW;IAC/D,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,GAAG,GAAG,WAAW,CAAC,MAAM,CAAC,CAAC;IACtD,OAAO,IAAI,KAAK,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACxC,CAAC;AAID;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAI9C,MAAM,MAAM,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CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;YACtD,CAAC,GAAG,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnC,CAAC;IACH,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,kBAAkB,EAAE,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;AACrE,CAAC;AAED,mFAAmF;AACnF,MAAM,UAAU,aAAa,CAAC,MAA4B,EAAE,CAAS;IACnE,KAAK,MAAM,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,MAAM,EAAE,CAAC;QAC5B,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;IACnC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * @module markup-attributes
3
+ *
4
+ * Shared quoted-attribute parser for this package's inline protocol tags —
5
+ * `<artifact …>` (`./parser.ts`, `./strip.ts`) and `<question-form …>` /
6
+ * `<ask-question …>` (`../question-form/scan.ts`). All three interpret
7
+ * model-produced markup with the exact same tolerant grammar; centralizing
8
+ * it means a future correction to escaping, accepted attribute names, or
9
+ * malformed-quote handling can't drift between streaming, post-stream, and
10
+ * question-form parsing.
11
+ *
12
+ * Internal only — deliberately not part of this package's public surface;
13
+ * see `./index.ts`'s barrel comment.
14
+ */
15
+ /**
16
+ * Parse `name="value"` / `name='value'` pairs out of a tag's raw attribute
17
+ * string (the content between the tag name and the closing `>`).
18
+ */
19
+ export declare function parseQuotedAttrs(raw: string): Record<string, string>;
20
+ //# sourceMappingURL=markup-attributes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markup-attributes.d.ts","sourceRoot":"","sources":["../../../src/core/util/markup-attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;GAGG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAapE"}
@@ -0,0 +1,33 @@
1
+ /**
2
+ * @module markup-attributes
3
+ *
4
+ * Shared quoted-attribute parser for this package's inline protocol tags —
5
+ * `<artifact …>` (`./parser.ts`, `./strip.ts`) and `<question-form …>` /
6
+ * `<ask-question …>` (`../question-form/scan.ts`). All three interpret
7
+ * model-produced markup with the exact same tolerant grammar; centralizing
8
+ * it means a future correction to escaping, accepted attribute names, or
9
+ * malformed-quote handling can't drift between streaming, post-stream, and
10
+ * question-form parsing.
11
+ *
12
+ * Internal only — deliberately not part of this package's public surface;
13
+ * see `./index.ts`'s barrel comment.
14
+ */
15
+ /**
16
+ * Parse `name="value"` / `name='value'` pairs out of a tag's raw attribute
17
+ * string (the content between the tag name and the closing `>`).
18
+ */
19
+ export function parseQuotedAttrs(raw) {
20
+ const re = /(\w+)\s*=\s*(?:"([^"]*)"|'([^']*)')/g;
21
+ const out = {};
22
+ let m = re.exec(raw);
23
+ while (m !== null) {
24
+ // The pattern's quote alternation means exactly one of group 2 (double-
25
+ // quoted) / group 3 (single-quoted) participates in any successful match
26
+ // — never both, never neither — so `m[2] ?? m[3]` is always defined; the
27
+ // cast just satisfies `noUncheckedIndexedAccess`.
28
+ out[m[1]] = (m[2] ?? m[3]);
29
+ m = re.exec(raw);
30
+ }
31
+ return out;
32
+ }
33
+ //# sourceMappingURL=markup-attributes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markup-attributes.js","sourceRoot":"","sources":["../../../src/core/util/markup-attributes.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAAC,GAAW;IAC1C,MAAM,EAAE,GAAG,sCAAsC,CAAC;IAClD,MAAM,GAAG,GAA2B,EAAE,CAAC;IACvC,IAAI,CAAC,GAA2B,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC7C,OAAO,CAAC,KAAK,IAAI,EAAE,CAAC;QAClB,wEAAwE;QACxE,yEAAyE;QACzE,yEAAyE;QACzE,kDAAkD;QAClD,GAAG,CAAC,CAAC,CAAC,CAAC,CAAW,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAW,CAAC;QAC/C,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACnB,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}