@celljs/ta-web 4.41.0 → 4.43.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 (318) hide show
  1. package/README.en.md +1 -1
  2. package/README.md +1 -1
  3. package/esm/browser/apps/web-apps.d.ts +4 -0
  4. package/esm/browser/apps/web-apps.js +14 -3
  5. package/esm/browser/assistant/ta-hearing.d.ts +85 -0
  6. package/esm/browser/assistant/ta-hearing.js +272 -0
  7. package/esm/browser/components/auth-view.js +1 -1
  8. package/esm/browser/components/board.js +9 -1
  9. package/esm/browser/components/clipboard-link-host.d.ts +2 -0
  10. package/esm/browser/components/clipboard-link-host.js +27 -0
  11. package/esm/browser/components/cloud-network.js +1 -1
  12. package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
  13. package/esm/browser/components/custom-provider-advanced.js +8 -8
  14. package/esm/browser/components/custom-provider-view.js +12 -12
  15. package/esm/browser/components/empty-state.d.ts +2 -1
  16. package/esm/browser/components/empty-state.js +6 -2
  17. package/esm/browser/components/folder-picker.js +2 -2
  18. package/esm/browser/components/gallery.js +8 -9
  19. package/esm/browser/components/hearing-host.d.ts +5 -0
  20. package/esm/browser/components/hearing-host.js +58 -0
  21. package/esm/browser/components/host-view.d.ts +1 -1
  22. package/esm/browser/components/link-dialog.js +4 -0
  23. package/esm/browser/components/loading.d.ts +3 -2
  24. package/esm/browser/components/loading.js +7 -3
  25. package/esm/browser/components/markdown.d.ts +3 -1
  26. package/esm/browser/components/markdown.js +55 -10
  27. package/esm/browser/components/media.d.ts +10 -4
  28. package/esm/browser/components/media.js +60 -14
  29. package/esm/browser/components/people-picker.d.ts +17 -0
  30. package/esm/browser/components/people-picker.js +129 -0
  31. package/esm/browser/components/relay-view.js +1 -1
  32. package/esm/browser/components/settings-parts.js +2 -0
  33. package/esm/browser/components/share-dialog.d.ts +2 -2
  34. package/esm/browser/components/share-dialog.js +7 -4
  35. package/esm/browser/components/share-friends.js +3 -10
  36. package/esm/browser/components/share-item-sheet.d.ts +12 -0
  37. package/esm/browser/components/share-item-sheet.js +39 -0
  38. package/esm/browser/components/share-sheet.d.ts +9 -2
  39. package/esm/browser/components/share-sheet.js +5 -4
  40. package/esm/browser/components/sign-in-setup.js +4 -4
  41. package/esm/browser/components/trusted-domains.js +1 -1
  42. package/esm/browser/components/view-room.d.ts +25 -0
  43. package/esm/browser/components/view-room.js +136 -0
  44. package/esm/browser/components/voice-services.js +6 -6
  45. package/esm/browser/device/device-protocol.d.ts +9 -6
  46. package/esm/browser/device/device-protocol.js +7 -4
  47. package/esm/browser/device/launch-screen.d.ts +11 -1
  48. package/esm/browser/device/launch-screen.js +22 -4
  49. package/esm/browser/extension/share-sheet-compat.d.ts +2 -0
  50. package/esm/browser/extension/share-sheet-compat.js +12 -2
  51. package/esm/browser/extension/web-api-code.d.ts +11 -0
  52. package/esm/browser/extension/web-api-components.d.ts +8 -1
  53. package/esm/browser/extension/web-api-contributions.d.ts +30 -1
  54. package/esm/browser/extension/web-api-desktop.d.ts +2 -1
  55. package/esm/browser/extension/web-api-file-views.d.ts +38 -0
  56. package/esm/browser/extension/web-api-file-views.js +2 -0
  57. package/esm/browser/extension/web-api-host.d.ts +47 -0
  58. package/esm/browser/extension/web-api-host.js +3 -0
  59. package/esm/browser/extension/web-api-menus.d.ts +46 -0
  60. package/esm/browser/extension/web-api-partners.d.ts +58 -1
  61. package/esm/browser/extension/web-api-spec.js +7 -0
  62. package/esm/browser/extension/web-extension-api.d.ts +10 -10
  63. package/esm/browser/extension/web-extension-context.d.ts +2 -8
  64. package/esm/browser/extension/web-extension-context.js +14 -39
  65. package/esm/browser/extension/web-extension-marks.d.ts +10 -0
  66. package/esm/browser/extension/web-extension-marks.js +29 -0
  67. package/esm/browser/extension/web-extension-protocol.d.ts +11 -1
  68. package/esm/browser/extension/web-extension-protocol.js +3 -0
  69. package/esm/browser/extension/web-extension-run.d.ts +15 -2
  70. package/esm/browser/extension/web-extension-run.js +77 -0
  71. package/esm/browser/extension/web-extensions-running.d.ts +5 -1
  72. package/esm/browser/extension/web-extensions-running.js +16 -0
  73. package/esm/browser/extension/web-extensions.d.ts +2 -1
  74. package/esm/browser/extension/web-extensions.js +3 -0
  75. package/esm/browser/extension/web-home.js +3 -1
  76. package/esm/browser/extension/web-host-values.d.ts +66 -0
  77. package/esm/browser/extension/web-host-values.js +191 -0
  78. package/esm/browser/extension/web-hosts.d.ts +7 -2
  79. package/esm/browser/extension/web-hosts.js +16 -4
  80. package/esm/browser/extension/web-share-ui.d.ts +7 -0
  81. package/esm/browser/extension/web-share-ui.js +15 -0
  82. package/esm/browser/extension/web-share.d.ts +18 -0
  83. package/esm/browser/extension/web-share.js +42 -0
  84. package/esm/browser/i18n/en/chat.d.ts +10 -0
  85. package/esm/browser/i18n/en/chat.js +10 -0
  86. package/esm/browser/i18n/en/common.d.ts +23 -0
  87. package/esm/browser/i18n/en/common.js +23 -0
  88. package/esm/browser/i18n/en/discover.d.ts +7 -0
  89. package/esm/browser/i18n/en/discover.js +7 -0
  90. package/esm/browser/i18n/en/settings.d.ts +2 -0
  91. package/esm/browser/i18n/en/settings.js +2 -0
  92. package/esm/browser/i18n/ja/chat.js +10 -0
  93. package/esm/browser/i18n/ja/common.js +23 -0
  94. package/esm/browser/i18n/ja/discover.js +7 -0
  95. package/esm/browser/i18n/ja/settings.js +2 -0
  96. package/esm/browser/i18n/locales.d.ts +43 -1
  97. package/esm/browser/i18n/messages.d.ts +42 -0
  98. package/esm/browser/i18n/zh/chat.js +10 -0
  99. package/esm/browser/i18n/zh/common.js +23 -0
  100. package/esm/browser/i18n/zh/discover.js +7 -0
  101. package/esm/browser/i18n/zh/settings.js +2 -0
  102. package/esm/browser/i18n/zh-tw/chat.js +10 -0
  103. package/esm/browser/i18n/zh-tw/common.js +23 -0
  104. package/esm/browser/i18n/zh-tw/discover.js +7 -0
  105. package/esm/browser/i18n/zh-tw/settings.js +2 -0
  106. package/esm/browser/launch-art/art-palette.d.ts +41 -0
  107. package/esm/browser/launch-art/art-palette.js +72 -0
  108. package/esm/browser/launch-art/cyclic-automaton.d.ts +45 -0
  109. package/esm/browser/launch-art/cyclic-automaton.js +176 -0
  110. package/esm/browser/launch-art/fractal-tree.d.ts +43 -0
  111. package/esm/browser/launch-art/fractal-tree.js +48 -0
  112. package/esm/browser/launch-art/launch-art.d.ts +98 -0
  113. package/esm/browser/launch-art/launch-art.js +420 -0
  114. package/esm/browser/launch-art/launch-sky.d.ts +66 -0
  115. package/esm/browser/launch-art/launch-sky.js +153 -0
  116. package/esm/browser/links/clipboard-links.d.ts +89 -0
  117. package/esm/browser/links/clipboard-links.js +303 -0
  118. package/esm/browser/links/link-text.d.ts +29 -0
  119. package/esm/browser/links/link-text.js +97 -0
  120. package/esm/browser/links/links-protocol.d.ts +12 -1
  121. package/esm/browser/links/links.d.ts +8 -2
  122. package/esm/browser/links/links.js +33 -3
  123. package/esm/browser/markdown/code-renderers.d.ts +4 -0
  124. package/esm/browser/markdown/code-renderers.js +4 -0
  125. package/esm/browser/partners/group-picker.js +23 -29
  126. package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
  127. package/esm/browser/sandbox/work/work-senses.js +1 -1
  128. package/esm/browser/settings/settings-protocol.d.ts +2 -0
  129. package/esm/browser/settings/settings-protocol.js +2 -0
  130. package/esm/browser/style/base.d.ts +1 -1
  131. package/esm/browser/style/base.js +10 -6
  132. package/esm/browser/style/chat-list.d.ts +1 -1
  133. package/esm/browser/style/chat-list.js +28 -15
  134. package/esm/browser/style/conversation-column.d.ts +1 -1
  135. package/esm/browser/style/conversation.d.ts +1 -1
  136. package/esm/browser/style/conversation.js +29 -2
  137. package/esm/browser/style/dialogs.d.ts +1 -1
  138. package/esm/browser/style/dialogs.js +2 -5
  139. package/esm/browser/style/forms.d.ts +5 -0
  140. package/esm/browser/style/forms.js +65 -0
  141. package/esm/browser/style/layout.d.ts +1 -1
  142. package/esm/browser/style/pages.d.ts +1 -1
  143. package/esm/browser/style/pages.js +14 -24
  144. package/esm/browser/style/phone.d.ts +1 -1
  145. package/esm/browser/style/shared.d.ts +1 -1
  146. package/esm/browser/style/shell.d.ts +1 -1
  147. package/esm/browser/style/shell.js +1 -6
  148. package/esm/browser/style/surfaces.d.ts +1 -1
  149. package/esm/browser/style/surfaces.js +0 -6
  150. package/esm/browser/style/tasks.d.ts +1 -1
  151. package/esm/browser/style.js +2 -0
  152. package/esm/browser/util/markdown.d.ts +45 -3
  153. package/esm/browser/util/markdown.js +67 -11
  154. package/esm/browser/util/voice.d.ts +18 -0
  155. package/esm/browser/util/voice.js +111 -3
  156. package/esm/browser/workbench-protocol.d.ts +2 -0
  157. package/esm/browser/workbench-services.d.ts +2 -0
  158. package/esm/browser/workbench-services.js +5 -0
  159. package/esm/browser/workbench.js +5 -0
  160. package/lib/browser/apps/web-apps.d.ts +4 -0
  161. package/lib/browser/apps/web-apps.js +14 -3
  162. package/lib/browser/assistant/ta-hearing.d.ts +86 -0
  163. package/lib/browser/assistant/ta-hearing.js +277 -0
  164. package/lib/browser/components/auth-view.js +1 -1
  165. package/lib/browser/components/board.js +9 -1
  166. package/lib/browser/components/clipboard-link-host.d.ts +3 -0
  167. package/lib/browser/components/clipboard-link-host.js +63 -0
  168. package/lib/browser/components/cloud-network.js +1 -1
  169. package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
  170. package/lib/browser/components/custom-provider-advanced.js +8 -8
  171. package/lib/browser/components/custom-provider-view.js +12 -12
  172. package/lib/browser/components/empty-state.d.ts +2 -1
  173. package/lib/browser/components/empty-state.js +6 -2
  174. package/lib/browser/components/folder-picker.js +2 -2
  175. package/lib/browser/components/gallery.js +7 -8
  176. package/lib/browser/components/hearing-host.d.ts +6 -0
  177. package/lib/browser/components/hearing-host.js +94 -0
  178. package/lib/browser/components/host-view.d.ts +1 -1
  179. package/lib/browser/components/link-dialog.js +4 -0
  180. package/lib/browser/components/loading.d.ts +3 -2
  181. package/lib/browser/components/loading.js +7 -3
  182. package/lib/browser/components/markdown.d.ts +3 -1
  183. package/lib/browser/components/markdown.js +53 -8
  184. package/lib/browser/components/media.d.ts +10 -4
  185. package/lib/browser/components/media.js +61 -14
  186. package/lib/browser/components/people-picker.d.ts +18 -0
  187. package/lib/browser/components/people-picker.js +166 -0
  188. package/lib/browser/components/relay-view.js +1 -1
  189. package/lib/browser/components/settings-parts.js +2 -0
  190. package/lib/browser/components/share-dialog.d.ts +2 -2
  191. package/lib/browser/components/share-dialog.js +7 -4
  192. package/lib/browser/components/share-friends.js +3 -10
  193. package/lib/browser/components/share-item-sheet.d.ts +13 -0
  194. package/lib/browser/components/share-item-sheet.js +75 -0
  195. package/lib/browser/components/share-sheet.d.ts +9 -2
  196. package/lib/browser/components/share-sheet.js +5 -3
  197. package/lib/browser/components/sign-in-setup.js +4 -4
  198. package/lib/browser/components/trusted-domains.js +1 -1
  199. package/lib/browser/components/view-room.d.ts +26 -0
  200. package/lib/browser/components/view-room.js +173 -0
  201. package/lib/browser/components/voice-services.js +6 -6
  202. package/lib/browser/device/device-protocol.d.ts +9 -6
  203. package/lib/browser/device/device-protocol.js +7 -4
  204. package/lib/browser/device/launch-screen.d.ts +11 -1
  205. package/lib/browser/device/launch-screen.js +22 -4
  206. package/lib/browser/extension/share-sheet-compat.d.ts +2 -0
  207. package/lib/browser/extension/share-sheet-compat.js +13 -2
  208. package/lib/browser/extension/web-api-code.d.ts +11 -0
  209. package/lib/browser/extension/web-api-components.d.ts +8 -1
  210. package/lib/browser/extension/web-api-contributions.d.ts +30 -1
  211. package/lib/browser/extension/web-api-desktop.d.ts +2 -1
  212. package/lib/browser/extension/web-api-file-views.d.ts +39 -0
  213. package/lib/browser/extension/web-api-file-views.js +3 -0
  214. package/lib/browser/extension/web-api-host.d.ts +48 -0
  215. package/lib/browser/extension/web-api-host.js +4 -0
  216. package/lib/browser/extension/web-api-menus.d.ts +46 -0
  217. package/lib/browser/extension/web-api-partners.d.ts +58 -1
  218. package/lib/browser/extension/web-api-spec.js +7 -0
  219. package/lib/browser/extension/web-extension-api.d.ts +10 -10
  220. package/lib/browser/extension/web-extension-context.d.ts +2 -8
  221. package/lib/browser/extension/web-extension-context.js +14 -39
  222. package/lib/browser/extension/web-extension-marks.d.ts +11 -0
  223. package/lib/browser/extension/web-extension-marks.js +65 -0
  224. package/lib/browser/extension/web-extension-protocol.d.ts +11 -1
  225. package/lib/browser/extension/web-extension-protocol.js +3 -0
  226. package/lib/browser/extension/web-extension-run.d.ts +15 -2
  227. package/lib/browser/extension/web-extension-run.js +77 -0
  228. package/lib/browser/extension/web-extensions-running.d.ts +5 -1
  229. package/lib/browser/extension/web-extensions-running.js +16 -0
  230. package/lib/browser/extension/web-extensions.d.ts +2 -1
  231. package/lib/browser/extension/web-extensions.js +3 -0
  232. package/lib/browser/extension/web-home.js +3 -1
  233. package/lib/browser/extension/web-host-values.d.ts +67 -0
  234. package/lib/browser/extension/web-host-values.js +229 -0
  235. package/lib/browser/extension/web-hosts.d.ts +7 -2
  236. package/lib/browser/extension/web-hosts.js +16 -4
  237. package/lib/browser/extension/web-share-ui.d.ts +8 -0
  238. package/lib/browser/extension/web-share-ui.js +51 -0
  239. package/lib/browser/extension/web-share.d.ts +19 -0
  240. package/lib/browser/extension/web-share.js +45 -0
  241. package/lib/browser/i18n/en/chat.d.ts +10 -0
  242. package/lib/browser/i18n/en/chat.js +10 -0
  243. package/lib/browser/i18n/en/common.d.ts +23 -0
  244. package/lib/browser/i18n/en/common.js +23 -0
  245. package/lib/browser/i18n/en/discover.d.ts +7 -0
  246. package/lib/browser/i18n/en/discover.js +7 -0
  247. package/lib/browser/i18n/en/settings.d.ts +2 -0
  248. package/lib/browser/i18n/en/settings.js +2 -0
  249. package/lib/browser/i18n/ja/chat.js +10 -0
  250. package/lib/browser/i18n/ja/common.js +23 -0
  251. package/lib/browser/i18n/ja/discover.js +7 -0
  252. package/lib/browser/i18n/ja/settings.js +2 -0
  253. package/lib/browser/i18n/locales.d.ts +43 -1
  254. package/lib/browser/i18n/messages.d.ts +42 -0
  255. package/lib/browser/i18n/zh/chat.js +10 -0
  256. package/lib/browser/i18n/zh/common.js +23 -0
  257. package/lib/browser/i18n/zh/discover.js +7 -0
  258. package/lib/browser/i18n/zh/settings.js +2 -0
  259. package/lib/browser/i18n/zh-tw/chat.js +10 -0
  260. package/lib/browser/i18n/zh-tw/common.js +23 -0
  261. package/lib/browser/i18n/zh-tw/discover.js +7 -0
  262. package/lib/browser/i18n/zh-tw/settings.js +2 -0
  263. package/lib/browser/launch-art/art-palette.d.ts +42 -0
  264. package/lib/browser/launch-art/art-palette.js +76 -0
  265. package/lib/browser/launch-art/cyclic-automaton.d.ts +46 -0
  266. package/lib/browser/launch-art/cyclic-automaton.js +180 -0
  267. package/lib/browser/launch-art/fractal-tree.d.ts +44 -0
  268. package/lib/browser/launch-art/fractal-tree.js +52 -0
  269. package/lib/browser/launch-art/launch-art.d.ts +99 -0
  270. package/lib/browser/launch-art/launch-art.js +424 -0
  271. package/lib/browser/launch-art/launch-sky.d.ts +67 -0
  272. package/lib/browser/launch-art/launch-sky.js +157 -0
  273. package/lib/browser/links/clipboard-links.d.ts +90 -0
  274. package/lib/browser/links/clipboard-links.js +308 -0
  275. package/lib/browser/links/link-text.d.ts +30 -0
  276. package/lib/browser/links/link-text.js +100 -0
  277. package/lib/browser/links/links-protocol.d.ts +12 -1
  278. package/lib/browser/links/links.d.ts +8 -2
  279. package/lib/browser/links/links.js +33 -3
  280. package/lib/browser/markdown/code-renderers.d.ts +4 -0
  281. package/lib/browser/markdown/code-renderers.js +5 -1
  282. package/lib/browser/partners/group-picker.js +23 -29
  283. package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
  284. package/lib/browser/sandbox/work/work-senses.js +1 -1
  285. package/lib/browser/settings/settings-protocol.d.ts +2 -0
  286. package/lib/browser/settings/settings-protocol.js +2 -0
  287. package/lib/browser/style/base.d.ts +1 -1
  288. package/lib/browser/style/base.js +10 -6
  289. package/lib/browser/style/chat-list.d.ts +1 -1
  290. package/lib/browser/style/chat-list.js +28 -15
  291. package/lib/browser/style/conversation-column.d.ts +1 -1
  292. package/lib/browser/style/conversation.d.ts +1 -1
  293. package/lib/browser/style/conversation.js +29 -2
  294. package/lib/browser/style/dialogs.d.ts +1 -1
  295. package/lib/browser/style/dialogs.js +2 -5
  296. package/lib/browser/style/forms.d.ts +6 -0
  297. package/lib/browser/style/forms.js +68 -0
  298. package/lib/browser/style/layout.d.ts +1 -1
  299. package/lib/browser/style/pages.d.ts +1 -1
  300. package/lib/browser/style/pages.js +14 -24
  301. package/lib/browser/style/phone.d.ts +1 -1
  302. package/lib/browser/style/shared.d.ts +1 -1
  303. package/lib/browser/style/shell.d.ts +1 -1
  304. package/lib/browser/style/shell.js +1 -6
  305. package/lib/browser/style/surfaces.d.ts +1 -1
  306. package/lib/browser/style/surfaces.js +0 -6
  307. package/lib/browser/style/tasks.d.ts +1 -1
  308. package/lib/browser/style.js +2 -0
  309. package/lib/browser/util/markdown.d.ts +45 -3
  310. package/lib/browser/util/markdown.js +68 -12
  311. package/lib/browser/util/voice.d.ts +18 -0
  312. package/lib/browser/util/voice.js +111 -3
  313. package/lib/browser/workbench-protocol.d.ts +2 -0
  314. package/lib/browser/workbench-services.d.ts +2 -0
  315. package/lib/browser/workbench-services.js +5 -0
  316. package/lib/browser/workbench.js +5 -0
  317. package/package.json +8 -8
  318. package/public/launch.svg +3 -3
