@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.
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/esm/browser/apps/web-apps.d.ts +4 -0
- package/esm/browser/apps/web-apps.js +14 -3
- package/esm/browser/assistant/ta-hearing.d.ts +85 -0
- package/esm/browser/assistant/ta-hearing.js +272 -0
- package/esm/browser/components/auth-view.js +1 -1
- package/esm/browser/components/board.js +9 -1
- package/esm/browser/components/clipboard-link-host.d.ts +2 -0
- package/esm/browser/components/clipboard-link-host.js +27 -0
- package/esm/browser/components/cloud-network.js +1 -1
- package/esm/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/esm/browser/components/custom-provider-advanced.js +8 -8
- package/esm/browser/components/custom-provider-view.js +12 -12
- package/esm/browser/components/empty-state.d.ts +2 -1
- package/esm/browser/components/empty-state.js +6 -2
- package/esm/browser/components/folder-picker.js +2 -2
- package/esm/browser/components/gallery.js +8 -9
- package/esm/browser/components/hearing-host.d.ts +5 -0
- package/esm/browser/components/hearing-host.js +58 -0
- package/esm/browser/components/host-view.d.ts +1 -1
- package/esm/browser/components/link-dialog.js +4 -0
- package/esm/browser/components/loading.d.ts +3 -2
- package/esm/browser/components/loading.js +7 -3
- package/esm/browser/components/markdown.d.ts +3 -1
- package/esm/browser/components/markdown.js +55 -10
- package/esm/browser/components/media.d.ts +10 -4
- package/esm/browser/components/media.js +60 -14
- package/esm/browser/components/people-picker.d.ts +17 -0
- package/esm/browser/components/people-picker.js +129 -0
- package/esm/browser/components/relay-view.js +1 -1
- package/esm/browser/components/settings-parts.js +2 -0
- package/esm/browser/components/share-dialog.d.ts +2 -2
- package/esm/browser/components/share-dialog.js +7 -4
- package/esm/browser/components/share-friends.js +3 -10
- package/esm/browser/components/share-item-sheet.d.ts +12 -0
- package/esm/browser/components/share-item-sheet.js +39 -0
- package/esm/browser/components/share-sheet.d.ts +9 -2
- package/esm/browser/components/share-sheet.js +5 -4
- package/esm/browser/components/sign-in-setup.js +4 -4
- package/esm/browser/components/trusted-domains.js +1 -1
- package/esm/browser/components/view-room.d.ts +25 -0
- package/esm/browser/components/view-room.js +136 -0
- package/esm/browser/components/voice-services.js +6 -6
- package/esm/browser/device/device-protocol.d.ts +9 -6
- package/esm/browser/device/device-protocol.js +7 -4
- package/esm/browser/device/launch-screen.d.ts +11 -1
- package/esm/browser/device/launch-screen.js +22 -4
- package/esm/browser/extension/share-sheet-compat.d.ts +2 -0
- package/esm/browser/extension/share-sheet-compat.js +12 -2
- package/esm/browser/extension/web-api-code.d.ts +11 -0
- package/esm/browser/extension/web-api-components.d.ts +8 -1
- package/esm/browser/extension/web-api-contributions.d.ts +30 -1
- package/esm/browser/extension/web-api-desktop.d.ts +2 -1
- package/esm/browser/extension/web-api-file-views.d.ts +38 -0
- package/esm/browser/extension/web-api-file-views.js +2 -0
- package/esm/browser/extension/web-api-host.d.ts +47 -0
- package/esm/browser/extension/web-api-host.js +3 -0
- package/esm/browser/extension/web-api-menus.d.ts +46 -0
- package/esm/browser/extension/web-api-partners.d.ts +58 -1
- package/esm/browser/extension/web-api-spec.js +7 -0
- package/esm/browser/extension/web-extension-api.d.ts +10 -10
- package/esm/browser/extension/web-extension-context.d.ts +2 -8
- package/esm/browser/extension/web-extension-context.js +14 -39
- package/esm/browser/extension/web-extension-marks.d.ts +10 -0
- package/esm/browser/extension/web-extension-marks.js +29 -0
- package/esm/browser/extension/web-extension-protocol.d.ts +11 -1
- package/esm/browser/extension/web-extension-protocol.js +3 -0
- package/esm/browser/extension/web-extension-run.d.ts +15 -2
- package/esm/browser/extension/web-extension-run.js +77 -0
- package/esm/browser/extension/web-extensions-running.d.ts +5 -1
- package/esm/browser/extension/web-extensions-running.js +16 -0
- package/esm/browser/extension/web-extensions.d.ts +2 -1
- package/esm/browser/extension/web-extensions.js +3 -0
- package/esm/browser/extension/web-home.js +3 -1
- package/esm/browser/extension/web-host-values.d.ts +66 -0
- package/esm/browser/extension/web-host-values.js +191 -0
- package/esm/browser/extension/web-hosts.d.ts +7 -2
- package/esm/browser/extension/web-hosts.js +16 -4
- package/esm/browser/extension/web-share-ui.d.ts +7 -0
- package/esm/browser/extension/web-share-ui.js +15 -0
- package/esm/browser/extension/web-share.d.ts +18 -0
- package/esm/browser/extension/web-share.js +42 -0
- package/esm/browser/i18n/en/chat.d.ts +10 -0
- package/esm/browser/i18n/en/chat.js +10 -0
- package/esm/browser/i18n/en/common.d.ts +23 -0
- package/esm/browser/i18n/en/common.js +23 -0
- package/esm/browser/i18n/en/discover.d.ts +7 -0
- package/esm/browser/i18n/en/discover.js +7 -0
- package/esm/browser/i18n/en/settings.d.ts +2 -0
- package/esm/browser/i18n/en/settings.js +2 -0
- package/esm/browser/i18n/ja/chat.js +10 -0
- package/esm/browser/i18n/ja/common.js +23 -0
- package/esm/browser/i18n/ja/discover.js +7 -0
- package/esm/browser/i18n/ja/settings.js +2 -0
- package/esm/browser/i18n/locales.d.ts +43 -1
- package/esm/browser/i18n/messages.d.ts +42 -0
- package/esm/browser/i18n/zh/chat.js +10 -0
- package/esm/browser/i18n/zh/common.js +23 -0
- package/esm/browser/i18n/zh/discover.js +7 -0
- package/esm/browser/i18n/zh/settings.js +2 -0
- package/esm/browser/i18n/zh-tw/chat.js +10 -0
- package/esm/browser/i18n/zh-tw/common.js +23 -0
- package/esm/browser/i18n/zh-tw/discover.js +7 -0
- package/esm/browser/i18n/zh-tw/settings.js +2 -0
- package/esm/browser/launch-art/art-palette.d.ts +41 -0
- package/esm/browser/launch-art/art-palette.js +72 -0
- package/esm/browser/launch-art/cyclic-automaton.d.ts +45 -0
- package/esm/browser/launch-art/cyclic-automaton.js +176 -0
- package/esm/browser/launch-art/fractal-tree.d.ts +43 -0
- package/esm/browser/launch-art/fractal-tree.js +48 -0
- package/esm/browser/launch-art/launch-art.d.ts +98 -0
- package/esm/browser/launch-art/launch-art.js +420 -0
- package/esm/browser/launch-art/launch-sky.d.ts +66 -0
- package/esm/browser/launch-art/launch-sky.js +153 -0
- package/esm/browser/links/clipboard-links.d.ts +89 -0
- package/esm/browser/links/clipboard-links.js +303 -0
- package/esm/browser/links/link-text.d.ts +29 -0
- package/esm/browser/links/link-text.js +97 -0
- package/esm/browser/links/links-protocol.d.ts +12 -1
- package/esm/browser/links/links.d.ts +8 -2
- package/esm/browser/links/links.js +33 -3
- package/esm/browser/markdown/code-renderers.d.ts +4 -0
- package/esm/browser/markdown/code-renderers.js +4 -0
- package/esm/browser/partners/group-picker.js +23 -29
- package/esm/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/esm/browser/sandbox/work/work-senses.js +1 -1
- package/esm/browser/settings/settings-protocol.d.ts +2 -0
- package/esm/browser/settings/settings-protocol.js +2 -0
- package/esm/browser/style/base.d.ts +1 -1
- package/esm/browser/style/base.js +10 -6
- package/esm/browser/style/chat-list.d.ts +1 -1
- package/esm/browser/style/chat-list.js +28 -15
- package/esm/browser/style/conversation-column.d.ts +1 -1
- package/esm/browser/style/conversation.d.ts +1 -1
- package/esm/browser/style/conversation.js +29 -2
- package/esm/browser/style/dialogs.d.ts +1 -1
- package/esm/browser/style/dialogs.js +2 -5
- package/esm/browser/style/forms.d.ts +5 -0
- package/esm/browser/style/forms.js +65 -0
- package/esm/browser/style/layout.d.ts +1 -1
- package/esm/browser/style/pages.d.ts +1 -1
- package/esm/browser/style/pages.js +14 -24
- package/esm/browser/style/phone.d.ts +1 -1
- package/esm/browser/style/shared.d.ts +1 -1
- package/esm/browser/style/shell.d.ts +1 -1
- package/esm/browser/style/shell.js +1 -6
- package/esm/browser/style/surfaces.d.ts +1 -1
- package/esm/browser/style/surfaces.js +0 -6
- package/esm/browser/style/tasks.d.ts +1 -1
- package/esm/browser/style.js +2 -0
- package/esm/browser/util/markdown.d.ts +45 -3
- package/esm/browser/util/markdown.js +67 -11
- package/esm/browser/util/voice.d.ts +18 -0
- package/esm/browser/util/voice.js +111 -3
- package/esm/browser/workbench-protocol.d.ts +2 -0
- package/esm/browser/workbench-services.d.ts +2 -0
- package/esm/browser/workbench-services.js +5 -0
- package/esm/browser/workbench.js +5 -0
- package/lib/browser/apps/web-apps.d.ts +4 -0
- package/lib/browser/apps/web-apps.js +14 -3
- package/lib/browser/assistant/ta-hearing.d.ts +86 -0
- package/lib/browser/assistant/ta-hearing.js +277 -0
- package/lib/browser/components/auth-view.js +1 -1
- package/lib/browser/components/board.js +9 -1
- package/lib/browser/components/clipboard-link-host.d.ts +3 -0
- package/lib/browser/components/clipboard-link-host.js +63 -0
- package/lib/browser/components/cloud-network.js +1 -1
- package/lib/browser/components/cloud-sign-in-view.d.ts +1 -1
- package/lib/browser/components/custom-provider-advanced.js +8 -8
- package/lib/browser/components/custom-provider-view.js +12 -12
- package/lib/browser/components/empty-state.d.ts +2 -1
- package/lib/browser/components/empty-state.js +6 -2
- package/lib/browser/components/folder-picker.js +2 -2
- package/lib/browser/components/gallery.js +7 -8
- package/lib/browser/components/hearing-host.d.ts +6 -0
- package/lib/browser/components/hearing-host.js +94 -0
- package/lib/browser/components/host-view.d.ts +1 -1
- package/lib/browser/components/link-dialog.js +4 -0
- package/lib/browser/components/loading.d.ts +3 -2
- package/lib/browser/components/loading.js +7 -3
- package/lib/browser/components/markdown.d.ts +3 -1
- package/lib/browser/components/markdown.js +53 -8
- package/lib/browser/components/media.d.ts +10 -4
- package/lib/browser/components/media.js +61 -14
- package/lib/browser/components/people-picker.d.ts +18 -0
- package/lib/browser/components/people-picker.js +166 -0
- package/lib/browser/components/relay-view.js +1 -1
- package/lib/browser/components/settings-parts.js +2 -0
- package/lib/browser/components/share-dialog.d.ts +2 -2
- package/lib/browser/components/share-dialog.js +7 -4
- package/lib/browser/components/share-friends.js +3 -10
- package/lib/browser/components/share-item-sheet.d.ts +13 -0
- package/lib/browser/components/share-item-sheet.js +75 -0
- package/lib/browser/components/share-sheet.d.ts +9 -2
- package/lib/browser/components/share-sheet.js +5 -3
- package/lib/browser/components/sign-in-setup.js +4 -4
- package/lib/browser/components/trusted-domains.js +1 -1
- package/lib/browser/components/view-room.d.ts +26 -0
- package/lib/browser/components/view-room.js +173 -0
- package/lib/browser/components/voice-services.js +6 -6
- package/lib/browser/device/device-protocol.d.ts +9 -6
- package/lib/browser/device/device-protocol.js +7 -4
- package/lib/browser/device/launch-screen.d.ts +11 -1
- package/lib/browser/device/launch-screen.js +22 -4
- package/lib/browser/extension/share-sheet-compat.d.ts +2 -0
- package/lib/browser/extension/share-sheet-compat.js +13 -2
- package/lib/browser/extension/web-api-code.d.ts +11 -0
- package/lib/browser/extension/web-api-components.d.ts +8 -1
- package/lib/browser/extension/web-api-contributions.d.ts +30 -1
- package/lib/browser/extension/web-api-desktop.d.ts +2 -1
- package/lib/browser/extension/web-api-file-views.d.ts +39 -0
- package/lib/browser/extension/web-api-file-views.js +3 -0
- package/lib/browser/extension/web-api-host.d.ts +48 -0
- package/lib/browser/extension/web-api-host.js +4 -0
- package/lib/browser/extension/web-api-menus.d.ts +46 -0
- package/lib/browser/extension/web-api-partners.d.ts +58 -1
- package/lib/browser/extension/web-api-spec.js +7 -0
- package/lib/browser/extension/web-extension-api.d.ts +10 -10
- package/lib/browser/extension/web-extension-context.d.ts +2 -8
- package/lib/browser/extension/web-extension-context.js +14 -39
- package/lib/browser/extension/web-extension-marks.d.ts +11 -0
- package/lib/browser/extension/web-extension-marks.js +65 -0
- package/lib/browser/extension/web-extension-protocol.d.ts +11 -1
- package/lib/browser/extension/web-extension-protocol.js +3 -0
- package/lib/browser/extension/web-extension-run.d.ts +15 -2
- package/lib/browser/extension/web-extension-run.js +77 -0
- package/lib/browser/extension/web-extensions-running.d.ts +5 -1
- package/lib/browser/extension/web-extensions-running.js +16 -0
- package/lib/browser/extension/web-extensions.d.ts +2 -1
- package/lib/browser/extension/web-extensions.js +3 -0
- package/lib/browser/extension/web-home.js +3 -1
- package/lib/browser/extension/web-host-values.d.ts +67 -0
- package/lib/browser/extension/web-host-values.js +229 -0
- package/lib/browser/extension/web-hosts.d.ts +7 -2
- package/lib/browser/extension/web-hosts.js +16 -4
- package/lib/browser/extension/web-share-ui.d.ts +8 -0
- package/lib/browser/extension/web-share-ui.js +51 -0
- package/lib/browser/extension/web-share.d.ts +19 -0
- package/lib/browser/extension/web-share.js +45 -0
- package/lib/browser/i18n/en/chat.d.ts +10 -0
- package/lib/browser/i18n/en/chat.js +10 -0
- package/lib/browser/i18n/en/common.d.ts +23 -0
- package/lib/browser/i18n/en/common.js +23 -0
- package/lib/browser/i18n/en/discover.d.ts +7 -0
- package/lib/browser/i18n/en/discover.js +7 -0
- package/lib/browser/i18n/en/settings.d.ts +2 -0
- package/lib/browser/i18n/en/settings.js +2 -0
- package/lib/browser/i18n/ja/chat.js +10 -0
- package/lib/browser/i18n/ja/common.js +23 -0
- package/lib/browser/i18n/ja/discover.js +7 -0
- package/lib/browser/i18n/ja/settings.js +2 -0
- package/lib/browser/i18n/locales.d.ts +43 -1
- package/lib/browser/i18n/messages.d.ts +42 -0
- package/lib/browser/i18n/zh/chat.js +10 -0
- package/lib/browser/i18n/zh/common.js +23 -0
- package/lib/browser/i18n/zh/discover.js +7 -0
- package/lib/browser/i18n/zh/settings.js +2 -0
- package/lib/browser/i18n/zh-tw/chat.js +10 -0
- package/lib/browser/i18n/zh-tw/common.js +23 -0
- package/lib/browser/i18n/zh-tw/discover.js +7 -0
- package/lib/browser/i18n/zh-tw/settings.js +2 -0
- package/lib/browser/launch-art/art-palette.d.ts +42 -0
- package/lib/browser/launch-art/art-palette.js +76 -0
- package/lib/browser/launch-art/cyclic-automaton.d.ts +46 -0
- package/lib/browser/launch-art/cyclic-automaton.js +180 -0
- package/lib/browser/launch-art/fractal-tree.d.ts +44 -0
- package/lib/browser/launch-art/fractal-tree.js +52 -0
- package/lib/browser/launch-art/launch-art.d.ts +99 -0
- package/lib/browser/launch-art/launch-art.js +424 -0
- package/lib/browser/launch-art/launch-sky.d.ts +67 -0
- package/lib/browser/launch-art/launch-sky.js +157 -0
- package/lib/browser/links/clipboard-links.d.ts +90 -0
- package/lib/browser/links/clipboard-links.js +308 -0
- package/lib/browser/links/link-text.d.ts +30 -0
- package/lib/browser/links/link-text.js +100 -0
- package/lib/browser/links/links-protocol.d.ts +12 -1
- package/lib/browser/links/links.d.ts +8 -2
- package/lib/browser/links/links.js +33 -3
- package/lib/browser/markdown/code-renderers.d.ts +4 -0
- package/lib/browser/markdown/code-renderers.js +5 -1
- package/lib/browser/partners/group-picker.js +23 -29
- package/lib/browser/sandbox/sandbox-runtime-code.js +1 -1
- package/lib/browser/sandbox/work/work-senses.js +1 -1
- package/lib/browser/settings/settings-protocol.d.ts +2 -0
- package/lib/browser/settings/settings-protocol.js +2 -0
- package/lib/browser/style/base.d.ts +1 -1
- package/lib/browser/style/base.js +10 -6
- package/lib/browser/style/chat-list.d.ts +1 -1
- package/lib/browser/style/chat-list.js +28 -15
- package/lib/browser/style/conversation-column.d.ts +1 -1
- package/lib/browser/style/conversation.d.ts +1 -1
- package/lib/browser/style/conversation.js +29 -2
- package/lib/browser/style/dialogs.d.ts +1 -1
- package/lib/browser/style/dialogs.js +2 -5
- package/lib/browser/style/forms.d.ts +6 -0
- package/lib/browser/style/forms.js +68 -0
- package/lib/browser/style/layout.d.ts +1 -1
- package/lib/browser/style/pages.d.ts +1 -1
- package/lib/browser/style/pages.js +14 -24
- package/lib/browser/style/phone.d.ts +1 -1
- package/lib/browser/style/shared.d.ts +1 -1
- package/lib/browser/style/shell.d.ts +1 -1
- package/lib/browser/style/shell.js +1 -6
- package/lib/browser/style/surfaces.d.ts +1 -1
- package/lib/browser/style/surfaces.js +0 -6
- package/lib/browser/style/tasks.d.ts +1 -1
- package/lib/browser/style.js +2 -0
- package/lib/browser/util/markdown.d.ts +45 -3
- package/lib/browser/util/markdown.js +68 -12
- package/lib/browser/util/voice.d.ts +18 -0
- package/lib/browser/util/voice.js +111 -3
- package/lib/browser/workbench-protocol.d.ts +2 -0
- package/lib/browser/workbench-services.d.ts +2 -0
- package/lib/browser/workbench-services.js +5 -0
- package/lib/browser/workbench.js +5 -0
- package/package.json +8 -8
- package/public/launch.svg +3 -3
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { LinkUtil } from './link.js';
|
|
2
|
+
export const CALLOUT_KINDS = ['note', 'tip', 'important', 'warning', 'caution'];
|
|
3
|
+
export const MARKDOWN_TINTS = ['red', 'orange', 'yellow', 'green', 'blue', 'purple', 'gray'];
|
|
2
4
|
const FENCE = /^\s*(`{3,}|~{3,})\s*([\w+-]*)/;
|
|
3
5
|
const HEADING = /^(#{1,6})\s+(.*)$/;
|
|
4
6
|
const RULE = /^\s*([-*_])(\s*\1){2,}\s*$/;
|
|
@@ -35,6 +37,11 @@ const IMAGE = /^!\[([^\]]*)\]\(\s*(?:<([^>]+)>|([^)\s]+))(?:\s+"[^"]*")?\s*\)/;
|
|
|
35
37
|
/** A target may hold parentheses in pairs, as `https://en.wikipedia.org/wiki/A_(b)`. */
|
|
36
38
|
const LINK = /^\[([^\]]+)\]\(\s*(?:<([^>]+)>|((?:[^()\s]|\([^()\s]*\))+))(?:\s+"[^"]*")?\s*\)/;
|
|
37
39
|
const AUTOLINK = /^<(https?:\/\/[^>\s]+)>/i;
|
|
40
|
+
const TINTED = /^\[([^\]]+)\]\{\.([a-z]+)\}/;
|
|
41
|
+
const NOTE_MARK = /^\[\^([^\]\s]{1,24})\](?!:)/;
|
|
42
|
+
const FOOTNOTE = /^\[\^([^\]\s]{1,24})\]:\s+(.*)$/;
|
|
43
|
+
const CALLOUT = /^\[!(note|tip|important|warning|caution)\][ \t]*(.*)$/i;
|
|
44
|
+
const TASK = /^\[( |x|X)\]\s+/;
|
|
38
45
|
/** What may come right before a bare URL: not a letter, a digit or a part of a path. */
|
|
39
46
|
const BEFORE_URL = /[\w/.@:-]/;
|
|
40
47
|
/** `$x$`: no space inside the dollars, no digit after the closing one, so that `$5 and $10` stays text. */
|
|
@@ -52,8 +59,8 @@ const PENDING_MATH = /(?:(?<![\\$])\$(?=[^\s$\d])[^$]*|\\\((?![\s\S]*\\\)).*)$/;
|
|
|
52
59
|
/** Cells of a table longer than this (a CJK character counts twice) wrap; shorter ones keep to one line. */
|
|
53
60
|
const LONG_CELL = 24;
|
|
54
61
|
/**
|
|
55
|
-
* The markdown models write: fenced code, headings, lists, quotes
|
|
56
|
-
* images and videos, and TeX between `$`, `$$`, `\\(\\)` or `\\[\\]`. Its output is data for React to
|
|
62
|
+
* The markdown models write: fenced code, headings, lists (of tasks too), quotes (boxes of a kind too), tables,
|
|
63
|
+
* footnotes, emphasis, struck out and highlighted words, words in a colour, code spans, links, images and videos, and TeX between `$`, `$$`, `\\(\\)` or `\\[\\]`. Its output is data for React to
|
|
57
64
|
* render, never HTML, so text from the model cannot inject markup; links keep only http(s) and mailto
|
|
58
65
|
* URLs and paths of files (LinkUtil.parse), and URLs in the text are links too. An unclosed fence or
|
|
59
66
|
* formula, as while a reply streams, runs to the end.
|
|
@@ -61,7 +68,7 @@ const LONG_CELL = 24;
|
|
|
61
68
|
export var MarkdownUtil;
|
|
62
69
|
(function (MarkdownUtil) {
|
|
63
70
|
function blocks(source) {
|
|
64
|
-
var _a, _b;
|
|
71
|
+
var _a, _b, _c;
|
|
65
72
|
const lines = source.replace(/\r\n?/g, '\n').split('\n');
|
|
66
73
|
const blocks = [];
|
|
67
74
|
let paragraph = [];
|
|
@@ -117,10 +124,27 @@ export var MarkdownUtil;
|
|
|
117
124
|
quote.push(lines[i].trimStart().replace(/^>\s?/, ''));
|
|
118
125
|
}
|
|
119
126
|
i--;
|
|
120
|
-
|
|
127
|
+
const callout = CALLOUT.exec((_a = quote[0]) !== null && _a !== void 0 ? _a : '');
|
|
128
|
+
blocks.push(callout
|
|
129
|
+
? {
|
|
130
|
+
type: 'quote',
|
|
131
|
+
text: quote.slice(1).join('\n'),
|
|
132
|
+
callout: callout[1].toLowerCase(),
|
|
133
|
+
...(callout[2].trim() ? { title: callout[2].trim() } : {}),
|
|
134
|
+
}
|
|
135
|
+
: { type: 'quote', text: quote.join('\n') });
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
138
|
+
const footnote = paragraph.length ? null : FOOTNOTE.exec(line.trim());
|
|
139
|
+
if (footnote) {
|
|
140
|
+
let text = footnote[2];
|
|
141
|
+
for (; i + 1 < lines.length && /^\s{2,}\S/.test(lines[i + 1]); i++) {
|
|
142
|
+
text += `\n${lines[i + 1].trim()}`;
|
|
143
|
+
}
|
|
144
|
+
blocks.push({ type: 'footnote', label: footnote[1], text });
|
|
121
145
|
continue;
|
|
122
146
|
}
|
|
123
|
-
const item = (
|
|
147
|
+
const item = (_b = BULLET.exec(line)) !== null && _b !== void 0 ? _b : NUMBERED.exec(line);
|
|
124
148
|
if (item) {
|
|
125
149
|
flush();
|
|
126
150
|
const ordered = !BULLET.test(line);
|
|
@@ -142,7 +166,7 @@ export var MarkdownUtil;
|
|
|
142
166
|
blocks.push({ type: 'list', ordered, items });
|
|
143
167
|
continue;
|
|
144
168
|
}
|
|
145
|
-
if (line.includes('|') && TABLE_SEPARATOR.test((
|
|
169
|
+
if (line.includes('|') && TABLE_SEPARATOR.test((_c = lines[i + 1]) !== null && _c !== void 0 ? _c : '') && !paragraph.length) {
|
|
146
170
|
const header = cells(line);
|
|
147
171
|
const marks = cells(lines[i + 1]);
|
|
148
172
|
const align = header.map((_, column) => { var _a; return alignOf((_a = marks[column]) !== null && _a !== void 0 ? _a : ''); });
|
|
@@ -183,8 +207,8 @@ export var MarkdownUtil;
|
|
|
183
207
|
}
|
|
184
208
|
MarkdownUtil.streaming = streaming;
|
|
185
209
|
function settled(text) {
|
|
186
|
-
var _a
|
|
187
|
-
var
|
|
210
|
+
var _a;
|
|
211
|
+
var _b;
|
|
188
212
|
if (openFence(text)) {
|
|
189
213
|
return text;
|
|
190
214
|
}
|
|
@@ -196,11 +220,13 @@ export var MarkdownUtil;
|
|
|
196
220
|
line = line.replace(PENDING_LINK, '').replace(PENDING_MATH, '');
|
|
197
221
|
// A mark cut in two at the end (one `*` of `**`): as if it had not come.
|
|
198
222
|
line = line.replace(/[*`]+$/, '');
|
|
199
|
-
if (((
|
|
223
|
+
if (((_b = (_a = line.match(/`/g)) === null || _a === void 0 ? void 0 : _a.length) !== null && _b !== void 0 ? _b : 0) % 2) {
|
|
200
224
|
line += '`';
|
|
201
225
|
}
|
|
202
|
-
|
|
203
|
-
line
|
|
226
|
+
for (const mark of ['**', '~~', '==']) {
|
|
227
|
+
if ((line.replace(/`[^`]*`/g, '').split(mark).length - 1) % 2) {
|
|
228
|
+
line += mark;
|
|
229
|
+
}
|
|
204
230
|
}
|
|
205
231
|
return text.slice(0, start) + line;
|
|
206
232
|
}
|
|
@@ -325,6 +351,30 @@ export var MarkdownUtil;
|
|
|
325
351
|
i += em[0].length;
|
|
326
352
|
continue;
|
|
327
353
|
}
|
|
354
|
+
const struck = rest.startsWith('~~') ? /^~~(?=\S)([\s\S]*?\S)~~/.exec(rest) : null;
|
|
355
|
+
if (struck) {
|
|
356
|
+
push({ type: 'del', children: inline(struck[1]) });
|
|
357
|
+
i += struck[0].length;
|
|
358
|
+
continue;
|
|
359
|
+
}
|
|
360
|
+
const marked = rest.startsWith('==') ? /^==(?=[^\s=])([\s\S]*?[^\s=])==/.exec(rest) : null;
|
|
361
|
+
if (marked) {
|
|
362
|
+
push({ type: 'mark', children: inline(marked[1]) });
|
|
363
|
+
i += marked[0].length;
|
|
364
|
+
continue;
|
|
365
|
+
}
|
|
366
|
+
const note = text[i] === '[' ? NOTE_MARK.exec(rest) : null;
|
|
367
|
+
if (note) {
|
|
368
|
+
push({ type: 'note', label: note[1] });
|
|
369
|
+
i += note[0].length;
|
|
370
|
+
continue;
|
|
371
|
+
}
|
|
372
|
+
const tinted = text[i] === '[' ? TINTED.exec(rest) : null;
|
|
373
|
+
if (tinted && MARKDOWN_TINTS.includes(tinted[2])) {
|
|
374
|
+
push({ type: 'tint', tint: tinted[2], children: inline(tinted[1]) });
|
|
375
|
+
i += tinted[0].length;
|
|
376
|
+
continue;
|
|
377
|
+
}
|
|
328
378
|
const link = text[i] === '[' ? LINK.exec(rest) : null;
|
|
329
379
|
if (link) {
|
|
330
380
|
const href = (_d = link[2]) !== null && _d !== void 0 ? _d : link[3];
|
|
@@ -362,6 +412,12 @@ export var MarkdownUtil;
|
|
|
362
412
|
return out;
|
|
363
413
|
}
|
|
364
414
|
MarkdownUtil.inline = inline;
|
|
415
|
+
/** An item of a list of tasks (`[ ] to do`, `[x] done`): whether it is done, and its words; undefined for another item. */
|
|
416
|
+
function task(item) {
|
|
417
|
+
const mark = TASK.exec(item);
|
|
418
|
+
return mark ? { done: mark[1] !== ' ', text: item.slice(mark[0].length) } : undefined;
|
|
419
|
+
}
|
|
420
|
+
MarkdownUtil.task = task;
|
|
365
421
|
/**
|
|
366
422
|
* What a target of an image shows: by the type of a data URL, else by the extension of its path; an
|
|
367
423
|
* http(s) URL or a path without a known extension is taken for an image. Undefined for targets that
|
|
@@ -26,6 +26,24 @@ export declare namespace Voice {
|
|
|
26
26
|
* At most 100 are taken, with the directory and the names a box adds.
|
|
27
27
|
*/
|
|
28
28
|
const VOCABULARY: readonly string[];
|
|
29
|
+
/**
|
|
30
|
+
* Where the recognizer of the device cannot listen (there is none, as in the web-view of Android, or it is not
|
|
31
|
+
* allowed: speech recognition refused, Siri and dictation off), Ta does: a voice service of Settings, or the
|
|
32
|
+
* model of the computer (TaHearing, docs/design/ta-voice.md 11). It only needs the microphone.
|
|
33
|
+
*/
|
|
34
|
+
interface Fallback {
|
|
35
|
+
/** It may listen now: the page is connected and has a microphone. */
|
|
36
|
+
available(): boolean;
|
|
37
|
+
listen(language: string, onText: (text: string, final: boolean) => void, onEnd: (error?: string) => void, options: ListenOptions): Listening | undefined;
|
|
38
|
+
}
|
|
39
|
+
/** A recognizer of the device that ends this soon, unasked and having heard nothing, cannot listen. */
|
|
40
|
+
const QUICK_END_MS = 700;
|
|
41
|
+
/** A recognizer of the device that did not take the microphone this soon, nor said why, cannot listen. */
|
|
42
|
+
const AUDIO_START_MS = 2500;
|
|
43
|
+
/** Sets what listens where the device cannot; returns what takes it away. */
|
|
44
|
+
function setFallback(given: Fallback): () => void;
|
|
45
|
+
/** A failure of the device's recognizer that trying again would not mend, where Ta listens instead. */
|
|
46
|
+
function fallsBack(error: string): boolean;
|
|
29
47
|
/**
|
|
30
48
|
* Whether the page can listen. Not in WeChat's mini program, on a phone or a computer: its web-view has the
|
|
31
49
|
* recognition of WebKit or Chromium, and always refuses it (`not-allowed`), with nowhere for the user to allow it.
|
|
@@ -84,6 +84,29 @@ export var Voice;
|
|
|
84
84
|
}
|
|
85
85
|
return DesktopUtil.speech();
|
|
86
86
|
}
|
|
87
|
+
let fallback;
|
|
88
|
+
/** A recognizer of the device that ends this soon, unasked and having heard nothing, cannot listen. */
|
|
89
|
+
Voice.QUICK_END_MS = 700;
|
|
90
|
+
/** A recognizer of the device that did not take the microphone this soon, nor said why, cannot listen. */
|
|
91
|
+
Voice.AUDIO_START_MS = 2500;
|
|
92
|
+
/** The device's recognizer failed so that it will again: Ta listens from then on, till the page loads again. */
|
|
93
|
+
let deviceFails = false;
|
|
94
|
+
/** Sets what listens where the device cannot; returns what takes it away. */
|
|
95
|
+
function setFallback(given) {
|
|
96
|
+
fallback = given;
|
|
97
|
+
deviceFails = false;
|
|
98
|
+
return () => {
|
|
99
|
+
if (fallback === given) {
|
|
100
|
+
fallback = undefined;
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
Voice.setFallback = setFallback;
|
|
105
|
+
/** A failure of the device's recognizer that trying again would not mend, where Ta listens instead. */
|
|
106
|
+
function fallsBack(error) {
|
|
107
|
+
return ['not-allowed', 'service-not-allowed', 'network', 'language-not-supported', 'unavailable'].includes(error);
|
|
108
|
+
}
|
|
109
|
+
Voice.fallsBack = fallsBack;
|
|
87
110
|
/**
|
|
88
111
|
* Whether the page can listen. Not in WeChat's mini program, on a phone or a computer: its web-view has the
|
|
89
112
|
* recognition of WebKit or Chromium, and always refuses it (`not-allowed`), with nowhere for the user to allow it.
|
|
@@ -92,7 +115,7 @@ export var Voice;
|
|
|
92
115
|
if (MiniProgram.inside()) {
|
|
93
116
|
return false;
|
|
94
117
|
}
|
|
95
|
-
return nativeSpeech() !== undefined || recognitionClass() !== undefined;
|
|
118
|
+
return nativeSpeech() !== undefined || recognitionClass() !== undefined || (fallback === null || fallback === void 0 ? void 0 : fallback.available()) === true;
|
|
96
119
|
}
|
|
97
120
|
Voice.canListen = canListen;
|
|
98
121
|
/** The user, the system or the browser does not let the page listen: the microphone or speech recognition is not allowed. */
|
|
@@ -154,8 +177,86 @@ export var Voice;
|
|
|
154
177
|
* and the words to expect; elsewhere the browser's.
|
|
155
178
|
*/
|
|
156
179
|
function listen(language, onText, onEnd, options = {}) {
|
|
180
|
+
const ta = (fallback === null || fallback === void 0 ? void 0 : fallback.available()) ? fallback : undefined;
|
|
181
|
+
if (ta && (deviceFails || !canDeviceListen())) {
|
|
182
|
+
return ta.listen(language, onText, onEnd, options);
|
|
183
|
+
}
|
|
184
|
+
if (!ta) {
|
|
185
|
+
return listenOnDevice(language, onText, onEnd, options);
|
|
186
|
+
}
|
|
187
|
+
// The device first; failing before it heard a word, in a way it would again, Ta listens in its place.
|
|
188
|
+
let heard = false;
|
|
189
|
+
let current;
|
|
190
|
+
let stopped = false;
|
|
191
|
+
/** The device's listening was given up for Ta's: what it says after is not heard. */
|
|
192
|
+
let replaced = false;
|
|
193
|
+
let waiting;
|
|
194
|
+
let audio = false;
|
|
195
|
+
const started = Date.now();
|
|
196
|
+
const takeOver = (error) => {
|
|
197
|
+
replaced = true;
|
|
198
|
+
clearTimeout(waiting);
|
|
199
|
+
deviceFails = true;
|
|
200
|
+
current = ta.listen(language, onText, onEnd, options);
|
|
201
|
+
if (!current) {
|
|
202
|
+
onEnd(error);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
const device = listenOnDevice(language, (text, final) => {
|
|
206
|
+
if (replaced) {
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
heard || (heard = text.trim() !== '');
|
|
210
|
+
onText(text, final);
|
|
211
|
+
}, given => {
|
|
212
|
+
if (replaced) {
|
|
213
|
+
return;
|
|
214
|
+
}
|
|
215
|
+
clearTimeout(waiting);
|
|
216
|
+
// Ended at once having heard nothing, unasked: a recognizer that is there but cannot (a web-view's).
|
|
217
|
+
const error = given !== null && given !== void 0 ? given : (!heard && !stopped && Date.now() - started < Voice.QUICK_END_MS ? 'unavailable' : undefined);
|
|
218
|
+
if (error && !heard && !stopped && fallsBack(error) && ta.available()) {
|
|
219
|
+
takeOver(error);
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
onEnd(given);
|
|
223
|
+
}, options, () => {
|
|
224
|
+
audio = true;
|
|
225
|
+
clearTimeout(waiting);
|
|
226
|
+
});
|
|
227
|
+
current = device;
|
|
228
|
+
if (audio) {
|
|
229
|
+
return device;
|
|
230
|
+
}
|
|
231
|
+
// Nor did it take the microphone in a while: the web-view of an Android with no service of recognition waits
|
|
232
|
+
// for one without end, saying nothing.
|
|
233
|
+
waiting = setTimeout(() => {
|
|
234
|
+
var _a;
|
|
235
|
+
if (!audio && !heard && !stopped && !replaced && ta.available()) {
|
|
236
|
+
(_a = device === null || device === void 0 ? void 0 : device.abort) === null || _a === void 0 ? void 0 : _a.call(device);
|
|
237
|
+
takeOver('unavailable');
|
|
238
|
+
}
|
|
239
|
+
}, Voice.AUDIO_START_MS);
|
|
240
|
+
return current
|
|
241
|
+
? {
|
|
242
|
+
stop: () => {
|
|
243
|
+
stopped = true;
|
|
244
|
+
clearTimeout(waiting);
|
|
245
|
+
current === null || current === void 0 ? void 0 : current.stop();
|
|
246
|
+
},
|
|
247
|
+
}
|
|
248
|
+
: ta.listen(language, onText, onEnd, options);
|
|
249
|
+
}
|
|
250
|
+
Voice.listen = listen;
|
|
251
|
+
function canDeviceListen() {
|
|
252
|
+
return !MiniProgram.inside() && (nativeSpeech() !== undefined || recognitionClass() !== undefined);
|
|
253
|
+
}
|
|
254
|
+
/** Listens with the recognizer of the device alone. */
|
|
255
|
+
function listenOnDevice(language, onText, onEnd, options, onAudio) {
|
|
157
256
|
const native = nativeSpeech();
|
|
158
257
|
if (native) {
|
|
258
|
+
// Apple's recognizer of the app says why it cannot listen at once.
|
|
259
|
+
onAudio === null || onAudio === void 0 ? void 0 : onAudio();
|
|
159
260
|
return listenNatively(native, language, onText, onEnd, options);
|
|
160
261
|
}
|
|
161
262
|
const Recognition = recognitionClass();
|
|
@@ -182,10 +283,17 @@ export var Voice;
|
|
|
182
283
|
};
|
|
183
284
|
recognition.onerror = event => end(event.error === 'no-speech' ? undefined : event.error);
|
|
184
285
|
recognition.onend = () => end();
|
|
286
|
+
recognition.onaudiostart = () => onAudio === null || onAudio === void 0 ? void 0 : onAudio();
|
|
185
287
|
recognition.start();
|
|
186
|
-
return {
|
|
288
|
+
return {
|
|
289
|
+
stop: () => recognition.stop(),
|
|
290
|
+
abort: () => {
|
|
291
|
+
var _a;
|
|
292
|
+
ended = true;
|
|
293
|
+
(_a = recognition.abort) === null || _a === void 0 ? void 0 : _a.call(recognition);
|
|
294
|
+
},
|
|
295
|
+
};
|
|
187
296
|
}
|
|
188
|
-
Voice.listen = listen;
|
|
189
297
|
function listenNatively(native, language, onText, onEnd, options) {
|
|
190
298
|
const id = crypto.randomUUID();
|
|
191
299
|
let ended = false;
|
|
@@ -199,6 +199,8 @@ export interface TaWorkbench {
|
|
|
199
199
|
onReconnect(listener: () => void): () => void;
|
|
200
200
|
/** Keys of the data of a package that changed (TaClient.onExtensionData), `cwd` for those of a directory; the listener stays across reconnections. */
|
|
201
201
|
onExtensionData(listener: (name: string, keys: string[], cwd?: string) => void): () => void;
|
|
202
|
+
/** What the server side of a package says changed (TaClient.onHostChanged); the listener stays across reconnections. */
|
|
203
|
+
onHostChanged(listener: (name: string, topics: string[]) => void): () => void;
|
|
202
204
|
/** What happens during the sign-ins of this page (TaAuthServer.login); the listener stays across reconnections. */
|
|
203
205
|
onAuthEvent(listener: (loginId: string, event: TaAuthEvent) => void): () => void;
|
|
204
206
|
/**
|
|
@@ -9,6 +9,7 @@ export declare abstract class WorkbenchServices {
|
|
|
9
9
|
protected readonly terminalListeners: Set<(terminalId: string, data: string, exitCode?: number) => void>;
|
|
10
10
|
protected readonly reconnectListeners: Set<() => void>;
|
|
11
11
|
protected readonly extensionDataListeners: Set<(name: string, keys: string[], cwd?: string) => void>;
|
|
12
|
+
protected readonly hostChangedListeners: Set<(name: string, topics: string[]) => void>;
|
|
12
13
|
protected readonly authListeners: Set<(loginId: string, event: TaAuthEvent) => void>;
|
|
13
14
|
protected readonly remoteListeners: Set<(event: TaRemoteEvent) => void>;
|
|
14
15
|
protected readonly voiceListeners: Set<(event: TaVoiceEvent) => void>;
|
|
@@ -43,6 +44,7 @@ export declare abstract class WorkbenchServices {
|
|
|
43
44
|
onTerminalData(listener: (terminalId: string, data: string, exitCode?: number) => void): () => void;
|
|
44
45
|
onReconnect(listener: () => void): () => void;
|
|
45
46
|
onExtensionData(listener: (name: string, keys: string[], cwd?: string) => void): () => void;
|
|
47
|
+
onHostChanged(listener: (name: string, topics: string[]) => void): () => void;
|
|
46
48
|
onAuthEvent(listener: (loginId: string, event: TaAuthEvent) => void): () => void;
|
|
47
49
|
onRemoteEvent(listener: (event: TaRemoteEvent) => void): () => void;
|
|
48
50
|
onRoomEvent(listener: (event: TaRoomEvent) => void, options?: {
|
|
@@ -5,6 +5,7 @@ export class WorkbenchServices {
|
|
|
5
5
|
this.terminalListeners = new Set();
|
|
6
6
|
this.reconnectListeners = new Set();
|
|
7
7
|
this.extensionDataListeners = new Set();
|
|
8
|
+
this.hostChangedListeners = new Set();
|
|
8
9
|
this.authListeners = new Set();
|
|
9
10
|
this.remoteListeners = new Set();
|
|
10
11
|
this.voiceListeners = new Set();
|
|
@@ -113,6 +114,10 @@ export class WorkbenchServices {
|
|
|
113
114
|
this.extensionDataListeners.add(listener);
|
|
114
115
|
return () => this.extensionDataListeners.delete(listener);
|
|
115
116
|
}
|
|
117
|
+
onHostChanged(listener) {
|
|
118
|
+
this.hostChangedListeners.add(listener);
|
|
119
|
+
return () => this.hostChangedListeners.delete(listener);
|
|
120
|
+
}
|
|
116
121
|
onAuthEvent(listener) {
|
|
117
122
|
this.authListeners.add(listener);
|
|
118
123
|
return () => this.authListeners.delete(listener);
|
package/esm/browser/workbench.js
CHANGED
|
@@ -250,6 +250,11 @@ let TaWorkbenchImpl = class TaWorkbenchImpl extends WorkbenchHosts {
|
|
|
250
250
|
listener(name, keys, cwd);
|
|
251
251
|
}
|
|
252
252
|
});
|
|
253
|
+
connection.onHostChanged((name, topics) => {
|
|
254
|
+
for (const listener of this.hostChangedListeners) {
|
|
255
|
+
listener(name, topics);
|
|
256
|
+
}
|
|
257
|
+
});
|
|
253
258
|
connection.onAuthEvent((loginId, event) => {
|
|
254
259
|
for (const listener of this.authListeners) {
|
|
255
260
|
listener(loginId, event);
|
|
@@ -10,6 +10,8 @@ export interface WebAppsHost {
|
|
|
10
10
|
readonly notices: TaNotices;
|
|
11
11
|
/** Drawn for a page without a glyph of its own, or one a sandbox draws. */
|
|
12
12
|
readonly fallbackIcon: WebIcon;
|
|
13
|
+
/** The extension it is given to stopped: it installs, opens and removes nothing more (WebExtensionContext). */
|
|
14
|
+
stopped?(): boolean;
|
|
13
15
|
}
|
|
14
16
|
/**
|
|
15
17
|
* `ui.apps` (docs/design/ta-install-as-app.md 2): a page installed with the title and the tile the launcher shows it
|
|
@@ -26,5 +28,7 @@ export declare class TaWebApps implements WebApps {
|
|
|
26
28
|
install(id: string): Promise<void>;
|
|
27
29
|
remove(id: string): Promise<void>;
|
|
28
30
|
open(id: string): Promise<void>;
|
|
31
|
+
/** What acts for the user: refused once the extension stopped. */
|
|
32
|
+
protected live(): void;
|
|
29
33
|
}
|
|
30
34
|
//# sourceMappingURL=web-apps.d.ts.map
|
|
@@ -20,13 +20,15 @@ class TaWebApps {
|
|
|
20
20
|
return desktop ? new TaWebApps(desktop, host) : undefined;
|
|
21
21
|
}
|
|
22
22
|
get installable() {
|
|
23
|
-
|
|
23
|
+
var _a, _b;
|
|
24
|
+
return !((_b = (_a = this.host).stopped) === null || _b === void 0 ? void 0 : _b.call(_a)) && this.host.settings.state.settings.installApps;
|
|
24
25
|
}
|
|
25
26
|
async list() {
|
|
26
27
|
return (await this.desktop.list()).map(({ id, name, installedAt }) => ({ id, name, installedAt }));
|
|
27
28
|
}
|
|
28
29
|
async install(id) {
|
|
29
30
|
var _a, _b;
|
|
31
|
+
this.live();
|
|
30
32
|
const say = (0, use_t_1.translator)(this.host.settings.state.language);
|
|
31
33
|
if (!this.installable) {
|
|
32
34
|
throw new Error(say('ta.apps.off'));
|
|
@@ -50,12 +52,21 @@ class TaWebApps {
|
|
|
50
52
|
this.host.notices.notify(say('ta.apps.installed', { name: page.title }));
|
|
51
53
|
}
|
|
52
54
|
}
|
|
53
|
-
remove(id) {
|
|
55
|
+
async remove(id) {
|
|
56
|
+
this.live();
|
|
54
57
|
return this.desktop.remove(id);
|
|
55
58
|
}
|
|
56
|
-
open(id) {
|
|
59
|
+
async open(id) {
|
|
60
|
+
this.live();
|
|
57
61
|
return this.desktop.open(id);
|
|
58
62
|
}
|
|
63
|
+
/** What acts for the user: refused once the extension stopped. */
|
|
64
|
+
live() {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
if ((_b = (_a = this.host).stopped) === null || _b === void 0 ? void 0 : _b.call(_a)) {
|
|
67
|
+
throw new Error('The web extension has stopped.');
|
|
68
|
+
}
|
|
69
|
+
}
|
|
59
70
|
}
|
|
60
71
|
exports.TaWebApps = TaWebApps;
|
|
61
72
|
//# sourceMappingURL=web-apps.js.map
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { Voice } from '../util/voice';
|
|
2
|
+
import { RealtimeVoice } from './realtime-voice';
|
|
3
|
+
import type { RealtimeVoiceHost } from './realtime-voice-protocol';
|
|
4
|
+
/** The package whose host writes speech down on the computer (ta-voice's hear.ts). */
|
|
5
|
+
export declare const HEAR_PACKAGE = "@celljs/ta-voice";
|
|
6
|
+
/** What the computer says of its speech recognition (ta-voice's `hearing`): on, downloading, ready or failed. */
|
|
7
|
+
export interface HearingStatus {
|
|
8
|
+
on: boolean;
|
|
9
|
+
state: 'off' | 'getting' | 'ready' | 'failed';
|
|
10
|
+
supported: boolean;
|
|
11
|
+
/** The size of its model, in bytes. */
|
|
12
|
+
bytes: number;
|
|
13
|
+
done?: number;
|
|
14
|
+
total?: number;
|
|
15
|
+
error?: {
|
|
16
|
+
code: string;
|
|
17
|
+
detail?: string;
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
export interface TaHearingHost {
|
|
21
|
+
/** Connected to ta serve: it can hear. */
|
|
22
|
+
online(): boolean;
|
|
23
|
+
/** A method of ta-voice's host: `hearing`, `hear`. */
|
|
24
|
+
call(method: string, params: unknown[]): Promise<unknown>;
|
|
25
|
+
/** Where a voice service of Settings is opened. */
|
|
26
|
+
readonly voices: RealtimeVoiceHost;
|
|
27
|
+
/**
|
|
28
|
+
* The computer cannot write speech down yet (`status` undefined: nothing of it answered): the user is told why,
|
|
29
|
+
* and offered to turn it on.
|
|
30
|
+
*/
|
|
31
|
+
tell(status: HearingStatus | undefined): void;
|
|
32
|
+
microphone?(): Promise<MediaStream>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Ta listening where the recognizer of the device does not (Voice.Fallback, docs/design/ta-voice.md 11): with the
|
|
36
|
+
* voice service of Settings → Voice when one is chosen, else with the model of the computer (ta-voice's hear, a
|
|
37
|
+
* need of ta-local-models). The microphone's sound goes to ta serve as PCM16 at 16 kHz in pieces as the user speaks;
|
|
38
|
+
* what was said so far comes back about each second, and all of it once they stop.
|
|
39
|
+
*/
|
|
40
|
+
export declare class TaHearing implements Voice.Fallback {
|
|
41
|
+
protected readonly host: TaHearingHost;
|
|
42
|
+
/** Each piece sent, ms. */
|
|
43
|
+
static readonly PIECE_MS = 250;
|
|
44
|
+
/** What was said so far is asked at most this often, ms. */
|
|
45
|
+
static readonly INTERIM_MS = 1000;
|
|
46
|
+
/** Not past this much sound, ms: longer, only the end is written down. */
|
|
47
|
+
static readonly INTERIM_MAX_MS = 60000;
|
|
48
|
+
/** A silence this long after speech ends what is said to it (not what a finger holds), ms. */
|
|
49
|
+
static readonly SILENCE_MS = 1200;
|
|
50
|
+
/** No speech this long ends it, ms. */
|
|
51
|
+
static readonly NO_SPEECH_MS = 8000;
|
|
52
|
+
/** The longest one utterance, and one held, ms. */
|
|
53
|
+
static readonly MAX_MS = 60000;
|
|
54
|
+
static readonly MAX_HELD_MS = 300000;
|
|
55
|
+
/** The level (RMS) of speech, at least; in noise, louder than it. */
|
|
56
|
+
static readonly LEVEL = 0.015;
|
|
57
|
+
static readonly RATE = 16000;
|
|
58
|
+
constructor(host: TaHearingHost);
|
|
59
|
+
available(): boolean;
|
|
60
|
+
listen(language: string, onText: (text: string, final: boolean) => void, onEnd: (error?: string) => void, options?: Voice.ListenOptions): Voice.Listening;
|
|
61
|
+
/** With the voice service of Settings: one utterance, or all said till stopped, a sentence after another. */
|
|
62
|
+
protected withService(service: RealtimeVoice, language: string, onText: (text: string, final: boolean) => void, end: (error?: string) => void, options: Voice.ListenOptions): Voice.Listening | undefined;
|
|
63
|
+
/** With the model of the computer. */
|
|
64
|
+
protected locally(onText: (text: string, final: boolean) => void, end: (error?: string) => void, options: Voice.ListenOptions): Promise<Voice.Listening | undefined>;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* 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
|
|
68
|
+
* 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.
|
|
69
|
+
*/
|
|
70
|
+
export declare class HeardSound {
|
|
71
|
+
protected readonly held: boolean;
|
|
72
|
+
protected pieces: Uint8Array[];
|
|
73
|
+
protected samples: number;
|
|
74
|
+
protected noise: number;
|
|
75
|
+
protected spokeAt: number;
|
|
76
|
+
spoke: boolean;
|
|
77
|
+
constructor(held: boolean);
|
|
78
|
+
/** How long it is, ms. */
|
|
79
|
+
get ms(): number;
|
|
80
|
+
add(samples: Float32Array, rate: number): void;
|
|
81
|
+
/** What came since it was last taken. */
|
|
82
|
+
take(): Uint8Array;
|
|
83
|
+
/** It is over: too long, or, said to it rather than held, a silence after speech or no speech at all. */
|
|
84
|
+
over(): boolean;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=ta-hearing.d.ts.map
|