@signalcore/ui 0.1.0 → 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (611) hide show
  1. package/README.md +896 -513
  2. package/dist/AgentAbout.d.ts +186 -0
  3. package/dist/AgentAbout.js +1020 -0
  4. package/dist/AgentAbout.js.map +1 -0
  5. package/dist/AgentCard.d.ts +49 -0
  6. package/dist/AgentCard.js +77 -0
  7. package/dist/AgentCard.js.map +1 -0
  8. package/dist/AgentChat.d.ts +233 -0
  9. package/dist/AgentChat.js +1127 -0
  10. package/dist/AgentChat.js.map +1 -0
  11. package/dist/AgentSpace.d.ts +112 -0
  12. package/dist/AgentSpace.js +339 -0
  13. package/dist/AgentSpace.js.map +1 -0
  14. package/dist/AgentTasks.d.ts +48 -0
  15. package/dist/AgentTasks.js +120 -0
  16. package/dist/AgentTasks.js.map +1 -0
  17. package/dist/BrowserView.d.ts +52 -0
  18. package/dist/BrowserView.js +328 -0
  19. package/dist/BrowserView.js.map +1 -0
  20. package/dist/FileView.d.ts +63 -0
  21. package/dist/FileView.js +449 -0
  22. package/dist/FileView.js.map +1 -0
  23. package/dist/Modes.d.ts +13 -0
  24. package/dist/Modes.js +75 -0
  25. package/dist/Modes.js.map +1 -0
  26. package/dist/VoiceCall.d.ts +91 -0
  27. package/dist/VoiceCall.js +302 -0
  28. package/dist/VoiceCall.js.map +1 -0
  29. package/dist/about.d.ts +212 -0
  30. package/dist/about.js +136 -0
  31. package/dist/about.js.map +1 -0
  32. package/dist/agentIcons.d.ts +33 -0
  33. package/dist/agentIcons.js +36 -0
  34. package/dist/agentIcons.js.map +1 -0
  35. package/dist/automation/Automation.d.ts +35 -0
  36. package/dist/automation/Automation.js +268 -0
  37. package/dist/automation/Automation.js.map +1 -0
  38. package/dist/automation/RunView.d.ts +25 -0
  39. package/dist/automation/RunView.js +187 -0
  40. package/dist/automation/RunView.js.map +1 -0
  41. package/dist/automation/cron.d.ts +41 -0
  42. package/dist/automation/cron.js +169 -0
  43. package/dist/automation/cron.js.map +1 -0
  44. package/dist/automation/marks.js +121 -0
  45. package/dist/automation/marks.js.map +1 -0
  46. package/dist/automation/messages.d.ts +113 -0
  47. package/dist/automation/messages.js +113 -0
  48. package/dist/automation/messages.js.map +1 -0
  49. package/dist/automation/record.d.ts +47 -0
  50. package/dist/automation/record.js +177 -0
  51. package/dist/automation/record.js.map +1 -0
  52. package/dist/automation/types.d.ts +143 -0
  53. package/dist/automation/when.d.ts +36 -0
  54. package/dist/automation/when.js +168 -0
  55. package/dist/automation/when.js.map +1 -0
  56. package/dist/blocks.d.ts +185 -0
  57. package/dist/browser.js +292 -0
  58. package/dist/browser.js.map +1 -0
  59. package/dist/call.d.ts +89 -0
  60. package/dist/call.js +218 -0
  61. package/dist/call.js.map +1 -0
  62. package/dist/channelParts.js +26 -0
  63. package/dist/channelParts.js.map +1 -0
  64. package/dist/classes.js +8 -3
  65. package/dist/classes.js.map +1 -0
  66. package/dist/client.d.ts +146 -54
  67. package/dist/client.js +204 -1
  68. package/dist/client.js.map +1 -0
  69. package/dist/conversationFiles.js +46 -0
  70. package/dist/conversationFiles.js.map +1 -0
  71. package/dist/credentials.d.ts +45 -0
  72. package/dist/credentials.js +98 -0
  73. package/dist/credentials.js.map +1 -0
  74. package/dist/dev.js +17 -0
  75. package/dist/dev.js.map +1 -0
  76. package/dist/es.d.ts +17 -0
  77. package/dist/es.js +382 -0
  78. package/dist/es.js.map +1 -0
  79. package/dist/files.d.ts +21 -0
  80. package/dist/files.js +214 -0
  81. package/dist/files.js.map +1 -0
  82. package/dist/frames.d.ts +115 -0
  83. package/dist/frames.js +219 -0
  84. package/dist/frames.js.map +1 -0
  85. package/dist/icons.js +29 -0
  86. package/dist/icons.js.map +1 -0
  87. package/dist/index.d.ts +63 -60
  88. package/dist/index.js +59 -45
  89. package/dist/kit/AudioPlayer.d.ts +20 -0
  90. package/dist/kit/AudioPlayer.js +116 -0
  91. package/dist/kit/AudioPlayer.js.map +1 -0
  92. package/dist/kit/Button.d.ts +29 -0
  93. package/dist/kit/Button.js +59 -0
  94. package/dist/kit/Button.js.map +1 -0
  95. package/dist/kit/Card.d.ts +16 -0
  96. package/dist/kit/Card.js +36 -0
  97. package/dist/kit/Card.js.map +1 -0
  98. package/dist/kit/Chart.js +152 -0
  99. package/dist/kit/Chart.js.map +1 -0
  100. package/dist/kit/Choices.d.ts +21 -0
  101. package/dist/kit/Choices.js +99 -0
  102. package/dist/kit/Choices.js.map +1 -0
  103. package/dist/kit/Combobox.d.ts +26 -0
  104. package/dist/kit/Combobox.js +190 -0
  105. package/dist/kit/Combobox.js.map +1 -0
  106. package/dist/kit/DateField.d.ts +17 -0
  107. package/dist/kit/DateField.js +133 -0
  108. package/dist/kit/DateField.js.map +1 -0
  109. package/dist/kit/Field.d.ts +40 -0
  110. package/dist/kit/Field.js +98 -0
  111. package/dist/kit/Field.js.map +1 -0
  112. package/dist/kit/FileField.d.ts +113 -0
  113. package/dist/kit/FileField.js +341 -0
  114. package/dist/kit/FileField.js.map +1 -0
  115. package/dist/kit/FileMark.d.ts +15 -0
  116. package/dist/kit/FileMark.js +39 -0
  117. package/dist/kit/FileMark.js.map +1 -0
  118. package/dist/kit/Inputs.d.ts +59 -0
  119. package/dist/kit/Inputs.js +205 -0
  120. package/dist/kit/Inputs.js.map +1 -0
  121. package/dist/kit/List.d.ts +47 -0
  122. package/dist/kit/List.js +85 -0
  123. package/dist/kit/List.js.map +1 -0
  124. package/dist/kit/Mark.d.ts +30 -0
  125. package/dist/kit/Mark.js +27 -0
  126. package/dist/kit/Mark.js.map +1 -0
  127. package/dist/kit/MarkStack.d.ts +15 -0
  128. package/dist/kit/MarkStack.js +26 -0
  129. package/dist/kit/MarkStack.js.map +1 -0
  130. package/dist/kit/Note.d.ts +11 -0
  131. package/dist/kit/Note.js +31 -0
  132. package/dist/kit/Note.js.map +1 -0
  133. package/dist/kit/Popover.js +90 -0
  134. package/dist/kit/Popover.js.map +1 -0
  135. package/dist/kit/RangeField.d.ts +14 -0
  136. package/dist/kit/RangeField.js +47 -0
  137. package/dist/kit/RangeField.js.map +1 -0
  138. package/dist/kit/RatingField.d.ts +14 -0
  139. package/dist/kit/RatingField.js +50 -0
  140. package/dist/kit/RatingField.js.map +1 -0
  141. package/dist/kit/Stat.d.ts +26 -0
  142. package/dist/kit/Stat.js +46 -0
  143. package/dist/kit/Stat.js.map +1 -0
  144. package/dist/kit/Switch.d.ts +14 -0
  145. package/dist/kit/Switch.js +21 -0
  146. package/dist/kit/Switch.js.map +1 -0
  147. package/dist/kit/Tag.d.ts +16 -0
  148. package/dist/kit/Tag.js +20 -0
  149. package/dist/kit/Tag.js.map +1 -0
  150. package/dist/kit/Tile.d.ts +34 -0
  151. package/dist/kit/Tile.js +52 -0
  152. package/dist/kit/Tile.js.map +1 -0
  153. package/dist/kit/TimeField.d.ts +31 -0
  154. package/dist/kit/TimeField.js +109 -0
  155. package/dist/kit/TimeField.js.map +1 -0
  156. package/dist/kit/context.d.ts +22 -0
  157. package/dist/kit/context.js +46 -0
  158. package/dist/kit/context.js.map +1 -0
  159. package/dist/kit/dates.d.ts +14 -0
  160. package/dist/kit/dates.js +129 -0
  161. package/dist/kit/dates.js.map +1 -0
  162. package/dist/kit/messages.d.ts +99 -0
  163. package/dist/kit/messages.js +66 -0
  164. package/dist/kit/messages.js.map +1 -0
  165. package/dist/kit/numbers.d.ts +12 -0
  166. package/dist/kit/numbers.js +40 -0
  167. package/dist/kit/numbers.js.map +1 -0
  168. package/dist/kit/options.d.ts +10 -0
  169. package/dist/kit/options.js +23 -0
  170. package/dist/kit/options.js.map +1 -0
  171. package/dist/kit/uploads.d.ts +42 -0
  172. package/dist/kit/uploads.js +165 -0
  173. package/dist/kit/uploads.js.map +1 -0
  174. package/dist/kit/waveform.js +76 -0
  175. package/dist/kit/waveform.js.map +1 -0
  176. package/dist/locale.d.ts +1 -0
  177. package/dist/locale.js +1 -0
  178. package/dist/markdown.js +84 -0
  179. package/dist/markdown.js.map +1 -0
  180. package/dist/marks.js +217 -0
  181. package/dist/marks.js.map +1 -0
  182. package/dist/reveal.js +48 -0
  183. package/dist/reveal.js.map +1 -0
  184. package/dist/stepGlyphs.js +62 -0
  185. package/dist/stepGlyphs.js.map +1 -0
  186. package/dist/surface/Form.js +264 -0
  187. package/dist/surface/Form.js.map +1 -0
  188. package/dist/surface/Markdown.js +42 -0
  189. package/dist/surface/Markdown.js.map +1 -0
  190. package/dist/surface/Surface.d.ts +31 -17
  191. package/dist/surface/Surface.js +480 -57
  192. package/dist/surface/Surface.js.map +1 -0
  193. package/dist/surface/scope.d.ts +32 -0
  194. package/dist/surface/scope.js +23 -0
  195. package/dist/surface/scope.js.map +1 -0
  196. package/dist/surface/values.d.ts +44 -0
  197. package/dist/surface/values.js +237 -0
  198. package/dist/surface/values.js.map +1 -0
  199. package/dist/tint.d.ts +10 -0
  200. package/dist/tint.js +19 -0
  201. package/dist/tint.js.map +1 -0
  202. package/dist/types.d.ts +541 -0
  203. package/dist/types.js +16 -0
  204. package/dist/types.js.map +1 -0
  205. package/dist/useAgentFace.d.ts +18 -0
  206. package/dist/useAgentFace.js +45 -0
  207. package/dist/useAgentFace.js.map +1 -0
  208. package/dist/useCall.d.ts +39 -0
  209. package/dist/useCall.js +273 -0
  210. package/dist/useCall.js.map +1 -0
  211. package/dist/useConversation.d.ts +77 -0
  212. package/dist/useConversation.js +523 -0
  213. package/dist/useConversation.js.map +1 -0
  214. package/dist/useDictation.d.ts +17 -0
  215. package/dist/useDictation.js +68 -0
  216. package/dist/useDictation.js.map +1 -0
  217. package/dist/useLive.d.ts +26 -0
  218. package/dist/useLive.js +88 -0
  219. package/dist/useLive.js.map +1 -0
  220. package/dist/usePolled.js +68 -0
  221. package/dist/usePolled.js.map +1 -0
  222. package/dist/voice/Orb.d.ts +10 -9
  223. package/dist/voice/Orb.js +43 -39
  224. package/dist/voice/Orb.js.map +1 -0
  225. package/dist/voice/StillOrb.js +33 -0
  226. package/dist/voice/StillOrb.js.map +1 -0
  227. package/dist/voice/WebGLOrb.js +98 -0
  228. package/dist/voice/WebGLOrb.js.map +1 -0
  229. package/dist/voice/fluidDots.js +161 -0
  230. package/dist/voice/fluidDots.js.map +1 -0
  231. package/dist/voice/motion.js +84 -0
  232. package/dist/voice/motion.js.map +1 -0
  233. package/dist/voice/orbs.d.ts +32 -0
  234. package/dist/voice/orbs.js +16 -0
  235. package/dist/voice/orbs.js.map +1 -0
  236. package/dist/voice/useReducedMotion.js +16 -16
  237. package/dist/voice/useReducedMotion.js.map +1 -0
  238. package/dist/voice/wave.js +116 -0
  239. package/dist/voice/wave.js.map +1 -0
  240. package/dist/voice/webgl.js +177 -0
  241. package/dist/voice/webgl.js.map +1 -0
  242. package/dist/widget.js +284 -8
  243. package/package.json +49 -39
  244. package/src/AgentAbout.tsx +1621 -0
  245. package/src/AgentCard.tsx +123 -0
  246. package/src/AgentChat.tsx +1812 -0
  247. package/src/AgentSpace.tsx +540 -0
  248. package/src/AgentTasks.tsx +163 -0
  249. package/src/BrowserView.tsx +442 -0
  250. package/src/FileView.tsx +620 -0
  251. package/src/Modes.tsx +112 -0
  252. package/src/VoiceCall.tsx +411 -0
  253. package/src/about.ts +355 -0
  254. package/src/agentIcons.ts +56 -0
  255. package/src/automation/Automation.tsx +308 -0
  256. package/src/automation/RunView.tsx +213 -0
  257. package/src/automation/cron.ts +196 -0
  258. package/src/automation/marks.tsx +144 -0
  259. package/src/automation/messages.ts +231 -0
  260. package/src/automation/record.ts +206 -0
  261. package/src/automation/types.ts +146 -0
  262. package/src/automation/when.ts +195 -0
  263. package/src/blocks.ts +249 -0
  264. package/src/browser.ts +334 -0
  265. package/src/call.ts +300 -0
  266. package/src/channelParts.ts +17 -0
  267. package/src/classes.ts +10 -0
  268. package/src/client.ts +397 -0
  269. package/src/conversationFiles.ts +54 -0
  270. package/src/credentials.ts +158 -0
  271. package/src/dev.ts +20 -0
  272. package/src/es.ts +423 -0
  273. package/src/files.ts +238 -0
  274. package/src/frames.ts +291 -0
  275. package/src/icons.tsx +49 -0
  276. package/src/index.ts +271 -0
  277. package/src/kit/AudioPlayer.tsx +129 -0
  278. package/src/kit/Button.tsx +97 -0
  279. package/src/kit/Card.tsx +47 -0
  280. package/src/kit/Chart.tsx +129 -0
  281. package/src/kit/Choices.tsx +131 -0
  282. package/src/kit/Combobox.tsx +247 -0
  283. package/src/kit/DateField.tsx +156 -0
  284. package/src/kit/Field.tsx +137 -0
  285. package/src/kit/FileField.tsx +492 -0
  286. package/src/kit/FileMark.tsx +56 -0
  287. package/src/kit/Inputs.tsx +250 -0
  288. package/src/kit/List.tsx +135 -0
  289. package/src/kit/Mark.tsx +64 -0
  290. package/src/kit/MarkStack.tsx +29 -0
  291. package/src/kit/Note.tsx +42 -0
  292. package/src/kit/Popover.tsx +121 -0
  293. package/src/kit/RangeField.tsx +53 -0
  294. package/src/kit/RatingField.tsx +62 -0
  295. package/src/kit/Stat.tsx +60 -0
  296. package/src/kit/Switch.tsx +28 -0
  297. package/src/kit/Tag.tsx +32 -0
  298. package/src/kit/Tile.tsx +74 -0
  299. package/src/kit/TimeField.tsx +157 -0
  300. package/src/kit/context.tsx +246 -0
  301. package/src/kit/dates.ts +150 -0
  302. package/src/kit/messages.ts +160 -0
  303. package/src/kit/numbers.ts +44 -0
  304. package/src/kit/options.ts +30 -0
  305. package/src/kit/uploads.ts +244 -0
  306. package/src/kit/waveform.ts +84 -0
  307. package/src/locale.ts +6 -0
  308. package/src/markdown.ts +69 -0
  309. package/src/marks.tsx +328 -0
  310. package/src/reveal.ts +52 -0
  311. package/src/stepGlyphs.ts +83 -0
  312. package/src/styles.css +6970 -0
  313. package/src/surface/Form.tsx +299 -0
  314. package/src/surface/Markdown.tsx +55 -0
  315. package/src/surface/Surface.tsx +605 -0
  316. package/src/surface/scope.ts +82 -0
  317. package/src/surface/values.ts +361 -0
  318. package/src/tint.ts +14 -0
  319. package/src/types.ts +604 -0
  320. package/src/useAgentFace.ts +47 -0
  321. package/src/useCall.ts +292 -0
  322. package/src/useConversation.ts +627 -0
  323. package/src/useDictation.ts +83 -0
  324. package/src/useLive.ts +115 -0
  325. package/src/usePolled.ts +60 -0
  326. package/src/voice/Orb.tsx +45 -0
  327. package/src/voice/StillOrb.tsx +29 -0
  328. package/src/voice/WebGLOrb.tsx +98 -0
  329. package/src/voice/fluidDots.tsx +171 -0
  330. package/src/voice/motion.ts +112 -0
  331. package/src/voice/orbs.ts +39 -0
  332. package/src/voice/useReducedMotion.ts +24 -0
  333. package/src/voice/wave.tsx +129 -0
  334. package/src/voice/webgl.ts +209 -0
  335. package/src/widget/css.d.ts +5 -0
  336. package/src/widget/element.tsx +535 -0
  337. package/src/widget/index.ts +10 -0
  338. package/src/widget/mount.ts +27 -0
  339. package/src/widget/widget.css +253 -0
  340. package/dist/SignalcoreProvider.d.ts +0 -113
  341. package/dist/SignalcoreProvider.js +0 -84
  342. package/dist/automations/AppMarks.d.ts +0 -11
  343. package/dist/automations/AppMarks.js +0 -18
  344. package/dist/automations/AutomationCard.d.ts +0 -27
  345. package/dist/automations/AutomationCard.js +0 -53
  346. package/dist/automations/AutomationsWindow.d.ts +0 -38
  347. package/dist/automations/AutomationsWindow.js +0 -57
  348. package/dist/automations/Card.d.ts +0 -46
  349. package/dist/automations/Card.js +0 -45
  350. package/dist/automations/ScheduleMarks.d.ts +0 -13
  351. package/dist/automations/ScheduleMarks.js +0 -24
  352. package/dist/automations/presentationIcons.d.ts +0 -7
  353. package/dist/automations/presentationIcons.js +0 -67
  354. package/dist/automations/schedule.d.ts +0 -25
  355. package/dist/automations/schedule.js +0 -59
  356. package/dist/automations/time.d.ts +0 -3
  357. package/dist/automations/time.js +0 -25
  358. package/dist/browser/BrowserView.d.ts +0 -43
  359. package/dist/browser/BrowserView.js +0 -94
  360. package/dist/browser/room.d.ts +0 -21
  361. package/dist/browser/room.js +0 -33
  362. package/dist/browser/useBrowserSession.d.ts +0 -17
  363. package/dist/browser/useBrowserSession.js +0 -67
  364. package/dist/builder/BuilderChat.d.ts +0 -32
  365. package/dist/builder/BuilderChat.js +0 -41
  366. package/dist/builder/BuilderTranscript.d.ts +0 -49
  367. package/dist/builder/BuilderTranscript.js +0 -62
  368. package/dist/builder/StatusLine.d.ts +0 -8
  369. package/dist/builder/StatusLine.js +0 -17
  370. package/dist/builder/answer.d.ts +0 -7
  371. package/dist/builder/answer.js +0 -8
  372. package/dist/builder/blocks.d.ts +0 -31
  373. package/dist/builder/blocks.js +0 -74
  374. package/dist/builder/items.d.ts +0 -15
  375. package/dist/builder/items.js +0 -21
  376. package/dist/builder/steps.d.ts +0 -20
  377. package/dist/builder/steps.js +0 -120
  378. package/dist/builder/time.d.ts +0 -4
  379. package/dist/builder/time.js +0 -24
  380. package/dist/builder/useBuildSession.d.ts +0 -36
  381. package/dist/builder/useBuildSession.js +0 -130
  382. package/dist/builder/workingOn.d.ts +0 -7
  383. package/dist/builder/workingOn.js +0 -15
  384. package/dist/chat/AgentChat.d.ts +0 -37
  385. package/dist/chat/AgentChat.js +0 -21
  386. package/dist/chat/ChatView.d.ts +0 -25
  387. package/dist/chat/ChatView.js +0 -34
  388. package/dist/chat/Composer.d.ts +0 -20
  389. package/dist/chat/Composer.js +0 -22
  390. package/dist/chat/MessageRow.d.ts +0 -22
  391. package/dist/chat/MessageRow.js +0 -32
  392. package/dist/chat/arrival.d.ts +0 -15
  393. package/dist/chat/arrival.js +0 -25
  394. package/dist/chat/history.d.ts +0 -24
  395. package/dist/chat/history.js +0 -45
  396. package/dist/chat/moments.d.ts +0 -25
  397. package/dist/chat/moments.js +0 -72
  398. package/dist/chat/types.d.ts +0 -12
  399. package/dist/chat/types.js +0 -1
  400. package/dist/chat/useComposer.d.ts +0 -46
  401. package/dist/chat/useComposer.js +0 -62
  402. package/dist/chat/useConversation.d.ts +0 -35
  403. package/dist/chat/useConversation.js +0 -71
  404. package/dist/chat/useStickToBottom.d.ts +0 -9
  405. package/dist/chat/useStickToBottom.js +0 -33
  406. package/dist/chat/useTurns.d.ts +0 -49
  407. package/dist/chat/useTurns.js +0 -111
  408. package/dist/classes.d.ts +0 -2
  409. package/dist/development.d.ts +0 -5
  410. package/dist/development.js +0 -8
  411. package/dist/flow/FlowWindow.d.ts +0 -42
  412. package/dist/flow/FlowWindow.js +0 -126
  413. package/dist/flow/index.d.ts +0 -16
  414. package/dist/flow/index.js +0 -16
  415. package/dist/flow/kinds.d.ts +0 -23
  416. package/dist/flow/kinds.js +0 -48
  417. package/dist/flow/map.d.ts +0 -44
  418. package/dist/flow/map.js +0 -225
  419. package/dist/flow/nodePaths.d.ts +0 -7
  420. package/dist/flow/nodePaths.js +0 -17
  421. package/dist/flow/relations.d.ts +0 -42
  422. package/dist/flow/relations.js +0 -174
  423. package/dist/host.d.ts +0 -124
  424. package/dist/host.js +0 -1
  425. package/dist/live/LiveView.d.ts +0 -28
  426. package/dist/live/LiveView.js +0 -55
  427. package/dist/live/capture.d.ts +0 -20
  428. package/dist/live/capture.js +0 -100
  429. package/dist/live/follow.d.ts +0 -26
  430. package/dist/live/follow.js +0 -72
  431. package/dist/live/paint.d.ts +0 -13
  432. package/dist/live/paint.js +0 -77
  433. package/dist/live/useLiveStream.d.ts +0 -16
  434. package/dist/live/useLiveStream.js +0 -57
  435. package/dist/look.d.ts +0 -33
  436. package/dist/look.js +0 -241
  437. package/dist/messages/en.d.ts +0 -3
  438. package/dist/messages/en.js +0 -251
  439. package/dist/messages/es.d.ts +0 -3
  440. package/dist/messages/es.js +0 -251
  441. package/dist/messages/index.d.ts +0 -16
  442. package/dist/messages/index.js +0 -33
  443. package/dist/messages/types.d.ts +0 -246
  444. package/dist/messages/types.js +0 -1
  445. package/dist/parts/Button.d.ts +0 -18
  446. package/dist/parts/Button.js +0 -17
  447. package/dist/parts/Icon.d.ts +0 -39
  448. package/dist/parts/Icon.js +0 -37
  449. package/dist/parts/Input.d.ts +0 -6
  450. package/dist/parts/Input.js +0 -11
  451. package/dist/parts/Spinner.d.ts +0 -2
  452. package/dist/parts/Spinner.js +0 -7
  453. package/dist/patterns.d.ts +0 -15
  454. package/dist/patterns.js +0 -5
  455. package/dist/presets.d.ts +0 -82
  456. package/dist/presets.js +0 -81
  457. package/dist/primitives.d.ts +0 -22
  458. package/dist/primitives.js +0 -58
  459. package/dist/request/RequestCard.d.ts +0 -34
  460. package/dist/request/RequestCard.js +0 -101
  461. package/dist/request/approval/ApprovalPreview.d.ts +0 -5
  462. package/dist/request/approval/ApprovalPreview.js +0 -27
  463. package/dist/request/approval/shapes.d.ts +0 -32
  464. package/dist/request/approval/shapes.js +0 -68
  465. package/dist/request/apps.d.ts +0 -11
  466. package/dist/request/apps.js +0 -27
  467. package/dist/request/cards.d.ts +0 -12
  468. package/dist/request/cards.js +0 -24
  469. package/dist/request/deliver.d.ts +0 -12
  470. package/dist/request/deliver.js +0 -21
  471. package/dist/request/handOver.d.ts +0 -18
  472. package/dist/request/handOver.js +0 -33
  473. package/dist/request/kinds/Approval.d.ts +0 -3
  474. package/dist/request/kinds/Approval.js +0 -9
  475. package/dist/request/kinds/Choice.d.ts +0 -3
  476. package/dist/request/kinds/Choice.js +0 -8
  477. package/dist/request/kinds/Connect.d.ts +0 -9
  478. package/dist/request/kinds/Connect.js +0 -119
  479. package/dist/request/kinds/FreeText.d.ts +0 -3
  480. package/dist/request/kinds/FreeText.js +0 -20
  481. package/dist/request/kinds/HandOver.d.ts +0 -13
  482. package/dist/request/kinds/HandOver.js +0 -20
  483. package/dist/request/kinds/Secret.d.ts +0 -7
  484. package/dist/request/kinds/Secret.js +0 -49
  485. package/dist/request/kinds/Upload.d.ts +0 -6
  486. package/dist/request/kinds/Upload.js +0 -47
  487. package/dist/request/types.d.ts +0 -83
  488. package/dist/request/types.js +0 -1
  489. package/dist/safeUrl.d.ts +0 -6
  490. package/dist/safeUrl.js +0 -8
  491. package/dist/stream/builder.d.ts +0 -176
  492. package/dist/stream/builder.js +0 -202
  493. package/dist/stream/reduce.d.ts +0 -51
  494. package/dist/stream/reduce.js +0 -58
  495. package/dist/stream/untilAborted.d.ts +0 -7
  496. package/dist/stream/untilAborted.js +0 -32
  497. package/dist/stream/useRunStream.d.ts +0 -26
  498. package/dist/stream/useRunStream.js +0 -137
  499. package/dist/styles.css +0 -2318
  500. package/dist/surface/HostNode.d.ts +0 -14
  501. package/dist/surface/HostNode.js +0 -30
  502. package/dist/surface/Node.d.ts +0 -7
  503. package/dist/surface/Node.js +0 -49
  504. package/dist/surface/SurfaceBoundary.d.ts +0 -26
  505. package/dist/surface/SurfaceBoundary.js +0 -20
  506. package/dist/surface/bindings.d.ts +0 -14
  507. package/dist/surface/bindings.js +0 -37
  508. package/dist/surface/check.d.ts +0 -27
  509. package/dist/surface/check.js +0 -102
  510. package/dist/surface/format.d.ts +0 -10
  511. package/dist/surface/format.js +0 -32
  512. package/dist/surface/hosts.d.ts +0 -6
  513. package/dist/surface/hosts.js +0 -11
  514. package/dist/surface/scene.d.ts +0 -21
  515. package/dist/surface/scene.js +0 -8
  516. package/dist/surface/templates/Browser.d.ts +0 -6
  517. package/dist/surface/templates/Browser.js +0 -11
  518. package/dist/surface/templates/Chart.d.ts +0 -6
  519. package/dist/surface/templates/Chart.js +0 -13
  520. package/dist/surface/templates/Choices.d.ts +0 -3
  521. package/dist/surface/templates/Choices.js +0 -12
  522. package/dist/surface/templates/Form.d.ts +0 -3
  523. package/dist/surface/templates/Form.js +0 -44
  524. package/dist/surface/templates/KeyValue.d.ts +0 -3
  525. package/dist/surface/templates/KeyValue.js +0 -7
  526. package/dist/surface/templates/Layout.d.ts +0 -5
  527. package/dist/surface/templates/Layout.js +0 -16
  528. package/dist/surface/templates/Live.d.ts +0 -6
  529. package/dist/surface/templates/Live.js +0 -9
  530. package/dist/surface/templates/Media.d.ts +0 -5
  531. package/dist/surface/templates/Media.js +0 -13
  532. package/dist/surface/templates/Slots.d.ts +0 -3
  533. package/dist/surface/templates/Slots.js +0 -19
  534. package/dist/surface/templates/Table.d.ts +0 -3
  535. package/dist/surface/templates/Table.js +0 -12
  536. package/dist/surface/templates/Text.d.ts +0 -4
  537. package/dist/surface/templates/Text.js +0 -15
  538. package/dist/surface/templates/index.d.ts +0 -7
  539. package/dist/surface/templates/index.js +0 -32
  540. package/dist/surface/types.d.ts +0 -68
  541. package/dist/surface/types.js +0 -6
  542. package/dist/theme.d.ts +0 -62
  543. package/dist/theme.js +0 -9
  544. package/dist/useTokens.d.ts +0 -7
  545. package/dist/useTokens.js +0 -41
  546. package/dist/voice/VoiceWindow.d.ts +0 -18
  547. package/dist/voice/VoiceWindow.js +0 -35
  548. package/dist/voice/index.d.ts +0 -13
  549. package/dist/voice/index.js +0 -12
  550. package/dist/voice/meter.d.ts +0 -16
  551. package/dist/voice/meter.js +0 -52
  552. package/dist/voice/orbColors.d.ts +0 -16
  553. package/dist/voice/orbColors.js +0 -75
  554. package/dist/voice/pushable.d.ts +0 -16
  555. package/dist/voice/pushable.js +0 -56
  556. package/dist/voice/useDictation.d.ts +0 -24
  557. package/dist/voice/useDictation.js +0 -60
  558. package/dist/voice/useReducedMotion.d.ts +0 -5
  559. package/dist/voice/useVoice.d.ts +0 -70
  560. package/dist/voice/useVoice.js +0 -197
  561. package/dist/voice/useVoicePrimitives.d.ts +0 -7
  562. package/dist/voice/useVoicePrimitives.js +0 -11
  563. package/dist/voice/voice.d.ts +0 -55
  564. package/dist/voice/voice.js +0 -9
  565. package/dist/voice/webSpeech.d.ts +0 -33
  566. package/dist/voice/webSpeech.js +0 -258
  567. package/dist/widget.js.map +0 -1
  568. package/dist/windows/AgentSpace.d.ts +0 -78
  569. package/dist/windows/AgentSpace.js +0 -135
  570. package/dist/windows/Captions.d.ts +0 -13
  571. package/dist/windows/Captions.js +0 -22
  572. package/dist/windows/Dock.d.ts +0 -37
  573. package/dist/windows/Dock.js +0 -22
  574. package/dist/windows/Journal.d.ts +0 -15
  575. package/dist/windows/Journal.js +0 -19
  576. package/dist/windows/KindMark.d.ts +0 -7
  577. package/dist/windows/KindMark.js +0 -31
  578. package/dist/windows/Pending.d.ts +0 -8
  579. package/dist/windows/Pending.js +0 -17
  580. package/dist/windows/Stage.d.ts +0 -18
  581. package/dist/windows/Stage.js +0 -21
  582. package/dist/windows/StatusLabel.d.ts +0 -9
  583. package/dist/windows/StatusLabel.js +0 -7
  584. package/dist/windows/Strip.d.ts +0 -17
  585. package/dist/windows/Strip.js +0 -42
  586. package/dist/windows/SurfaceWindow.d.ts +0 -20
  587. package/dist/windows/SurfaceWindow.js +0 -12
  588. package/dist/windows/WindowFrame.d.ts +0 -23
  589. package/dist/windows/WindowFrame.js +0 -22
  590. package/dist/windows/hearing.d.ts +0 -11
  591. package/dist/windows/hearing.js +0 -26
  592. package/dist/windows/kinds.d.ts +0 -47
  593. package/dist/windows/kinds.js +0 -28
  594. package/dist/windows/reduce.d.ts +0 -98
  595. package/dist/windows/reduce.js +0 -151
  596. package/dist/windows/registry.d.ts +0 -18
  597. package/dist/windows/registry.js +0 -61
  598. package/dist/windows/reveal.d.ts +0 -9
  599. package/dist/windows/reveal.js +0 -6
  600. package/dist/windows/space.d.ts +0 -21
  601. package/dist/windows/space.js +0 -6
  602. package/dist/windows/status.d.ts +0 -11
  603. package/dist/windows/status.js +0 -30
  604. package/dist/windows/types.d.ts +0 -15
  605. package/dist/windows/types.js +0 -1
  606. package/dist/windows/useLoaded.d.ts +0 -44
  607. package/dist/windows/useLoaded.js +0 -58
  608. package/dist/windows/useUnread.d.ts +0 -7
  609. package/dist/windows/useUnread.js +0 -21
  610. package/dist/windows/useWindows.d.ts +0 -70
  611. package/dist/windows/useWindows.js +0 -60