@@ -0,0 +1,277 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HeardSound = exports.TaHearing = exports.HEAR_PACKAGE = void 0;
4
+ const mini_program_1 = require("../device/mini-program");
5
+ const transcription_1 = require("../util/transcription");
6
+ const mic_capture_1 = require("./mic-capture");
7
+ const pcm_util_1 = require("./pcm-util");
8
+ const realtime_voice_1 = require("./realtime-voice");
9
+ /** The package whose host writes speech down on the computer (ta-voice's hear.ts). */
10
+ exports.HEAR_PACKAGE = '@celljs/ta-voice';
11
+ /**
12
+ * Ta listening where the recognizer of the device does not (Voice.Fallback, docs/design/ta-voice.md 11): with the
13
+ * voice service of Settings → Voice when one is chosen, else with the model of the computer (ta-voice's hear, a
14
+ * need of ta-local-models). The microphone's sound goes to ta serve as PCM16 at 16 kHz in pieces as the user speaks;
15
+ * what was said so far comes back about each second, and all of it once they stop.
16
+ */
17
+ class TaHearing {
18
+ constructor(host) {
19
+ this.host = host;
20
+ }
21
+ available() {
22
+ var _a;
23
+ return !mini_program_1.MiniProgram.inside() && this.host.online() && typeof navigator !== 'undefined' && !!((_a = navigator.mediaDevices) === null || _a === void 0 ? void 0 : _a.getUserMedia);
24
+ }
25
+ listen(language, onText, onEnd, options = {}) {
26
+ let ended = false;
27
+ let stopped = false;
28
+ let inner;
29
+ const end = (error) => {
30
+ if (!ended) {
31
+ ended = true;
32
+ onEnd(error);
33
+ }
34
+ };
35
+ void (async () => {
36
+ const voices = await this.host.voices.voice.listVoices().catch(() => undefined);
37
+ if ((voices === null || voices === void 0 ? void 0 : voices.use) && !stopped) {
38
+ const service = await new realtime_voice_1.RealtimeVoice(this.host.voices).open(language).catch(() => undefined);
39
+ if (service && stopped) {
40
+ service.stop();
41
+ }
42
+ if (service && !stopped) {
43
+ inner = this.withService(service, language, onText, end, options);
44
+ return;
45
+ }
46
+ }
47
+ if (stopped) {
48
+ return end();
49
+ }
50
+ const status = (await this.host.call('hearing', []).catch(() => undefined));
51
+ if ((status === null || status === void 0 ? void 0 : status.state) !== 'ready') {
52
+ this.host.tell(status);
53
+ return end();
54
+ }
55
+ if (stopped) {
56
+ return end();
57
+ }
58
+ inner = await this.locally(onText, end, options);
59
+ if (stopped) {
60
+ inner === null || inner === void 0 ? void 0 : inner.stop();
61
+ }
62
+ })().catch(() => end('network'));
63
+ return {
64
+ stop: () => {
65
+ stopped = true;
66
+ inner === null || inner === void 0 ? void 0 : inner.stop();
67
+ },
68
+ };
69
+ }
70
+ /** With the voice service of Settings: one utterance, or all said till stopped, a sentence after another. */
71
+ withService(service, language, onText, end, options) {
72
+ let said = '';
73
+ let heard = '';
74
+ const done = (error) => {
75
+ service.stop();
76
+ end(error);
77
+ };
78
+ if (!options.continuous) {
79
+ const listening = service.listen(language, (text, final) => {
80
+ heard = text;
81
+ onText(text, final);
82
+ }, done);
83
+ if (!listening) {
84
+ done('unavailable');
85
+ return undefined;
86
+ }
87
+ return {
88
+ stop: () => {
89
+ listening.stop();
90
+ if (heard.trim()) {
91
+ onText(heard, true);
92
+ }
93
+ done();
94
+ },
95
+ };
96
+ }
97
+ const joined = (more) => [said, more].filter(part => part.trim()).join(' ');
98
+ const transcribing = transcription_1.Transcription.start(service, language, {
99
+ onText: (text, final) => {
100
+ if (final) {
101
+ said = joined(text);
102
+ heard = '';
103
+ onText(said, false);
104
+ }
105
+ else {
106
+ heard = text;
107
+ onText(joined(text), false);
108
+ }
109
+ },
110
+ onEnd: error => {
111
+ if (said.trim()) {
112
+ onText(said, true);
113
+ }
114
+ done(error);
115
+ },
116
+ }, { hints: options.hints });
117
+ if (!transcribing) {
118
+ done('unavailable');
119
+ return undefined;
120
+ }
121
+ return { stop: () => transcribing.stop() };
122
+ }
123
+ /** With the model of the computer. */
124
+ async locally(onText, end, options) {
125
+ var _a, _b;
126
+ var _c, _d;
127
+ let stream;
128
+ try {
129
+ stream = await ((_c = (_b = (_a = this.host).microphone) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : navigator.mediaDevices.getUserMedia({ audio: { echoCancellation: true, noiseSuppression: true, autoGainControl: true, channelCount: 1 } }));
130
+ }
131
+ catch (error) {
132
+ const name = error === null || error === void 0 ? void 0 : error.name;
133
+ end(name === 'NotAllowedError' || name === 'SecurityError' ? 'not-allowed' : 'audio-capture');
134
+ return undefined;
135
+ }
136
+ const id = `h-${crypto.randomUUID()}`;
137
+ const heard = new HeardSound(options.continuous === true);
138
+ let chain = Promise.resolve();
139
+ let finished = false;
140
+ let decoding = false;
141
+ let decodedAt = 0;
142
+ let latest = '';
143
+ const Context = (_d = globalThis.AudioContext) !== null && _d !== void 0 ? _d : globalThis.webkitAudioContext;
144
+ const context = new Context();
145
+ const send = (decode) => {
146
+ const piece = heard.take();
147
+ const audio = piece.length ? pcm_util_1.PcmUtil.base64(piece) : '';
148
+ const sent = chain.then(() => this.host.call('hear', decode ? [id, audio, decode] : [id, audio]));
149
+ chain = sent.catch(() => undefined);
150
+ return sent;
151
+ };
152
+ const finish = (error) => {
153
+ if (finished) {
154
+ return;
155
+ }
156
+ finished = true;
157
+ clearInterval(timer);
158
+ capture.stop();
159
+ void context.close().catch(() => undefined);
160
+ if (error) {
161
+ return end(error);
162
+ }
163
+ send('final').then(answer => {
164
+ var _a;
165
+ const text = String((_a = answer === null || answer === void 0 ? void 0 : answer.text) !== null && _a !== void 0 ? _a : '').trim() || latest;
166
+ if (text) {
167
+ onText(text, true);
168
+ }
169
+ end();
170
+ }, () => end('network'));
171
+ };
172
+ const capture = new mic_capture_1.MicCapture(stream, error => finish(error));
173
+ await context.resume().catch(() => undefined);
174
+ capture.hear(context, samples => heard.add(samples, context.sampleRate));
175
+ const timer = setInterval(() => {
176
+ if (finished) {
177
+ return;
178
+ }
179
+ if (!this.host.online()) {
180
+ return finish('network');
181
+ }
182
+ if (heard.over()) {
183
+ return finish();
184
+ }
185
+ const now = Date.now();
186
+ const ask = heard.spoke && !decoding && now - decodedAt >= TaHearing.INTERIM_MS && heard.ms <= TaHearing.INTERIM_MAX_MS;
187
+ if (!ask) {
188
+ send().catch(() => finish('network'));
189
+ return;
190
+ }
191
+ decoding = true;
192
+ decodedAt = now;
193
+ send('interim').then(answer => {
194
+ var _a;
195
+ decoding = false;
196
+ const text = String((_a = answer === null || answer === void 0 ? void 0 : answer.text) !== null && _a !== void 0 ? _a : '').trim();
197
+ if (text && !finished) {
198
+ latest = text;
199
+ onText(text, false);
200
+ }
201
+ }, () => finish('network'));
202
+ }, TaHearing.PIECE_MS);
203
+ return { stop: () => finish() };
204
+ }
205
+ }
206
+ exports.TaHearing = TaHearing;
207
+ /** Each piece sent, ms. */
208
+ TaHearing.PIECE_MS = 250;
209
+ /** What was said so far is asked at most this often, ms. */
210
+ TaHearing.INTERIM_MS = 1000;
211
+ /** Not past this much sound, ms: longer, only the end is written down. */
212
+ TaHearing.INTERIM_MAX_MS = 60000;
213
+ /** A silence this long after speech ends what is said to it (not what a finger holds), ms. */
214
+ TaHearing.SILENCE_MS = 1200;
215
+ /** No speech this long ends it, ms. */
216
+ TaHearing.NO_SPEECH_MS = 8000;
217
+ /** The longest one utterance, and one held, ms. */
218
+ TaHearing.MAX_MS = 60000;
219
+ TaHearing.MAX_HELD_MS = 300000;
220
+ /** The level (RMS) of speech, at least; in noise, louder than it. */
221
+ TaHearing.LEVEL = 0.015;
222
+ TaHearing.RATE = 16000;
223
+ /**
224
+ * The sound of a listening as it comes: PCM16 at 16 kHz not sent yet, how long it is, and whether it was speech, by its
225
+ * level above the noise there is; a silence after speech, no speech at all or too long a one ends what is said to it.
226
+ */
227
+ class HeardSound {
228
+ constructor(held) {
229
+ this.held = held;
230
+ this.pieces = [];
231
+ this.samples = 0;
232
+ this.noise = 0;
233
+ this.spokeAt = 0;
234
+ this.spoke = false;
235
+ }
236
+ /** How long it is, ms. */
237
+ get ms() {
238
+ return (this.samples / TaHearing.RATE) * 1000;
239
+ }
240
+ add(samples, rate) {
241
+ const pcm = pcm_util_1.PcmUtil.toPcm16(samples, rate, TaHearing.RATE);
242
+ this.pieces.push(pcm);
243
+ this.samples += pcm.length / 2;
244
+ const level = pcm_util_1.PcmUtil.rms(samples);
245
+ if (level >= Math.max(TaHearing.LEVEL, this.noise * 2.5)) {
246
+ this.spoke = true;
247
+ this.spokeAt = this.ms;
248
+ }
249
+ else {
250
+ this.noise = this.noise ? this.noise * 0.95 + level * 0.05 : level;
251
+ }
252
+ }
253
+ /** What came since it was last taken. */
254
+ take() {
255
+ const bytes = this.pieces.reduce((sum, piece) => sum + piece.length, 0);
256
+ const out = new Uint8Array(bytes);
257
+ let at = 0;
258
+ for (const piece of this.pieces) {
259
+ out.set(piece, at);
260
+ at += piece.length;
261
+ }
262
+ this.pieces = [];
263
+ return out;
264
+ }
265
+ /** It is over: too long, or, said to it rather than held, a silence after speech or no speech at all. */
266
+ over() {
267
+ if (this.held) {
268
+ return this.ms >= TaHearing.MAX_HELD_MS;
269
+ }
270
+ if (this.ms >= TaHearing.MAX_MS) {
271
+ return true;
272
+ }
273
+ return this.spoke ? this.ms - this.spokeAt >= TaHearing.SILENCE_MS : this.ms >= TaHearing.NO_SPEECH_MS;
274
+ }
275
+ }
276
+ exports.HeardSound = HeardSound;
277
+ //# sourceMappingURL=ta-hearing.js.map
@@ -381,7 +381,7 @@ function AuthPanel({ onSignedIn, onProviders, kinds }) {
381
381
  kind && (React.createElement("div", { className: "ta-auth-flow-head" },
382
382
  React.createElement(icon_1.IconButton, { icon: lucide_react_1.ArrowLeft, label: t('ta.auth.back'), onClick: () => setKind(undefined) }),
383
383
  React.createElement("span", { className: "ta-auth-flow-title" }, kind === 'oauth' ? t('ta.auth.accounts') : t('ta.auth.keys')))),
384
- React.createElement("label", { className: "ta-field ta-field-small" },
384
+ React.createElement("label", { className: "ta-field" },
385
385
  React.createElement(lucide_react_1.Search, { size: 15, strokeWidth: 1.75, "aria-hidden": "true" }),
386
386
  React.createElement("input", { placeholder: t('ta.auth.search'), value: words, onChange: event => setWords(event.target.value) })),
387
387
  React.createElement("div", { className: "ta-auth-list" },
@@ -41,9 +41,15 @@ const extension_view_1 = require("../extension/extension-view");
41
41
  const web_extension_protocol_1 = require("../extension/web-extension-protocol");
42
42
  const hooks_1 = require("../hooks");
43
43
  const use_t_1 = require("../i18n/use-t");
44
+ const code_renderers_1 = require("../markdown/code-renderers");
44
45
  const board_util_1 = require("./board-util");
45
46
  const empty_state_1 = require("./empty-state");
46
47
  const sortable_1 = require("./sortable");
48
+ /**
49
+ * A card of the board. It is the frame of what it holds: a block a widget draws with `ui.Markdown` (a dashboard, a plot
50
+ * kept as a work) is drawn embedded, without a frame of its own inside this one (AGENTS.md "A block has one frame"),
51
+ * nor a title of its own that says again the card's (WebCodeRendererProps.titled).
52
+ */
47
53
  function Card({ view, index }) {
48
54
  const View = view.component;
49
55
  const Glyph = view.icon;
@@ -54,7 +60,9 @@ function Card({ view, index }) {
54
60
  React.createElement("span", null, title)),
55
61
  React.createElement("div", { className: "ta-board-card-body" },
56
62
  React.createElement(extension_view_1.ExtensionBoundary, { name: title, resetKey: View },
57
- React.createElement(View, null)))));
63
+ React.createElement(code_renderers_1.CodeEmbedded.Provider, { value: true },
64
+ React.createElement(code_renderers_1.CodeTitled.Provider, { value: title },
65
+ React.createElement(View, null)))))));
58
66
  }
59
67
  /** The day, as the widgets of a phone head their page: `11月12日 星期四`; again after midnight. */
60
68
  function Today() {
@@ -0,0 +1,3 @@
1
+ /** Offers the links of Ta the user copied or pasted (ClipboardLinks), once the extensions that tell them apart are loaded. */
2
+ export declare function ClipboardLinkHost(): null;
3
+ //# sourceMappingURL=clipboard-link-host.d.ts.map
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.ClipboardLinkHost = ClipboardLinkHost;
37
+ const React = __importStar(require("react"));
38
+ const hooks_1 = require("../hooks");
39
+ const use_t_1 = require("../i18n/use-t");
40
+ const clipboard_links_1 = require("../links/clipboard-links");
41
+ /** Offers the links of Ta the user copied or pasted (ClipboardLinks), once the extensions that tell them apart are loaded. */
42
+ function ClipboardLinkHost() {
43
+ const [, links] = (0, hooks_1.useLinks)();
44
+ const [, notices] = (0, hooks_1.useNotices)();
45
+ const [, settings] = (0, hooks_1.useSettings)();
46
+ const [{ loaded }] = (0, hooks_1.useWebExtensions)();
47
+ const clipboard = React.useMemo(() => new clipboard_links_1.ClipboardLinks({
48
+ find: text => links.find(text),
49
+ open: url => void links.open({ type: 'url', url }, { onlyTa: true }),
50
+ onOpen: listener => links.onOpen(listener),
51
+ notices,
52
+ say: (id, values) => (0, use_t_1.translator)(settings.state.language)(id, values),
53
+ enabled: () => settings.state.settings.clipboardLinks,
54
+ }), [links, notices, settings]);
55
+ React.useEffect(() => clipboard.start(), [clipboard]);
56
+ React.useEffect(() => {
57
+ if (loaded) {
58
+ clipboard.loaded();
59
+ }
60
+ }, [clipboard, loaded]);
61
+ return null;
62
+ }
63
+ //# sourceMappingURL=clipboard-link-host.js.map
@@ -132,7 +132,7 @@ function CloudNetworkRow({ host, onChanged }) {
132
132
  }
133
133
  void save(allow);
134
134
  } },
135
- React.createElement("textarea", { className: "ta-input", rows: 5, value: text, spellCheck: false, placeholder: t('ta.remote.network.placeholder'), "aria-label": t('ta.remote.network.custom'), onChange: event => setText(event.target.value) }),
135
+ React.createElement("textarea", { className: "ta-input ta-mono", rows: 5, value: text, spellCheck: false, placeholder: t('ta.remote.network.placeholder'), "aria-label": t('ta.remote.network.custom'), onChange: event => setText(event.target.value) }),
136
136
  React.createElement("button", { type: "submit", className: `ta-button${busy ? ' ta-busy' : ''}`, disabled: busy }, busy ? React.createElement("span", { className: "ta-spinner" }) : t('ta.remote.network.save'))))),
137
137
  held && mode !== 'open' && (React.createElement(settings_controls_1.Row, { inset: true, label: "", description: held }, mendable && (React.createElement("button", { type: "button", className: `ta-button${busy ? ' ta-busy' : ''}`, disabled: busy, title: t('ta.remote.network.isolateHint'), onClick: () => void run(isolate) },
138
138
  busy ? React.createElement("span", { className: "ta-spinner" }) : React.createElement(icon_1.Icon, { icon: lucide_react_1.ShieldCheck, size: 14 }),