package/dist/files.js ADDED
@@ -0,0 +1,214 @@
1
+ //#region src/files.ts
2
+ const BY_EXTENSION = {
3
+ md: "markdown",
4
+ markdown: "markdown",
5
+ txt: "text",
6
+ log: "text",
7
+ json: "code",
8
+ yaml: "code",
9
+ yml: "code",
10
+ xml: "code",
11
+ html: "code",
12
+ htm: "code",
13
+ css: "code",
14
+ js: "code",
15
+ ts: "code",
16
+ py: "code",
17
+ sql: "code",
18
+ toml: "code",
19
+ ini: "code",
20
+ csv: "table",
21
+ tsv: "table",
22
+ pdf: "pdf",
23
+ png: "image",
24
+ jpg: "image",
25
+ jpeg: "image",
26
+ gif: "image",
27
+ webp: "image",
28
+ avif: "image",
29
+ bmp: "image",
30
+ svg: "image"
31
+ };
32
+ /** The type a browser needs to draw a PDF or a picture, by extension. */
33
+ const MEDIA = {
34
+ pdf: "application/pdf",
35
+ png: "image/png",
36
+ jpg: "image/jpeg",
37
+ jpeg: "image/jpeg",
38
+ gif: "image/gif",
39
+ webp: "image/webp",
40
+ avif: "image/avif",
41
+ bmp: "image/bmp",
42
+ svg: "image/svg+xml"
43
+ };
44
+ /** A name's extension, lowercase; "" for one without (`README`, `.env`). */
45
+ function extensionOf(name) {
46
+ const base = baseName(name);
47
+ const dot = base.lastIndexOf(".");
48
+ return dot <= 0 ? "" : base.slice(dot + 1).toLowerCase();
49
+ }
50
+ /** The last name of a path: what a file is saved as. */
51
+ const baseName = (path) => path.slice(path.lastIndexOf("/") + 1);
52
+ function byType(type) {
53
+ const media = type.split(";")[0]?.trim().toLowerCase() ?? "";
54
+ if (media === "text/markdown") return "markdown";
55
+ if (media === "text/csv" || media === "text/tab-separated-values") return "table";
56
+ if (media === "text/html" || /^application\/(json|xml|x-yaml|yaml)$/.test(media)) return "code";
57
+ if (media.startsWith("text/")) return "text";
58
+ if (media === "application/pdf") return "pdf";
59
+ if (Object.values(MEDIA).includes(media)) return "image";
60
+ return "none";
61
+ }
62
+ /** How a file of this name and type is shown. */
63
+ function previewOf(name, type) {
64
+ return BY_EXTENSION[extensionOf(name)] ?? byType(type);
65
+ }
66
+ /**
67
+ * The bytes typed as a browser must have them to draw them (a PDF, a picture), whatever type
68
+ * they came with: one uploaded without a type is kept as plain bytes.
69
+ */
70
+ function typedFor(blob, name) {
71
+ const type = MEDIA[extensionOf(name)];
72
+ return type === void 0 || blob.type === type ? blob : new Blob([blob], { type });
73
+ }
74
+ /** JSON laid out two spaces deep; anything that is not JSON as it was. */
75
+ function pretty(text) {
76
+ try {
77
+ return JSON.stringify(JSON.parse(text), null, 2);
78
+ } catch {
79
+ return text;
80
+ }
81
+ }
82
+ const SEPARATORS = [
83
+ ",",
84
+ ";",
85
+ " "
86
+ ];
87
+ /**
88
+ * A CSV (or TSV) as rows of cells, when it is simple enough to draw as a table: one separator,
89
+ * the commonest of comma, semicolon and tab on the first line; quoted cells kept whole (quotes
90
+ * doubled inside, line breaks too); every row as wide as the first, and that at least two. Null
91
+ * otherwise, and it is shown as written.
92
+ */
93
+ function tableOf(text) {
94
+ const body = text.replace(/^/, "").replace(/\r\n?/g, "\n").replace(/\n+$/, "");
95
+ const first = body.split("\n", 1)[0] ?? "";
96
+ const separator = SEPARATORS.reduce((best, each) => first.split(each).length > first.split(best).length ? each : best);
97
+ if (!first.includes(separator)) return null;
98
+ const rows = cellsOf(body, separator);
99
+ const width = rows[0]?.length ?? 0;
100
+ return width >= 2 && rows.every((row) => row.length === width) ? rows : null;
101
+ }
102
+ function cellsOf(text, separator) {
103
+ const rows = [];
104
+ let row = [];
105
+ let cell = "";
106
+ let quoted = false;
107
+ for (let at = 0; at < text.length; at += 1) {
108
+ const char = text.charAt(at);
109
+ if (quoted) {
110
+ if (char !== "\"") cell += char;
111
+ else if (text.charAt(at + 1) === "\"") {
112
+ cell += "\"";
113
+ at += 1;
114
+ } else quoted = false;
115
+ } else if (char === "\"" && cell === "") quoted = true;
116
+ else if (char === separator || char === "\n") {
117
+ row.push(cell);
118
+ cell = "";
119
+ if (char === "\n") {
120
+ rows.push(row);
121
+ row = [];
122
+ }
123
+ } else cell += char;
124
+ }
125
+ row.push(cell);
126
+ rows.push(row);
127
+ return rows;
128
+ }
129
+ /** The tags a Word file's HTML keeps, as the API keeps them (`preview.TAGS`). */
130
+ const DOCUMENT_TAGS = /* @__PURE__ */ new Set([
131
+ "h1",
132
+ "h2",
133
+ "h3",
134
+ "h4",
135
+ "h5",
136
+ "h6",
137
+ "p",
138
+ "br",
139
+ "hr",
140
+ "blockquote",
141
+ "pre",
142
+ "code",
143
+ "ul",
144
+ "ol",
145
+ "li",
146
+ "table",
147
+ "thead",
148
+ "tbody",
149
+ "tr",
150
+ "th",
151
+ "td",
152
+ "strong",
153
+ "b",
154
+ "em",
155
+ "i",
156
+ "u",
157
+ "s",
158
+ "sub",
159
+ "sup",
160
+ "img"
161
+ ]);
162
+ /** What goes with everything it holds; any other tag not kept goes and leaves its words. */
163
+ const DROPPED = /* @__PURE__ */ new Set([
164
+ "script",
165
+ "style",
166
+ "template",
167
+ "iframe",
168
+ "object",
169
+ "embed",
170
+ "noscript",
171
+ "svg",
172
+ "math",
173
+ "link",
174
+ "meta",
175
+ "title"
176
+ ]);
177
+ /** A picture inline, as the only address a document may hold. */
178
+ const PICTURE = /^data:image\/(?:png|jpe?g|gif|webp|bmp);base64,/i;
179
+ /** Whether an element keeps an attribute: a picture its data address and words, a cell its span. */
180
+ function keeps(tag, name, value) {
181
+ if (tag === "img") return name === "alt" || name === "src" && PICTURE.test(value);
182
+ return (tag === "td" || tag === "th") && (name === "colspan" || name === "rowspan");
183
+ }
184
+ /**
185
+ * A Word file's HTML (a `document` preview) kept again, here, to what a viewer draws: the API
186
+ * cleans it, and what the page puts in itself it checks itself. Its tags and attributes the
187
+ * API's allow-list, scripts and styles gone with what they hold, any other tag gone and its words
188
+ * kept, a picture only by a data address.
189
+ */
190
+ function cleanDocument(html) {
191
+ const body = new DOMParser().parseFromString(html, "text/html").body;
192
+ const clean = (parent) => {
193
+ for (const child of [...parent.children]) {
194
+ const tag = child.tagName.toLowerCase();
195
+ if (DROPPED.has(tag)) {
196
+ child.remove();
197
+ continue;
198
+ }
199
+ clean(child);
200
+ if (!DOCUMENT_TAGS.has(tag)) {
201
+ child.replaceWith(...child.childNodes);
202
+ continue;
203
+ }
204
+ for (const { name, value } of [...child.attributes]) if (!keeps(tag, name.toLowerCase(), value)) child.removeAttribute(name);
205
+ if (tag === "img" && !child.hasAttribute("src")) child.remove();
206
+ }
207
+ };
208
+ clean(body);
209
+ return body.innerHTML;
210
+ }
211
+ //#endregion
212
+ export { baseName, cleanDocument, extensionOf, pretty, previewOf, tableOf, typedFor };
213
+
214
+ //# sourceMappingURL=files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.js","names":[],"sources":["../src/files.ts"],"sourcesContent":["/**\n * How a file is shown before it is saved, read from its name first (the owner named it, and a\n * browser often gives no type) and from its type when the name says nothing.\n */\n\n/**\n * Words with headings (Markdown), plain words, a source read in the mono face (JSON, YAML, a\n * page's HTML: shown as written, never run), rows of cells (CSV), a PDF, a picture, or nothing.\n */\nexport type Preview = \"markdown\" | \"text\" | \"code\" | \"table\" | \"pdf\" | \"image\" | \"none\";\n\nconst BY_EXTENSION: Readonly<Record<string, Preview>> = {\n md: \"markdown\",\n markdown: \"markdown\",\n txt: \"text\",\n log: \"text\",\n json: \"code\",\n yaml: \"code\",\n yml: \"code\",\n xml: \"code\",\n html: \"code\",\n htm: \"code\",\n css: \"code\",\n js: \"code\",\n ts: \"code\",\n py: \"code\",\n sql: \"code\",\n toml: \"code\",\n ini: \"code\",\n csv: \"table\",\n tsv: \"table\",\n pdf: \"pdf\",\n png: \"image\",\n jpg: \"image\",\n jpeg: \"image\",\n gif: \"image\",\n webp: \"image\",\n avif: \"image\",\n bmp: \"image\",\n svg: \"image\",\n};\n\n/** The type a browser needs to draw a PDF or a picture, by extension. */\nconst MEDIA: Readonly<Record<string, string>> = {\n pdf: \"application/pdf\",\n png: \"image/png\",\n jpg: \"image/jpeg\",\n jpeg: \"image/jpeg\",\n gif: \"image/gif\",\n webp: \"image/webp\",\n avif: \"image/avif\",\n bmp: \"image/bmp\",\n svg: \"image/svg+xml\",\n};\n\n/** A name's extension, lowercase; \"\" for one without (`README`, `.env`). */\nexport function extensionOf(name: string): string {\n const base = baseName(name);\n const dot = base.lastIndexOf(\".\");\n return dot <= 0 ? \"\" : base.slice(dot + 1).toLowerCase();\n}\n\n/** The last name of a path: what a file is saved as. */\nexport const baseName = (path: string): string => path.slice(path.lastIndexOf(\"/\") + 1);\n\nfunction byType(type: string): Preview {\n const media = type.split(\";\")[0]?.trim().toLowerCase() ?? \"\";\n if (media === \"text/markdown\") return \"markdown\";\n if (media === \"text/csv\" || media === \"text/tab-separated-values\") return \"table\";\n if (media === \"text/html\" || /^application\\/(json|xml|x-yaml|yaml)$/.test(media)) return \"code\";\n if (media.startsWith(\"text/\")) return \"text\";\n if (media === \"application/pdf\") return \"pdf\";\n if (Object.values(MEDIA).includes(media)) return \"image\";\n return \"none\";\n}\n\n/** How a file of this name and type is shown. */\nexport function previewOf(name: string, type: string): Preview {\n return BY_EXTENSION[extensionOf(name)] ?? byType(type);\n}\n\n/**\n * The bytes typed as a browser must have them to draw them (a PDF, a picture), whatever type\n * they came with: one uploaded without a type is kept as plain bytes.\n */\nexport function typedFor(blob: Blob, name: string): Blob {\n const type = MEDIA[extensionOf(name)];\n return type === undefined || blob.type === type ? blob : new Blob([blob], { type });\n}\n\n/** JSON laid out two spaces deep; anything that is not JSON as it was. */\nexport function pretty(text: string): string {\n try {\n return JSON.stringify(JSON.parse(text), null, 2);\n } catch {\n return text;\n }\n}\n\nconst SEPARATORS = [\",\", \";\", \"\\t\"] as const;\n\n/**\n * A CSV (or TSV) as rows of cells, when it is simple enough to draw as a table: one separator,\n * the commonest of comma, semicolon and tab on the first line; quoted cells kept whole (quotes\n * doubled inside, line breaks too); every row as wide as the first, and that at least two. Null\n * otherwise, and it is shown as written.\n */\nexport function tableOf(text: string): string[][] | null {\n const body = text.replace(/^/, \"\").replace(/\\r\\n?/g, \"\\n\").replace(/\\n+$/, \"\");\n const first = body.split(\"\\n\", 1)[0] ?? \"\";\n const separator = SEPARATORS.reduce((best, each) =>\n first.split(each).length > first.split(best).length ? each : best,\n );\n if (!first.includes(separator)) return null;\n const rows = cellsOf(body, separator);\n const width = rows[0]?.length ?? 0;\n return width >= 2 && rows.every((row) => row.length === width) ? rows : null;\n}\n\nfunction cellsOf(text: string, separator: string): string[][] {\n const rows: string[][] = [];\n let row: string[] = [];\n let cell = \"\";\n let quoted = false;\n for (let at = 0; at < text.length; at += 1) {\n const char = text.charAt(at);\n if (quoted) {\n if (char !== '\"') cell += char;\n else if (text.charAt(at + 1) === '\"') {\n cell += '\"';\n at += 1;\n } else quoted = false;\n } else if (char === '\"' && cell === \"\") {\n quoted = true;\n } else if (char === separator || char === \"\\n\") {\n row.push(cell);\n cell = \"\";\n if (char === \"\\n\") {\n rows.push(row);\n row = [];\n }\n } else {\n cell += char;\n }\n }\n row.push(cell);\n rows.push(row);\n return rows;\n}\n\n/** The tags a Word file's HTML keeps, as the API keeps them (`preview.TAGS`). */\nconst DOCUMENT_TAGS: ReadonlySet<string> = new Set([\n \"h1\",\n \"h2\",\n \"h3\",\n \"h4\",\n \"h5\",\n \"h6\",\n \"p\",\n \"br\",\n \"hr\",\n \"blockquote\",\n \"pre\",\n \"code\",\n \"ul\",\n \"ol\",\n \"li\",\n \"table\",\n \"thead\",\n \"tbody\",\n \"tr\",\n \"th\",\n \"td\",\n \"strong\",\n \"b\",\n \"em\",\n \"i\",\n \"u\",\n \"s\",\n \"sub\",\n \"sup\",\n \"img\",\n]);\n\n/** What goes with everything it holds; any other tag not kept goes and leaves its words. */\nconst DROPPED: ReadonlySet<string> = new Set([\n \"script\",\n \"style\",\n \"template\",\n \"iframe\",\n \"object\",\n \"embed\",\n \"noscript\",\n \"svg\",\n \"math\",\n \"link\",\n \"meta\",\n \"title\",\n]);\n\n/** A picture inline, as the only address a document may hold. */\nconst PICTURE = /^data:image\\/(?:png|jpe?g|gif|webp|bmp);base64,/i;\n\n/** Whether an element keeps an attribute: a picture its data address and words, a cell its span. */\nfunction keeps(tag: string, name: string, value: string): boolean {\n if (tag === \"img\") return name === \"alt\" || (name === \"src\" && PICTURE.test(value));\n return (tag === \"td\" || tag === \"th\") && (name === \"colspan\" || name === \"rowspan\");\n}\n\n/**\n * A Word file's HTML (a `document` preview) kept again, here, to what a viewer draws: the API\n * cleans it, and what the page puts in itself it checks itself. Its tags and attributes the\n * API's allow-list, scripts and styles gone with what they hold, any other tag gone and its words\n * kept, a picture only by a data address.\n */\nexport function cleanDocument(html: string): string {\n const body = new DOMParser().parseFromString(html, \"text/html\").body;\n const clean = (parent: Element) => {\n for (const child of [...parent.children]) {\n const tag = child.tagName.toLowerCase();\n if (DROPPED.has(tag)) {\n child.remove();\n continue;\n }\n clean(child);\n if (!DOCUMENT_TAGS.has(tag)) {\n child.replaceWith(...child.childNodes);\n continue;\n }\n for (const { name, value } of [...child.attributes]) {\n if (!keeps(tag, name.toLowerCase(), value)) child.removeAttribute(name);\n }\n if (tag === \"img\" && !child.hasAttribute(\"src\")) child.remove();\n }\n };\n clean(body);\n return body.innerHTML;\n}\n"],"mappings":";AAWA,MAAM,eAAkD;CACtD,IAAI;CACJ,UAAU;CACV,KAAK;CACL,KAAK;CACL,MAAM;CACN,MAAM;CACN,KAAK;CACL,KAAK;CACL,MAAM;CACN,KAAK;CACL,KAAK;CACL,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,KAAK;CACL,MAAM;CACN,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,KAAK;CACL,MAAM;CACN,KAAK;CACL,MAAM;CACN,MAAM;CACN,KAAK;CACL,KAAK;AACP;;AAGA,MAAM,QAA0C;CAC9C,KAAK;CACL,KAAK;CACL,KAAK;CACL,MAAM;CACN,KAAK;CACL,MAAM;CACN,MAAM;CACN,KAAK;CACL,KAAK;AACP;;AAGA,SAAgB,YAAY,MAAsB;CAChD,MAAM,OAAO,SAAS,IAAI;CAC1B,MAAM,MAAM,KAAK,YAAY,GAAG;CAChC,OAAO,OAAO,IAAI,KAAK,KAAK,MAAM,MAAM,CAAC,CAAC,CAAC,YAAY;AACzD;;AAGA,MAAa,YAAY,SAAyB,KAAK,MAAM,KAAK,YAAY,GAAG,IAAI,CAAC;AAEtF,SAAS,OAAO,MAAuB;CACrC,MAAM,QAAQ,KAAK,MAA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AAC3E;;;;;;;AAQA,SAAgB,cAAc,MAAsB;CAClD,MAAM,OAAO,IAAI,UAAU,CAAC,CAAC,gBAAgB,MAAM,WAAW,CAAC,CAAC;CAChE,MAAM,SAAS,WAAoB;EACjC,KAAK,MAAM,SAAS,CAAC,GAAG,OAAO,QAAQ,GAAG;GACxC,MAAM,MAAM,MAAM,QAAQ,YAAY;GACtC,IAAI,QAAQ,IAAI,GAAG,GAAG;IACpB,MAAM,OAAO;IACb;GACF;GACA,MAAM,KAAK;GACX,IAAI,CAAC,cAAc,IAAI,GAAG,GAAG;IAC3B,MAAM,YAAY,GAAG,MAAM,UAAU;IACrC;GACF;GACA,KAAK,MAAM,EAAE,MAAM,WAAW,CAAC,GAAG,MAAM,UAAU,GAChD,IAAI,CAAC,MAAM,KAAK,KAAK,YAAY,GAAG,KAAK,GAAG,MAAM,gBAAgB,IAAI;GAExE,IAAI,QAAQ,SAAS,CAAC,MAAM,aAAa,KAAK,GAAG,MAAM,OAAO;EAChE;CACF;CACA,MAAM,IAAI;CACV,OAAO,KAAK;AACd"}
@@ -0,0 +1,115 @@
1
+ import { Surface } from "./blocks.js";
2
+ import { Action, BrowserControl, BrowserFrame, BrowserInput, BrowserState, Decision, Handover, Holder, Message, Request, StepState, ToolCall } from "./types.js";
3
+ //#region src/frames.d.ts
4
+ /**
5
+ * The frames of a conversation's socket, as v3/README.md documents them. Down: a message stored;
6
+ * a piece of the reply as it streams; a surface the agent shows (`awaits`: the turn stops until
7
+ * the person acts on it); an action running, told again as its state moves; an action that needs
8
+ * a yes, the person's (the turn stopped) or the business's (`decides`: the turn went on); the
9
+ * conversation handed to a person, and why (the agent stays quiet in it
10
+ * until it is released); the turn over, or stopped by the person; or what went wrong (`code` for
11
+ * the app to word, `detail` for a log). A socket that opens mid-turn is first told the turn so
12
+ * far, from the person's message on. Who answers the conversation, after any change of it (`holder`:
13
+ * who now, and the change); and what was decided of a person's message, when it is stored,
14
+ * settles or is cleared (`decision`, null then). And the conversation's browser: its state, whole, whenever it changes
15
+ * (told at once to a socket that opens), and its screen as it paints. And one of the host's own
16
+ * tools the agent called, for the page to run (`tool`): its step works meanwhile, the turn waits
17
+ * for its `tool_result`, and a person's socket that opens while it waits is told it again.
18
+ */
19
+ export type Frame = {
20
+ type: "working";
21
+ } | {
22
+ type: "message";
23
+ message: Message;
24
+ } | {
25
+ type: "text";
26
+ delta: string;
27
+ } | {
28
+ type: "ui";
29
+ id: string;
30
+ surface: Surface;
31
+ awaits: boolean;
32
+ } | {
33
+ type: "step";
34
+ id: string;
35
+ state: StepState;
36
+ action?: string;
37
+ output?: string;
38
+ } | ({
39
+ type: "request";
40
+ id: string;
41
+ } & Request) | ({
42
+ type: "tool";
43
+ } & ToolCall) | {
44
+ type: "handoff";
45
+ reason: string;
46
+ } | {
47
+ type: "holder";
48
+ handled_by: Holder;
49
+ handover: Handover;
50
+ } | {
51
+ type: "decision";
52
+ message_id: string;
53
+ decision: Decision | null;
54
+ } | {
55
+ type: "done";
56
+ } | {
57
+ type: "stopped";
58
+ } | {
59
+ type: "error";
60
+ code: string;
61
+ detail: string;
62
+ } | ({
63
+ type: "browser";
64
+ open: true;
65
+ } & BrowserState) | {
66
+ type: "browser";
67
+ open: false;
68
+ } | ({
69
+ type: "browser.frame";
70
+ } & BrowserFrame);
71
+ /**
72
+ * Up: the person says something (words, files they uploaded to the conversation, or both), acts
73
+ * on a surface, or stops the reply on its way; takes the browser or gives it back, and acts on it
74
+ * while they hold it. And what a tool of the host's answered, run in the page: its output, or
75
+ * why it failed.
76
+ */
77
+ export type UpFrame = {
78
+ type: "say";
79
+ text: string;
80
+ files?: string[];
81
+ } | ({
82
+ type: "action";
83
+ } & Action) | {
84
+ type: "stop";
85
+ } | {
86
+ type: "browser.control";
87
+ to: BrowserControl;
88
+ } | {
89
+ type: "browser.close";
90
+ } | {
91
+ type: "browser.input";
92
+ event: BrowserInput;
93
+ } | ToolResult;
94
+ /** What a host's tool answered: what it gave back (null for nothing), or why it failed. */
95
+ export type ToolResult = {
96
+ type: "tool_result";
97
+ id: string;
98
+ output: unknown;
99
+ } | {
100
+ type: "tool_result";
101
+ id: string;
102
+ error: string;
103
+ };
104
+ /** The most files one message carries. */
105
+ export declare const FILES_PER_MESSAGE = 10;
106
+ /** The most of a tool's error the API takes: the agent reads the rest of it as cut. */
107
+ export declare const TOOL_ERROR_MAX = 2000;
108
+ /**
109
+ * What a host's tool call answers up, from how its promise settled: what it gave back (`null` for
110
+ * nothing, which JSON would leave out), or the reason it threw in words (an error's message; its
111
+ * kind when it says nothing), as much of it as the API takes.
112
+ */
113
+ export declare function toolResultOf(id: string, settled: PromiseSettledResult<unknown>): ToolResult;
114
+ //#endregion
115
+ //# sourceMappingURL=frames.d.ts.map
package/dist/frames.js ADDED
@@ -0,0 +1,219 @@
1
+ //#region src/frames.ts
2
+ const STATES = /* @__PURE__ */ new Set([
3
+ "running",
4
+ "waiting",
5
+ "done",
6
+ "failed"
7
+ ]);
8
+ const HOLDERS = /* @__PURE__ */ new Set([
9
+ "agent",
10
+ "person",
11
+ "nobody"
12
+ ]);
13
+ const DECISIONS = /* @__PURE__ */ new Set([
14
+ "deciding",
15
+ "answer",
16
+ "skip",
17
+ "hold",
18
+ "ignore"
19
+ ]);
20
+ const isRecord = (value) => typeof value === "object" && value !== null;
21
+ const isState = (value) => typeof value === "string" && STATES.has(value);
22
+ const isSurface = (value) => isRecord(value) && Array.isArray(value.blocks) && typeof value.text === "string";
23
+ const isDecides = (value) => value === "person" || value === "business";
24
+ const isRequest = (value) => isRecord(value) && typeof value.action === "string" && isRecord(value.input) && (value.decides === void 0 || isDecides(value.decides));
25
+ const isStep = (value) => isRecord(value) && typeof value.id === "string" && typeof value.action === "string" && isState(value.state) && (value.output === null || typeof value.output === "string") && (value.surface === null || isSurface(value.surface)) && typeof value.awaits === "boolean" && (value.request === null || isRequest(value.request));
26
+ const isSize = (value) => typeof value.width === "number" && typeof value.height === "number";
27
+ const orNull = (value) => typeof value === "string" ? value : null;
28
+ const isHolder = (value) => typeof value === "string" && HOLDERS.has(value);
29
+ /** A change of who answers as told, or null when it is not one: a reason or title left out is none. */
30
+ function handoverOf(value) {
31
+ if (!isRecord(value) || !isHolder(value.holder)) return null;
32
+ if (typeof value.by !== "string" || typeof value.at !== "string") return null;
33
+ const { holder, by, at } = value;
34
+ return {
35
+ holder,
36
+ reason: orNull(value.reason) ?? "",
37
+ by,
38
+ title: orNull(value.title),
39
+ at
40
+ };
41
+ }
42
+ /** A message's decision as told, or null when it is not one; what it leaves out is none. */
43
+ function decisionOf(value) {
44
+ if (!isRecord(value) || typeof value.kind !== "string" || !DECISIONS.has(value.kind)) return null;
45
+ return {
46
+ kind: value.kind,
47
+ reason: orNull(value.reason),
48
+ automation: orNull(value.automation),
49
+ title: orNull(value.title),
50
+ run_id: orNull(value.run_id)
51
+ };
52
+ }
53
+ /** The browser's state as told, or null when it is not one this package can draw. */
54
+ function browserOf(frame) {
55
+ const { url, title, control } = frame;
56
+ if (typeof url !== "string" || typeof title !== "string" || !isSize(frame)) return null;
57
+ if (control !== "agent" && control !== "person") return null;
58
+ return {
59
+ where: frame.where === "mine" ? "mine" : "hosted",
60
+ url,
61
+ title,
62
+ control,
63
+ reason: orNull(frame.reason),
64
+ wait: orNull(frame.wait),
65
+ width: frame.width,
66
+ height: frame.height
67
+ };
68
+ }
69
+ const isAction = (value) => isRecord(value) && typeof value.surface === "string" && typeof value.name === "string" && isRecord(value.data) && typeof value.label === "string";
70
+ const isAttachment = (value) => isRecord(value) && typeof value.id === "string" && typeof value.name === "string" && typeof value.media_type === "string" && typeof value.size === "number";
71
+ const isMessage = (value) => isRecord(value) && typeof value.id === "string" && (value.role === "user" || value.role === "assistant") && typeof value.text === "string" && (value.action === null || isAction(value.action)) && Array.isArray(value.steps) && value.steps.every(isStep) && (value.files === void 0 || Array.isArray(value.files) && value.files.every(isAttachment)) && typeof value.created_at === "string";
72
+ /** The most files one message carries. */
73
+ const FILES_PER_MESSAGE = 10;
74
+ /**
75
+ * What saying something sends: the words trimmed, and the ids of the files uploaded for it
76
+ * beside them (only when there are); null when there is neither.
77
+ */
78
+ function sayOf(text, files = []) {
79
+ const words = text.trim();
80
+ if (words === "" && files.length === 0) return null;
81
+ return files.length === 0 ? {
82
+ type: "say",
83
+ text: words
84
+ } : {
85
+ type: "say",
86
+ text: words,
87
+ files: [...files]
88
+ };
89
+ }
90
+ /** The most of a tool's error the API takes: the agent reads the rest of it as cut. */
91
+ const TOOL_ERROR_MAX = 2e3;
92
+ /**
93
+ * What a host's tool call answers up, from how its promise settled: what it gave back (`null` for
94
+ * nothing, which JSON would leave out), or the reason it threw in words (an error's message; its
95
+ * kind when it says nothing), as much of it as the API takes.
96
+ */
97
+ function toolResultOf(id, settled) {
98
+ if (settled.status === "fulfilled") return {
99
+ type: "tool_result",
100
+ id,
101
+ output: settled.value ?? null
102
+ };
103
+ const reason = settled.reason;
104
+ return {
105
+ type: "tool_result",
106
+ id,
107
+ error: ((reason instanceof Error ? reason.message : String(reason)).trim() || (reason instanceof Error ? reason.name : "Error")).slice(0, TOOL_ERROR_MAX)
108
+ };
109
+ }
110
+ /**
111
+ * One frame, read without trusting it. Kinds this package does not know yet (more will come:
112
+ * `audio`) and anything malformed are null, to be let pass.
113
+ */
114
+ function frameOf(raw) {
115
+ if (typeof raw !== "string") return null;
116
+ let frame;
117
+ try {
118
+ frame = JSON.parse(raw);
119
+ } catch {
120
+ return null;
121
+ }
122
+ if (!isRecord(frame)) return null;
123
+ const { id, action, output } = frame;
124
+ if (frame.type === "message" && isMessage(frame.message)) return {
125
+ type: "message",
126
+ message: frame.message
127
+ };
128
+ if (frame.type === "text" && typeof frame.delta === "string") return {
129
+ type: "text",
130
+ delta: frame.delta
131
+ };
132
+ if (frame.type === "ui" && typeof id === "string" && isSurface(frame.surface)) return {
133
+ type: "ui",
134
+ id,
135
+ surface: frame.surface,
136
+ awaits: frame.awaits === true
137
+ };
138
+ if (frame.type === "step" && typeof id === "string" && isState(frame.state)) return {
139
+ type: "step",
140
+ id,
141
+ state: frame.state,
142
+ ...typeof action === "string" ? { action } : {},
143
+ ...typeof output === "string" ? { output } : {}
144
+ };
145
+ if (frame.type === "request" && typeof id === "string" && typeof action === "string" && isRecord(frame.input)) {
146
+ const decides = isDecides(frame.decides) ? frame.decides : "person";
147
+ return {
148
+ type: "request",
149
+ id,
150
+ action,
151
+ input: frame.input,
152
+ decides
153
+ };
154
+ }
155
+ if (frame.type === "tool" && typeof id === "string" && typeof frame.name === "string" && isRecord(frame.input)) return {
156
+ type: "tool",
157
+ id,
158
+ name: frame.name,
159
+ input: frame.input
160
+ };
161
+ if (frame.type === "handoff" && typeof frame.reason === "string") return {
162
+ type: "handoff",
163
+ reason: frame.reason
164
+ };
165
+ if (frame.type === "holder" && isHolder(frame.handled_by)) {
166
+ const handover = handoverOf(frame.handover);
167
+ return handover && {
168
+ type: "holder",
169
+ handled_by: frame.handled_by,
170
+ handover
171
+ };
172
+ }
173
+ if (frame.type === "decision" && typeof frame.message_id === "string") {
174
+ const { message_id } = frame;
175
+ if (frame.decision === null) return {
176
+ type: "decision",
177
+ message_id,
178
+ decision: null
179
+ };
180
+ const decision = decisionOf(frame.decision);
181
+ return decision && {
182
+ type: "decision",
183
+ message_id,
184
+ decision
185
+ };
186
+ }
187
+ if (frame.type === "browser") {
188
+ if (frame.open === false) return {
189
+ type: "browser",
190
+ open: false
191
+ };
192
+ const browser = frame.open === true ? browserOf(frame) : null;
193
+ return browser && {
194
+ type: "browser",
195
+ open: true,
196
+ ...browser
197
+ };
198
+ }
199
+ if (frame.type === "browser.frame" && typeof frame.jpeg === "string" && isSize(frame)) {
200
+ const { jpeg, width, height } = frame;
201
+ return {
202
+ type: "browser.frame",
203
+ jpeg,
204
+ width,
205
+ height
206
+ };
207
+ }
208
+ if (frame.type === "working" || frame.type === "done" || frame.type === "stopped") return { type: frame.type };
209
+ if (frame.type === "error" && typeof frame.code === "string" && typeof frame.detail === "string") return {
210
+ type: "error",
211
+ code: frame.code,
212
+ detail: frame.detail
213
+ };
214
+ return null;
215
+ }
216
+ //#endregion
217
+ export { FILES_PER_MESSAGE, TOOL_ERROR_MAX, frameOf, sayOf, toolResultOf };
218
+
219
+ //# sourceMappingURL=frames.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frames.js","names":[],"sources":["../src/frames.ts"],"sourcesContent":["import type { Surface } from \"./blocks\";\nimport type {\n Action,\n Attachment,\n BrowserControl,\n BrowserFrame,\n BrowserInput,\n BrowserState,\n Decides,\n Decision,\n Handover,\n Holder,\n Message,\n Request,\n Step,\n StepState,\n ToolCall,\n} from \"./types\";\n\n/**\n * The frames of a conversation's socket, as v3/README.md documents them. Down: a message stored;\n * a piece of the reply as it streams; a surface the agent shows (`awaits`: the turn stops until\n * the person acts on it); an action running, told again as its state moves; an action that needs\n * a yes, the person's (the turn stopped) or the business's (`decides`: the turn went on); the\n * conversation handed to a person, and why (the agent stays quiet in it\n * until it is released); the turn over, or stopped by the person; or what went wrong (`code` for\n * the app to word, `detail` for a log). A socket that opens mid-turn is first told the turn so\n * far, from the person's message on. Who answers the conversation, after any change of it (`holder`:\n * who now, and the change); and what was decided of a person's message, when it is stored,\n * settles or is cleared (`decision`, null then). And the conversation's browser: its state, whole, whenever it changes\n * (told at once to a socket that opens), and its screen as it paints. And one of the host's own\n * tools the agent called, for the page to run (`tool`): its step works meanwhile, the turn waits\n * for its `tool_result`, and a person's socket that opens while it waits is told it again.\n */\nexport type Frame =\n | { type: \"working\" }\n | { type: \"message\"; message: Message }\n | { type: \"text\"; delta: string }\n | { type: \"ui\"; id: string; surface: Surface; awaits: boolean }\n | { type: \"step\"; id: string; state: StepState; action?: string; output?: string }\n | ({ type: \"request\"; id: string } & Request)\n | ({ type: \"tool\" } & ToolCall)\n | { type: \"handoff\"; reason: string }\n | { type: \"holder\"; handled_by: Holder; handover: Handover }\n | { type: \"decision\"; message_id: string; decision: Decision | null }\n | { type: \"done\" }\n | { type: \"stopped\" }\n | { type: \"error\"; code: string; detail: string }\n | ({ type: \"browser\"; open: true } & BrowserState)\n | { type: \"browser\"; open: false }\n | ({ type: \"browser.frame\" } & BrowserFrame);\n\n/**\n * Up: the person says something (words, files they uploaded to the conversation, or both), acts\n * on a surface, or stops the reply on its way; takes the browser or gives it back, and acts on it\n * while they hold it. And what a tool of the host's answered, run in the page: its output, or\n * why it failed.\n */\nexport type UpFrame =\n | { type: \"say\"; text: string; files?: string[] }\n | ({ type: \"action\" } & Action)\n | { type: \"stop\" }\n | { type: \"browser.control\"; to: BrowserControl }\n | { type: \"browser.close\" }\n | { type: \"browser.input\"; event: BrowserInput }\n | ToolResult;\n\n/** What a host's tool answered: what it gave back (null for nothing), or why it failed. */\nexport type ToolResult =\n | { type: \"tool_result\"; id: string; output: unknown }\n | { type: \"tool_result\"; id: string; error: string };\n\nconst STATES: ReadonlySet<string> = new Set([\"running\", \"waiting\", \"done\", \"failed\"]);\nconst HOLDERS: ReadonlySet<string> = new Set([\"agent\", \"person\", \"nobody\"]);\nconst DECISIONS: ReadonlySet<string> = new Set([\"deciding\", \"answer\", \"skip\", \"hold\", \"ignore\"]);\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n typeof value === \"object\" && value !== null;\n\nconst isState = (value: unknown): value is StepState =>\n typeof value === \"string\" && STATES.has(value);\n\n// The blocks inside are the API's, validated at `show`; the renderer draws what it knows.\nconst isSurface = (value: unknown): value is Surface =>\n isRecord(value) && Array.isArray(value.blocks) && typeof value.text === \"string\";\n\nconst isDecides = (value: unknown): value is Decides => value === \"person\" || value === \"business\";\n\nconst isRequest = (value: unknown): value is Request =>\n isRecord(value) &&\n typeof value.action === \"string\" &&\n isRecord(value.input) &&\n (value.decides === undefined || isDecides(value.decides));\n\nconst isStep = (value: unknown): value is Step =>\n isRecord(value) &&\n typeof value.id === \"string\" &&\n typeof value.action === \"string\" &&\n isState(value.state) &&\n (value.output === null || typeof value.output === \"string\") &&\n (value.surface === null || isSurface(value.surface)) &&\n typeof value.awaits === \"boolean\" &&\n (value.request === null || isRequest(value.request));\n\nconst isSize = (value: Record<string, unknown>): boolean =>\n typeof value.width === \"number\" && typeof value.height === \"number\";\n\nconst orNull = (value: unknown): string | null => (typeof value === \"string\" ? value : null);\n\nconst isHolder = (value: unknown): value is Holder =>\n typeof value === \"string\" && HOLDERS.has(value);\n\n/** A change of who answers as told, or null when it is not one: a reason or title left out is none. */\nfunction handoverOf(value: unknown): Handover | null {\n if (!isRecord(value) || !isHolder(value.holder)) return null;\n if (typeof value.by !== \"string\" || typeof value.at !== \"string\") return null;\n const { holder, by, at } = value;\n return { holder, reason: orNull(value.reason) ?? \"\", by, title: orNull(value.title), at };\n}\n\n/** A message's decision as told, or null when it is not one; what it leaves out is none. */\nfunction decisionOf(value: unknown): Decision | null {\n if (!isRecord(value) || typeof value.kind !== \"string\" || !DECISIONS.has(value.kind)) return null;\n return {\n kind: value.kind as Decision[\"kind\"],\n reason: orNull(value.reason),\n automation: orNull(value.automation),\n title: orNull(value.title),\n run_id: orNull(value.run_id),\n };\n}\n\n/** The browser's state as told, or null when it is not one this package can draw. */\nfunction browserOf(frame: Record<string, unknown>): BrowserState | null {\n const { url, title, control } = frame;\n if (typeof url !== \"string\" || typeof title !== \"string\" || !isSize(frame)) return null;\n if (control !== \"agent\" && control !== \"person\") return null;\n return {\n where: frame.where === \"mine\" ? \"mine\" : \"hosted\",\n url,\n title,\n control,\n reason: orNull(frame.reason),\n wait: orNull(frame.wait),\n width: frame.width as number,\n height: frame.height as number,\n };\n}\n\nconst isAction = (value: unknown): value is Action =>\n isRecord(value) &&\n typeof value.surface === \"string\" &&\n typeof value.name === \"string\" &&\n isRecord(value.data) &&\n typeof value.label === \"string\";\n\nconst isAttachment = (value: unknown): value is Attachment =>\n isRecord(value) &&\n typeof value.id === \"string\" &&\n typeof value.name === \"string\" &&\n typeof value.media_type === \"string\" &&\n typeof value.size === \"number\";\n\nconst isMessage = (value: unknown): value is Message =>\n isRecord(value) &&\n typeof value.id === \"string\" &&\n (value.role === \"user\" || value.role === \"assistant\") &&\n typeof value.text === \"string\" &&\n (value.action === null || isAction(value.action)) &&\n Array.isArray(value.steps) &&\n value.steps.every(isStep) &&\n (value.files === undefined || (Array.isArray(value.files) && value.files.every(isAttachment))) &&\n typeof value.created_at === \"string\";\n\n/** The most files one message carries. */\nexport const FILES_PER_MESSAGE = 10;\n\n/**\n * What saying something sends: the words trimmed, and the ids of the files uploaded for it\n * beside them (only when there are); null when there is neither.\n */\nexport function sayOf(text: string, files: readonly string[] = []): UpFrame | null {\n const words = text.trim();\n if (words === \"\" && files.length === 0) return null;\n return files.length === 0\n ? { type: \"say\", text: words }\n : { type: \"say\", text: words, files: [...files] };\n}\n\n/** The most of a tool's error the API takes: the agent reads the rest of it as cut. */\nexport const TOOL_ERROR_MAX = 2000;\n\n/**\n * What a host's tool call answers up, from how its promise settled: what it gave back (`null` for\n * nothing, which JSON would leave out), or the reason it threw in words (an error's message; its\n * kind when it says nothing), as much of it as the API takes.\n */\nexport function toolResultOf(id: string, settled: PromiseSettledResult<unknown>): ToolResult {\n if (settled.status === \"fulfilled\") {\n return { type: \"tool_result\", id, output: settled.value ?? null };\n }\n const reason: unknown = settled.reason;\n const words = (reason instanceof Error ? reason.message : String(reason)).trim();\n const error = words || (reason instanceof Error ? reason.name : \"Error\");\n return { type: \"tool_result\", id, error: error.slice(0, TOOL_ERROR_MAX) };\n}\n\n/**\n * One frame, read without trusting it. Kinds this package does not know yet (more will come:\n * `audio`) and anything malformed are null, to be let pass.\n */\nexport function frameOf(raw: unknown): Frame | null {\n if (typeof raw !== \"string\") return null;\n let frame: unknown;\n try {\n frame = JSON.parse(raw);\n } catch {\n return null;\n }\n if (!isRecord(frame)) return null;\n const { id, action, output } = frame;\n if (frame.type === \"message\" && isMessage(frame.message)) {\n return { type: \"message\", message: frame.message };\n }\n if (frame.type === \"text\" && typeof frame.delta === \"string\") {\n return { type: \"text\", delta: frame.delta };\n }\n if (frame.type === \"ui\" && typeof id === \"string\" && isSurface(frame.surface)) {\n return { type: \"ui\", id, surface: frame.surface, awaits: frame.awaits === true };\n }\n if (frame.type === \"step\" && typeof id === \"string\" && isState(frame.state)) {\n return {\n type: \"step\",\n id,\n state: frame.state,\n ...(typeof action === \"string\" ? { action } : {}),\n ...(typeof output === \"string\" ? { output } : {}),\n };\n }\n if (\n frame.type === \"request\" &&\n typeof id === \"string\" &&\n typeof action === \"string\" &&\n isRecord(frame.input)\n ) {\n // Left out by an API from before it: the person on the screen gave every yes then.\n const decides = isDecides(frame.decides) ? frame.decides : \"person\";\n return { type: \"request\", id, action, input: frame.input, decides };\n }\n if (\n frame.type === \"tool\" &&\n typeof id === \"string\" &&\n typeof frame.name === \"string\" &&\n isRecord(frame.input)\n ) {\n return { type: \"tool\", id, name: frame.name, input: frame.input };\n }\n if (frame.type === \"handoff\" && typeof frame.reason === \"string\") {\n return { type: \"handoff\", reason: frame.reason };\n }\n if (frame.type === \"holder\" && isHolder(frame.handled_by)) {\n const handover = handoverOf(frame.handover);\n return handover && { type: \"holder\", handled_by: frame.handled_by, handover };\n }\n if (frame.type === \"decision\" && typeof frame.message_id === \"string\") {\n const { message_id } = frame;\n if (frame.decision === null) return { type: \"decision\", message_id, decision: null };\n const decision = decisionOf(frame.decision);\n return decision && { type: \"decision\", message_id, decision };\n }\n if (frame.type === \"browser\") {\n if (frame.open === false) return { type: \"browser\", open: false };\n const browser = frame.open === true ? browserOf(frame) : null;\n return browser && { type: \"browser\", open: true, ...browser };\n }\n if (frame.type === \"browser.frame\" && typeof frame.jpeg === \"string\" && isSize(frame)) {\n const { jpeg, width, height } = frame as { jpeg: string; width: number; height: number };\n return { type: \"browser.frame\", jpeg, width, height };\n }\n if (frame.type === \"working\" || frame.type === \"done\" || frame.type === \"stopped\") {\n return { type: frame.type };\n }\n if (\n frame.type === \"error\" &&\n typeof frame.code === \"string\" &&\n typeof frame.detail === \"string\"\n ) {\n return { type: \"error\", code: frame.code, detail: frame.detail };\n }\n return null;\n}\n"],"mappings":";AAwEA,MAAM,yBAA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MAAM,SAAS,WAAW;EAC5B,IAAI,MAAM,SAAS,OAAO,OAAO;GAAE,MAAM;GAAW,MAAM;EAAM;EAChE,MAAM,UAAU,MAAM,SAAS,OAAO,UAAU,KAAK,IAAI;EACzD,OAAO,WAAW;GAAE,MAAM;GAAW,MAAM;GAAM,GAAG;EAAQ;CAC9D;CACA,IAAI,MAAM,SAAS,mBAAmB,OAAO,MAAM,SAAS,YAAY,OAAO,KAAK,GAAG;EACrF,MAAM,EAAE,MAAM,OAAO,WAAW;EAChC,OAAO;GAAE,MAAM;GAAiB;GAAM;GAAO;EAAO;CACtD;CACA,IAAI,MAAM,SAAS,aAAa,MAAM,SAAS,UAAU,MAAM,SAAS,WACtE,OAAO,EAAE,MAAM,MAAM,KAAK;CAE5B,IACE,MAAM,SAAS,WACf,OAAO,MAAM,SAAS,YACtB,OAAO,MAAM,WAAW,UAExB,OAAO;EAAE,MAAM;EAAS,MAAM,MAAM;EAAM,QAAQ,MAAM;CAAO;CAEjE,OAAO;AACT"}
package/dist/icons.js ADDED
@@ -0,0 +1,29 @@
1
+ import { BellIcon, CalendarBlankIcon, ChatCircleIcon, CheckCircleIcon, ClockIcon, CodeIcon, CreditCardIcon, EnvelopeSimpleIcon, FileTextIcon, GlobeIcon, HandPalmIcon, LockSimpleIcon, MagnifyingGlassIcon, MapPinIcon, PhoneIcon, ShoppingCartIcon, SparkleIcon, TableIcon, UserIcon, WarningIcon } from "@phosphor-icons/react";
2
+ //#region src/icons.tsx
3
+ /** The package's glyphs by name, drawn with Phosphor: what a `Mark` holds. */
4
+ const GLYPHS = {
5
+ message: ChatCircleIcon,
6
+ phone: PhoneIcon,
7
+ mail: EnvelopeSimpleIcon,
8
+ calendar: CalendarBlankIcon,
9
+ clock: ClockIcon,
10
+ search: MagnifyingGlassIcon,
11
+ file: FileTextIcon,
12
+ table: TableIcon,
13
+ bell: BellIcon,
14
+ hand: HandPalmIcon,
15
+ user: UserIcon,
16
+ globe: GlobeIcon,
17
+ code: CodeIcon,
18
+ lock: LockSimpleIcon,
19
+ cart: ShoppingCartIcon,
20
+ card: CreditCardIcon,
21
+ map: MapPinIcon,
22
+ check: CheckCircleIcon,
23
+ warning: WarningIcon,
24
+ sparkle: SparkleIcon
25
+ };
26
+ //#endregion
27
+ export { GLYPHS };
28
+
29
+ //# sourceMappingURL=icons.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icons.js","names":[],"sources":["../src/icons.tsx"],"sourcesContent":["import {\n BellIcon,\n CalendarBlankIcon,\n ChatCircleIcon,\n CheckCircleIcon,\n ClockIcon,\n CodeIcon,\n CreditCardIcon,\n EnvelopeSimpleIcon,\n FileTextIcon,\n GlobeIcon,\n HandPalmIcon,\n LockSimpleIcon,\n MagnifyingGlassIcon,\n MapPinIcon,\n PhoneIcon,\n ShoppingCartIcon,\n SparkleIcon,\n TableIcon,\n UserIcon,\n WarningIcon,\n type Icon as Phosphor,\n} from \"@phosphor-icons/react\";\n\nimport type { Icon } from \"./about\";\n\n/** The package's glyphs by name, drawn with Phosphor: what a `Mark` holds. */\nexport const GLYPHS: Readonly<Record<Icon, Phosphor>> = {\n message: ChatCircleIcon,\n phone: PhoneIcon,\n mail: EnvelopeSimpleIcon,\n calendar: CalendarBlankIcon,\n clock: ClockIcon,\n search: MagnifyingGlassIcon,\n file: FileTextIcon,\n table: TableIcon,\n bell: BellIcon,\n hand: HandPalmIcon,\n user: UserIcon,\n globe: GlobeIcon,\n code: CodeIcon,\n lock: LockSimpleIcon,\n cart: ShoppingCartIcon,\n card: CreditCardIcon,\n map: MapPinIcon,\n check: CheckCircleIcon,\n warning: WarningIcon,\n sparkle: SparkleIcon,\n};\n"],"mappings":";;;AA2BA,MAAa,SAA2C;CACtD,SAAS;CACT,OAAO;CACP,MAAM;CACN,UAAU;CACV,OAAO;CACP,QAAQ;CACR,MAAM;CACN,OAAO;CACP,MAAM;CACN,MAAM;CACN,MAAM;CACN,OAAO;CACP,MAAM;CACN,MAAM;CACN,MAAM;CACN,MAAM;CACN,KAAK;CACL,OAAO;CACP,SAAS;CACT,SAAS;AACX"}