@crewlethq/ui 0.190.2 → 0.192.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 (160) hide show
  1. package/README.md +11 -3
  2. package/dist/AgentHandoffPanel/AgentHandoffPanel.d.ts +4 -1
  3. package/dist/AgentHandoffPanel/index.js +11 -7
  4. package/dist/AgentIdentity/index.js +8 -7
  5. package/dist/Announcer/index.js +2 -1
  6. package/dist/AppShell/index.js +4 -3
  7. package/dist/ArrangeFrame/index.js +3 -2
  8. package/dist/ArrangeList/index.js +7 -6
  9. package/dist/ArtifactBar/index.js +3 -2
  10. package/dist/ArtifactCard/index.js +6 -5
  11. package/dist/AvatarPicker/index.js +1 -1
  12. package/dist/Canvas/index.js +3 -2
  13. package/dist/CanvasBoard/index.js +5 -4
  14. package/dist/CanvasToolbar/index.js +4 -3
  15. package/dist/CharacterCount/index.js +3 -2
  16. package/dist/CheckGrid/index.js +6 -5
  17. package/dist/Checkbox/index.js +5 -4
  18. package/dist/ChipField/index.js +3 -2
  19. package/dist/ColorField/index.js +5 -4
  20. package/dist/Combobox/index.js +5 -4
  21. package/dist/CommandPalette/index.js +10 -8
  22. package/dist/CommentThread/CommentThread.d.ts +4 -1
  23. package/dist/CommentThread/index.js +11 -7
  24. package/dist/Composer/Composer.d.ts +7 -0
  25. package/dist/Composer/index.d.ts +1 -0
  26. package/dist/Composer/index.js +12 -6
  27. package/dist/{Composer-YO275MFX.css → Composer-YCD6UPMO.css} +3 -2
  28. package/dist/ConfirmField/index.js +5 -4
  29. package/dist/ConsequenceList/index.js +6 -5
  30. package/dist/DataGrid/index.js +7 -6
  31. package/dist/DataTable/index.js +8 -7
  32. package/dist/DataView/index.js +12 -10
  33. package/dist/Dictation/fake.d.ts +59 -0
  34. package/dist/Dictation/index.d.ts +8 -0
  35. package/dist/Dictation/index.js +17 -0
  36. package/dist/Dictation/labels.d.ts +4 -0
  37. package/dist/Dictation/machine.d.ts +126 -0
  38. package/dist/Dictation/microphone.d.ts +5 -0
  39. package/dist/Dictation/session.d.ts +31 -0
  40. package/dist/Dictation/slot.d.ts +69 -0
  41. package/dist/Dictation/types.d.ts +158 -0
  42. package/dist/Dictation/webSpeech.d.ts +13 -0
  43. package/dist/Dictation/webSpeechLocal.d.ts +9 -0
  44. package/dist/Dictation-MGLRANB4.css +141 -0
  45. package/dist/DocTabsEditor/index.js +6 -5
  46. package/dist/DurationField/index.js +6 -5
  47. package/dist/{Editor-FZOUNP6V.js → Editor-ZQUOI3WV.js} +5 -4
  48. package/dist/EmojiPicker/index.js +5 -4
  49. package/dist/GraphCanvas/index.js +4 -3
  50. package/dist/InlineEditor/index.js +3 -2
  51. package/dist/Input/index.js +4 -3
  52. package/dist/Kbd/index.js +2 -1
  53. package/dist/KeyValueRows/index.js +5 -4
  54. package/dist/LinkInterstitial/index.js +8 -7
  55. package/dist/ListInput/index.js +8 -6
  56. package/dist/MemberPicker/index.js +6 -5
  57. package/dist/MessageActions/index.js +6 -5
  58. package/dist/Modal/index.js +7 -6
  59. package/dist/MoneyField/index.js +5 -4
  60. package/dist/NewItemsNotice/index.js +3 -2
  61. package/dist/NumberField/index.js +5 -4
  62. package/dist/OrgTable/index.js +9 -8
  63. package/dist/PrincipalPicker/index.js +6 -5
  64. package/dist/ProposalCard/index.js +8 -7
  65. package/dist/ReactionBar/index.js +6 -5
  66. package/dist/Reorder/index.js +3 -2
  67. package/dist/RichEditor/index.js +1 -1
  68. package/dist/ScopeList/index.js +6 -5
  69. package/dist/SelectionBar/index.js +3 -2
  70. package/dist/SendKeys/index.js +3 -2
  71. package/dist/SettingForm/index.js +5 -4
  72. package/dist/ShareDialog/index.js +8 -7
  73. package/dist/SheetColumnEditor/index.js +8 -6
  74. package/dist/SheetGrid/index.js +5 -4
  75. package/dist/SlideFilmstrip/index.js +6 -4
  76. package/dist/Switcher/index.js +8 -7
  77. package/dist/TagGroup/index.js +3 -2
  78. package/dist/TagsInput/index.js +3 -2
  79. package/dist/TimeRangePicker/index.js +8 -7
  80. package/dist/TimeWindowPicker/index.js +5 -4
  81. package/dist/TreeCanvas/index.js +4 -3
  82. package/dist/TreeGrid/index.js +8 -7
  83. package/dist/ValueField/index.js +6 -5
  84. package/dist/VersionCompare/index.js +1 -1
  85. package/dist/{chunk-VBBLHS2Y.js → chunk-25LIX6UI.js} +0 -1
  86. package/dist/{chunk-XKC7EJGR.js → chunk-2DFB7NHX.js} +39 -13
  87. package/dist/{chunk-YHLLBQJA.js → chunk-2EALNWKD.js} +1 -1
  88. package/dist/{chunk-TDRWUWGV.js → chunk-2SSTJDRV.js} +1 -1
  89. package/dist/{chunk-VNEUVMUR.js → chunk-2ZNOHIT4.js} +2 -2
  90. package/dist/{chunk-EK5NJV6K.js → chunk-4P24HLY3.js} +2 -2
  91. package/dist/{chunk-ERNIXJMN.js → chunk-4RQTYNJB.js} +1 -1
  92. package/dist/{chunk-BE5NESX4.js → chunk-4X33B7RC.js} +1 -1
  93. package/dist/{chunk-NIII72XP.js → chunk-5AOJFG2K.js} +1 -1
  94. package/dist/{chunk-ZLHVKPAQ.js → chunk-5PCC5XTZ.js} +1 -1
  95. package/dist/{chunk-IAOROOL6.js → chunk-5YYAI32W.js} +4 -4
  96. package/dist/{chunk-CUQN6WSD.js → chunk-6AU73W3Y.js} +2 -2
  97. package/dist/{chunk-S6ES6MMW.js → chunk-6EJS374X.js} +2 -2
  98. package/dist/{chunk-C4BENQB3.js → chunk-A24SEWF7.js} +2 -2
  99. package/dist/{chunk-NHQ3CXFN.js → chunk-ANCFMQBV.js} +1 -1
  100. package/dist/{chunk-OAWECVU2.js → chunk-B4TAERAM.js} +1 -1
  101. package/dist/{chunk-TEXK4RK6.js → chunk-BGVJBX7E.js} +1 -1
  102. package/dist/chunk-CB6MUWCA.js +206 -0
  103. package/dist/{chunk-R72QM6WV.js → chunk-CC4TFCOT.js} +4 -1
  104. package/dist/chunk-CI4HUVNI.js +197 -0
  105. package/dist/{chunk-SETK4FN5.js → chunk-CVNUXLMI.js} +1 -1
  106. package/dist/{chunk-FOJ3TVKJ.js → chunk-DON7AM43.js} +1 -1
  107. package/dist/{chunk-DDVUPYJW.js → chunk-EDHRJQZT.js} +1 -1
  108. package/dist/{chunk-HWJVQFXQ.js → chunk-EJDWUXFJ.js} +3 -3
  109. package/dist/{chunk-H77NQVS7.js → chunk-ETWGKTMC.js} +1 -1
  110. package/dist/{chunk-237WBIAN.js → chunk-EZO5MYII.js} +1 -1
  111. package/dist/{chunk-SQPT4UZ4.js → chunk-GEFO45DZ.js} +1 -1
  112. package/dist/{chunk-2SGJAD7O.js → chunk-HC5Y4ZVY.js} +1 -1
  113. package/dist/{chunk-WLYAGMZA.js → chunk-HI3AFP34.js} +1 -1
  114. package/dist/{chunk-WASYD3IL.js → chunk-I6D4QYZL.js} +4 -2
  115. package/dist/{chunk-HUZ27VZ7.js → chunk-IFL6DM5K.js} +1 -1
  116. package/dist/chunk-JNTOZ5LE.js +49 -0
  117. package/dist/{chunk-YUVQUJND.js → chunk-K657TVMA.js} +1 -1
  118. package/dist/{chunk-NCQC5Y4E.js → chunk-LIOO7OMN.js} +1 -1
  119. package/dist/{chunk-BD2HPIZ2.js → chunk-LN7IMSCU.js} +1 -1
  120. package/dist/{chunk-R5UTN5QB.js → chunk-LNPN3DV2.js} +2 -2
  121. package/dist/{chunk-KIPEB2UV.js → chunk-MKOWEHDH.js} +1 -1
  122. package/dist/{chunk-U2TENSNB.js → chunk-MZAMX65M.js} +1 -1
  123. package/dist/chunk-MZP5A3NQ.js +1 -0
  124. package/dist/{chunk-2OYEVTF4.js → chunk-N2AIHIYX.js} +2 -2
  125. package/dist/{chunk-MSKRVYGH.js → chunk-N72QMEEA.js} +1 -1
  126. package/dist/{chunk-Y5GBXHA6.js → chunk-NB5HDW7O.js} +2 -2
  127. package/dist/{chunk-ZR276S44.js → chunk-NLYURJUF.js} +2 -2
  128. package/dist/chunk-NQ7LG6BU.js +1 -0
  129. package/dist/{chunk-J6QNUNZD.js → chunk-ORX3PYX3.js} +1 -1
  130. package/dist/{chunk-QVSG3XSW.js → chunk-QGZPXZHE.js} +2 -2
  131. package/dist/{chunk-2FWNVZSX.js → chunk-QJEC2XZH.js} +2 -2
  132. package/dist/{chunk-4RVDOEJR.js → chunk-RTLBWYVV.js} +2 -2
  133. package/dist/{chunk-FTOKCN4I.js → chunk-SFBIOHM3.js} +2 -2
  134. package/dist/{chunk-H7V4QAOV.js → chunk-SXCUNON2.js} +1 -1
  135. package/dist/{chunk-ZDENBTBY.js → chunk-SXUKSA6U.js} +1 -1
  136. package/dist/{chunk-G5UBUODG.js → chunk-T2DGBIFD.js} +1 -1
  137. package/dist/{chunk-LR56IYSL.js → chunk-TJFJMMCR.js} +2 -2
  138. package/dist/{chunk-MFJYXWN5.js → chunk-UN5BTYDI.js} +5 -5
  139. package/dist/{chunk-ZQTEBONP.js → chunk-VNCKUYYT.js} +1 -1
  140. package/dist/{chunk-MFRXKQAF.js → chunk-XHQ6BRGS.js} +1 -1
  141. package/dist/{chunk-NJBKJF3Q.js → chunk-XKFZBWXA.js} +2 -2
  142. package/dist/{chunk-U7AHXPYA.js → chunk-XLB7QIXK.js} +3 -3
  143. package/dist/{chunk-IF5RMDDV.js → chunk-XLOBTFLR.js} +3 -3
  144. package/dist/{chunk-RYS3SN7J.js → chunk-XTT2XWVQ.js} +1 -1
  145. package/dist/{chunk-ZCKC7ENV.js → chunk-Y22OHIVL.js} +2 -2
  146. package/dist/{chunk-2DESFB7K.js → chunk-YER6BEBM.js} +1 -1
  147. package/dist/{chunk-M4XBRBZL.js → chunk-YNPIGUJF.js} +1 -1
  148. package/dist/{chunk-KQTWO46B.js → chunk-YOGPQDXA.js} +1 -1
  149. package/dist/{chunk-4TLKCRE4.js → chunk-YW3IH3EU.js} +1 -1
  150. package/dist/{chunk-EPVQ4OZ3.js → chunk-YXRMGI4B.js} +1 -1
  151. package/dist/{chunk-QR4LRVWK.js → chunk-ZH45BDTS.js} +1 -1
  152. package/dist/generated/index.d.ts +1 -0
  153. package/dist/generated/index.js +96 -91
  154. package/dist/index.js +96 -91
  155. package/dist/session-XDRRVFVE.js +789 -0
  156. package/dist/styles.css +148 -3
  157. package/dist/webSpeech-CJNDQU3D.js +165 -0
  158. package/package.json +3 -3
  159. /package/dist/{chunk-WGMKERCR.js → chunk-AZQBGKPR.js} +0 -0
  160. /package/dist/{chunk-LE7SVMCB.js → chunk-JJEGPEV7.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import { Switch } from './chunk-6YYRFGXO.js';
2
- import { useReorder } from './chunk-H77NQVS7.js';
3
- import { Checkbox } from './chunk-2DESFB7K.js';
2
+ import { useReorder } from './chunk-ETWGKTMC.js';
3
+ import { Checkbox } from './chunk-YER6BEBM.js';
4
4
  import { IconButton } from './chunk-66H4BC5Z.js';
5
5
  import { VisuallyHidden } from './chunk-RRRK2KB6.js';
6
6
  import { cx } from './chunk-ODEQTPFM.js';
@@ -1,6 +1,6 @@
1
1
  import { Button } from './chunk-YVMIT2OW.js';
2
- import { FormField, Label, Input } from './chunk-ZR276S44.js';
3
- import { announce } from './chunk-WGMKERCR.js';
2
+ import { FormField, Label, Input } from './chunk-NLYURJUF.js';
3
+ import { announce } from './chunk-AZQBGKPR.js';
4
4
  import { IconButton } from './chunk-66H4BC5Z.js';
5
5
  import { cx } from './chunk-ODEQTPFM.js';
6
6
  import './KeyValueRows-US5KW7JK.css';
@@ -2,7 +2,7 @@ import { Select } from './chunk-DPCXOBXN.js';
2
2
  import { PrincipalAvatar } from './chunk-265IX4YA.js';
3
3
  import { useMediaMatch } from './chunk-COS6LJ4K.js';
4
4
  import { CopyButton } from './chunk-NAHBGKE7.js';
5
- import { Modal } from './chunk-KQTWO46B.js';
5
+ import { Modal } from './chunk-YOGPQDXA.js';
6
6
  import { Callout } from './chunk-XJLGQ7U7.js';
7
7
  import { Button } from './chunk-YVMIT2OW.js';
8
8
  import { IconButton } from './chunk-66H4BC5Z.js';
@@ -1,4 +1,4 @@
1
- import { emojiOfShortcode, emojiName, EmojiPicker } from './chunk-TDRWUWGV.js';
1
+ import { emojiOfShortcode, emojiName, EmojiPicker } from './chunk-2SSTJDRV.js';
2
2
  import { heldHint } from './chunk-TDFLCUBE.js';
3
3
  import { Tooltip } from './chunk-ZF5ELYJ3.js';
4
4
  import { cx } from './chunk-ODEQTPFM.js';
@@ -1,4 +1,4 @@
1
- import { announce } from './chunk-WGMKERCR.js';
1
+ import { announce } from './chunk-AZQBGKPR.js';
2
2
  import { VisuallyHidden } from './chunk-RRRK2KB6.js';
3
3
  import { cx } from './chunk-ODEQTPFM.js';
4
4
  import './CharacterCount-S735DICR.css';
@@ -0,0 +1,206 @@
1
+ import './Dictation-MGLRANB4.css';
2
+
3
+ // src/Dictation/index.ts
4
+
5
+ // src/Dictation/fake.ts
6
+ var FAKE_SCRIPT = [
7
+ "Let\u2019s move the launch review to Thursday morning.",
8
+ "Please send the updated pricing table to the whole team before then.",
9
+ "If the billing page is not ready, we ship the checklist first and follow up next week."
10
+ ];
11
+ function unpunctuated(sentence) {
12
+ return sentence.replace(/[.,!?;:]/g, "").split(/\s+/).filter(Boolean);
13
+ }
14
+ function fakeTransport(options = {}) {
15
+ const script = options.script ?? FAKE_SCRIPT;
16
+ const pace = options.pace ?? 180;
17
+ const calls = [];
18
+ let events = null;
19
+ let timer;
20
+ let sentence = 0;
21
+ let word = 0;
22
+ let spoken = 0;
23
+ const tick = () => {
24
+ if (!events) return;
25
+ const { fail, quietAfter } = options;
26
+ if (fail && spoken >= (fail.after ?? 0)) {
27
+ const out = events;
28
+ events = null;
29
+ out.error(fail.code);
30
+ return;
31
+ }
32
+ if (quietAfter !== void 0 && spoken >= quietAfter) return;
33
+ if (sentence >= script.length) return;
34
+ const words = unpunctuated(script[sentence]);
35
+ word += 1;
36
+ spoken += 1;
37
+ if (word < words.length) events.partial(words.slice(0, word).join(" "));
38
+ else {
39
+ events.final(script[sentence]);
40
+ sentence = options.loop === false ? sentence + 1 : (sentence + 1) % script.length;
41
+ word = 0;
42
+ }
43
+ timer = setTimeout(tick, pace);
44
+ };
45
+ return {
46
+ calls,
47
+ picksDevice: options.picksDevice,
48
+ available: () => options.available ?? true,
49
+ start(deviceId, next) {
50
+ calls.push(`start:${deviceId ?? "default"}`);
51
+ clearTimeout(timer);
52
+ events = next;
53
+ word = 0;
54
+ const { prepare, fail } = options;
55
+ if (fail && !fail.after && (fail.code === "busy" || fail.code === "unavailable")) {
56
+ events = null;
57
+ next.error(fail.code);
58
+ return;
59
+ }
60
+ if (!prepare) {
61
+ timer = setTimeout(tick, pace);
62
+ return;
63
+ }
64
+ const step = (done) => {
65
+ if (events !== next) return;
66
+ if (done < 5) {
67
+ next.preparing?.(done / 5);
68
+ timer = setTimeout(() => step(done + 1), prepare / 5);
69
+ } else {
70
+ next.ready?.();
71
+ timer = setTimeout(tick, pace);
72
+ }
73
+ };
74
+ step(0);
75
+ },
76
+ switchStream(_stream, deviceId) {
77
+ calls.push(`switch:${deviceId ?? "default"}`);
78
+ },
79
+ flush() {
80
+ calls.push("flush");
81
+ clearTimeout(timer);
82
+ const out = events;
83
+ events = null;
84
+ return new Promise((resolve) => {
85
+ setTimeout(() => {
86
+ if (out && word > 0) {
87
+ out.final(`${unpunctuated(script[sentence]).slice(0, word).join(" ")}.`);
88
+ sentence = (sentence + 1) % script.length;
89
+ word = 0;
90
+ }
91
+ resolve();
92
+ }, options.flushDelay ?? 120);
93
+ });
94
+ },
95
+ cancel() {
96
+ calls.push("cancel");
97
+ clearTimeout(timer);
98
+ events = null;
99
+ }
100
+ };
101
+ }
102
+ var FAKE_DEVICES = [
103
+ { deviceId: "default", label: "Default - Studio Display Microphone" },
104
+ { deviceId: "studio", label: "Studio Display Microphone" },
105
+ { deviceId: "headset", label: "Wireless Headset" }
106
+ ];
107
+ function named(name) {
108
+ return Object.assign(new Error(name), { name });
109
+ }
110
+ function fakeMicrophone(options = {}) {
111
+ let permission = options.permission ?? "granted";
112
+ let devices = [...options.devices ?? FAKE_DEVICES];
113
+ const permissionListeners = /* @__PURE__ */ new Set();
114
+ const deviceListeners = /* @__PURE__ */ new Set();
115
+ const open = /* @__PURE__ */ new Set();
116
+ let waiting = null;
117
+ const capture = () => {
118
+ const handle = { ended: /* @__PURE__ */ new Set() };
119
+ open.add(handle);
120
+ const born = Date.now();
121
+ return {
122
+ stream: null,
123
+ level() {
124
+ if (options.level === "silent") return 0;
125
+ const t = Date.now() - born;
126
+ return Math.min(1, 0.2 + 0.6 * Math.abs(Math.sin(t / 140) * Math.sin(t / 410 + 1)));
127
+ },
128
+ onEnded(listener) {
129
+ handle.ended.add(listener);
130
+ },
131
+ stop() {
132
+ open.delete(handle);
133
+ }
134
+ };
135
+ };
136
+ return {
137
+ check: () => options.block,
138
+ permission: async () => permission,
139
+ onPermissionChange(listener) {
140
+ permissionListeners.add(listener);
141
+ return () => permissionListeners.delete(listener);
142
+ },
143
+ devices: async () => permission === "granted" ? devices : devices.slice(0, 1).map(() => ({ deviceId: "", label: "" })),
144
+ onDeviceChange(listener) {
145
+ deviceListeners.add(listener);
146
+ return () => deviceListeners.delete(listener);
147
+ },
148
+ async open(deviceId) {
149
+ switch (options.open) {
150
+ case "denied":
151
+ permission = "denied";
152
+ throw named("NotAllowedError");
153
+ case "missing":
154
+ throw named("NotFoundError");
155
+ case "busy":
156
+ throw named("NotReadableError");
157
+ case "wait":
158
+ if (permission !== "granted")
159
+ await new Promise((resolve) => {
160
+ waiting = resolve;
161
+ });
162
+ }
163
+ if (deviceId !== void 0 && !devices.some((d) => d.deviceId === deviceId)) throw named("OverconstrainedError");
164
+ permission = "granted";
165
+ return capture();
166
+ },
167
+ unplug() {
168
+ for (const handle of [...open]) for (const listener of handle.ended) listener();
169
+ devices = devices.slice(0, -1);
170
+ for (const listener of deviceListeners) listener();
171
+ },
172
+ setPermission(state) {
173
+ permission = state;
174
+ for (const listener of permissionListeners) listener(state);
175
+ },
176
+ setDevices(next) {
177
+ devices = [...next];
178
+ for (const listener of deviceListeners) listener();
179
+ },
180
+ settle() {
181
+ waiting?.();
182
+ waiting = null;
183
+ },
184
+ get openCount() {
185
+ return open.size;
186
+ }
187
+ };
188
+ }
189
+
190
+ // src/Dictation/webSpeechLocal.ts
191
+ function webSpeechLocalTransport(options = {}) {
192
+ let route = null;
193
+ const load = async () => route ??= (await import('./webSpeech-CJNDQU3D.js')).createWebSpeechLocal(options);
194
+ return {
195
+ get picksDevice() {
196
+ return route?.picksDevice;
197
+ },
198
+ available: async () => (await load()).available(),
199
+ start: async (deviceId, events, stream) => (await load()).start(deviceId, events, stream),
200
+ switchStream: (stream, deviceId) => route?.switchStream?.(stream, deviceId),
201
+ flush: () => route?.flush() ?? Promise.resolve(),
202
+ cancel: () => route?.cancel()
203
+ };
204
+ }
205
+
206
+ export { FAKE_DEVICES, FAKE_SCRIPT, fakeMicrophone, fakeTransport, webSpeechLocalTransport };
@@ -1,7 +1,7 @@
1
1
  import { PrincipalAvatar } from './chunk-265IX4YA.js';
2
2
  import { toInstant, RelativeTime, formatExact, toISO } from './chunk-5ZL3PXEL.js';
3
3
  import { Document } from './chunk-I4PBFJGX.js';
4
- import { Composer } from './chunk-XKC7EJGR.js';
4
+ import { Composer } from './chunk-2DFB7NHX.js';
5
5
  import { Button } from './chunk-YVMIT2OW.js';
6
6
  import { IconButton } from './chunk-66H4BC5Z.js';
7
7
  import { Count } from './chunk-6YKTRAWI.js';
@@ -51,6 +51,7 @@ function CommentThread({
51
51
  hint,
52
52
  notice,
53
53
  heading = true,
54
+ dictation,
54
55
  now,
55
56
  labels: overrides,
56
57
  className
@@ -209,6 +210,7 @@ function CommentThread({
209
210
  onChange: setEditDraft,
210
211
  onSubmit: () => void saveEdit(comment),
211
212
  label: labels.editField,
213
+ dictation,
212
214
  actions: /* @__PURE__ */ jsxs(Fragment, { children: [
213
215
  /* @__PURE__ */ jsx(Button, { size: "small", variant: "ghost", disabled: acting, onClick: () => setEditing(null), children: labels.cancel }),
214
216
  /* @__PURE__ */ jsx(
@@ -268,6 +270,7 @@ function CommentThread({
268
270
  onSubmit: () => void send(),
269
271
  label: labels.field(subject, replyTo ? nameOf(replyTo) : void 0),
270
272
  placeholder: labels.placeholder,
273
+ dictation,
271
274
  actions: /* @__PURE__ */ jsx(
272
275
  Button,
273
276
  {
@@ -0,0 +1,197 @@
1
+ import { isApplePlatform, keyGlyph } from './chunk-25LIX6UI.js';
2
+ import { Menu } from './chunk-43N4EHFR.js';
3
+ import { IconButton } from './chunk-66H4BC5Z.js';
4
+ import { cx } from './chunk-ODEQTPFM.js';
5
+ import { useSyncExternalStore, useState, useRef, useEffect, useLayoutEffect } from 'react';
6
+ import { MicGlyph, ChevronDownGlyph } from '@crewlethq/icons/glyphs';
7
+ import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
8
+
9
+ var chunk = null;
10
+ var loading = null;
11
+ var version = 0;
12
+ var listeners = /* @__PURE__ */ new Set();
13
+ function notify() {
14
+ version += 1;
15
+ for (const listener of [...listeners]) listener();
16
+ }
17
+ function subscribe(listener) {
18
+ listeners.add(listener);
19
+ return () => listeners.delete(listener);
20
+ }
21
+ function load() {
22
+ loading ??= import('./session-XDRRVFVE.js').then(
23
+ (module) => {
24
+ chunk = module;
25
+ notify();
26
+ return module;
27
+ },
28
+ (error) => {
29
+ loading = null;
30
+ throw error;
31
+ }
32
+ );
33
+ return loading;
34
+ }
35
+ function preloadDictation() {
36
+ return load().then(
37
+ () => void 0,
38
+ () => void 0
39
+ );
40
+ }
41
+ var ENTRY_LABELS = {
42
+ dictate: "Dictate",
43
+ chooseMicrophone: "Choose a microphone",
44
+ unsupported: "Dictation needs a newer browser",
45
+ insecure: "Dictation needs this site on https",
46
+ policy: "This page does not allow the microphone"
47
+ };
48
+ var DICTATION_SHORTCUT = ["Mod", "Shift", "Space"];
49
+ function browserBlock() {
50
+ if (typeof window === "undefined") return "unsupported";
51
+ if (!window.isSecureContext) return "insecure";
52
+ if (!navigator.mediaDevices?.getUserMedia || typeof AudioContext === "undefined") return "unsupported";
53
+ const policy = document.permissionsPolicy;
54
+ return policy && !policy.allowsFeature("microphone") ? "policy" : void 0;
55
+ }
56
+ function chordMatches(chord, event, apple) {
57
+ const key = chord[chord.length - 1];
58
+ const has = (name) => chord.includes(name);
59
+ const mod = apple ? event.metaKey : event.ctrlKey;
60
+ const pressed = key === "Space" ? event.code === "Space" || event.key === " " : event.key.toLowerCase() === key.toLowerCase();
61
+ return pressed && mod === has("Mod") && event.shiftKey === has("Shift") && event.altKey === has("Alt") && (apple ? event.ctrlKey === has("Ctrl") : true);
62
+ }
63
+ var LONG_PRESS_MS = 500;
64
+ function useDictationSlot(source, options) {
65
+ useSyncExternalStore(subscribe, () => version, () => version);
66
+ const [open, setOpen] = useState(false);
67
+ const props = useRef({ ...options, source });
68
+ props.current = { ...options, source };
69
+ const ownerRef = useRef(null);
70
+ ownerRef.current ??= { get: () => props.current, caret: null, touched: false };
71
+ const owner = ownerRef.current;
72
+ const press = useRef({ timer: void 0, long: false });
73
+ useEffect(() => () => chunk?.release(owner), [owner]);
74
+ useEffect(() => {
75
+ const field = options.field.current;
76
+ const touch = () => {
77
+ owner.touched = true;
78
+ };
79
+ field?.addEventListener("focus", touch);
80
+ return () => field?.removeEventListener("focus", touch);
81
+ }, [owner, options.field]);
82
+ useLayoutEffect(() => {
83
+ const field = options.field.current;
84
+ const caret = owner.caret;
85
+ if (caret && field && field.value === caret.value) {
86
+ owner.caret = null;
87
+ field.focus();
88
+ field.setSelectionRange(caret.at, caret.at);
89
+ }
90
+ });
91
+ if (!source) return null;
92
+ const view = chunk?.view(owner);
93
+ const phase = view?.phase ?? null;
94
+ const labels = { ...ENTRY_LABELS, ...source.labels };
95
+ const block = source.microphone ? source.microphone.check() : browserBlock();
96
+ const held = options.heldReason ?? source.unavailableReason ?? (block && labels[block]) ?? view?.held;
97
+ const apple = isApplePlatform();
98
+ const chord = source.shortcut === false ? void 0 : source.shortcut ?? DICTATION_SHORTCUT;
99
+ const start = () => {
100
+ void load().then((c) => c.start(owner), () => void 0);
101
+ };
102
+ const openMenu = (next) => {
103
+ if (!next) setOpen(false);
104
+ else void load().then(() => setOpen(true), () => void 0);
105
+ };
106
+ const waiting = phase === "pending" || phase === "preparing";
107
+ const live = phase !== null && !waiting;
108
+ const bare = options.heldReason ?? ((block || source.unavailableReason) && !source.setup ? held : void 0);
109
+ const mic = live && !view?.resume ? null : /* @__PURE__ */ jsx(
110
+ IconButton,
111
+ {
112
+ label: view?.resume ?? labels.dictate,
113
+ icon: chunk && view?.off ? /* @__PURE__ */ jsx(chunk.MicOffGlyph, {}) : /* @__PURE__ */ jsx(MicGlyph, {}),
114
+ pressed: waiting,
115
+ disabledReason: held,
116
+ tooltip: chord ? `${labels.dictate} (${chord.map((k) => keyGlyph(k, apple).glyph).join(apple ? "" : "+")})` : true,
117
+ className: cx("crewlet-dictation__mic", waiting && "is-pending"),
118
+ onPointerEnter: () => void preloadDictation(),
119
+ onFocus: () => void preloadDictation(),
120
+ onPointerDown: () => {
121
+ press.current.long = false;
122
+ press.current.timer = setTimeout(() => {
123
+ press.current.long = true;
124
+ openMenu(true);
125
+ }, LONG_PRESS_MS);
126
+ },
127
+ onPointerUp: () => clearTimeout(press.current.timer),
128
+ onPointerLeave: () => clearTimeout(press.current.timer),
129
+ onKeyDown: (event) => {
130
+ if (event.key === "ArrowDown") {
131
+ event.preventDefault();
132
+ openMenu(true);
133
+ }
134
+ },
135
+ onClick: () => {
136
+ if (press.current.long) press.current.long = false;
137
+ else if (view?.resume) chunk?.resumeOwner(owner);
138
+ else if (phase === null) start();
139
+ }
140
+ }
141
+ );
142
+ const controls = /* @__PURE__ */ jsxs(Fragment, { children: [
143
+ live && chunk ? /* @__PURE__ */ jsx(chunk.Wave, { owner }) : null,
144
+ /* @__PURE__ */ jsx(
145
+ Menu,
146
+ {
147
+ label: labels.chooseMicrophone,
148
+ items: chunk ? chunk.menuItems(owner) : [],
149
+ header: chunk && open && chunk.hasHeader(owner) ? /* @__PURE__ */ jsx(chunk.MenuHeader, { owner }) : null,
150
+ open,
151
+ onOpenChange: openMenu,
152
+ align: "end",
153
+ renderTrigger: (trigger) => (
154
+ // A press on a mic held by another composer's session moves focus there.
155
+ /* @__PURE__ */ jsxs("span", { ref: trigger.ref, className: "crewlet-dictation", onClickCapture: () => view?.elsewhere && chunk?.focusActive(), children: [
156
+ mic,
157
+ /* @__PURE__ */ jsx(
158
+ IconButton,
159
+ {
160
+ label: labels.chooseMicrophone,
161
+ icon: /* @__PURE__ */ jsx(ChevronDownGlyph, {}),
162
+ size: "sm",
163
+ className: "crewlet-dictation__more",
164
+ disabledReason: bare,
165
+ "aria-haspopup": trigger["aria-haspopup"],
166
+ "aria-expanded": trigger["aria-expanded"],
167
+ "aria-controls": trigger["aria-controls"],
168
+ onClick: trigger.onClick,
169
+ onKeyDown: trigger.onKeyDown,
170
+ onPointerEnter: () => void preloadDictation(),
171
+ onFocus: () => void preloadDictation()
172
+ }
173
+ )
174
+ ] })
175
+ )
176
+ }
177
+ ),
178
+ phase !== null && chunk ? /* @__PURE__ */ jsx(chunk.Swap, { owner }) : null
179
+ ] });
180
+ return {
181
+ live,
182
+ active: phase !== null,
183
+ controls,
184
+ layer: live && chunk ? /* @__PURE__ */ jsx(chunk.Layer, { owner }) : null,
185
+ note: view?.note ? /* @__PURE__ */ jsx("div", { className: "crewlet-dictation__note", children: view.note }) : null,
186
+ describe: live ? view?.describe : void 0,
187
+ keyDown: (event) => {
188
+ if (phase !== null) return chunk.keyDown(owner, event);
189
+ if (!chord || !chordMatches(chord, event, apple)) return false;
190
+ event.preventDefault();
191
+ if (held === void 0) start();
192
+ return true;
193
+ }
194
+ };
195
+ }
196
+
197
+ export { DICTATION_SHORTCUT, browserBlock, chordMatches, notify, preloadDictation, useDictationSlot };
@@ -1,4 +1,4 @@
1
- import { TreeGrid } from './chunk-2OYEVTF4.js';
1
+ import { TreeGrid } from './chunk-N2AIHIYX.js';
2
2
  import { OrgLabel } from './chunk-BZLQHZKH.js';
3
3
  import { createTreeModel, treeParent } from './chunk-MY374UUD.js';
4
4
  import { AddPill } from './chunk-EHRNLV3D.js';
@@ -1,5 +1,5 @@
1
1
  import { EditingStatus } from './chunk-TDQB6AXC.js';
2
- import { Kbd } from './chunk-VBBLHS2Y.js';
2
+ import { Kbd } from './chunk-25LIX6UI.js';
3
3
  import { Button } from './chunk-YVMIT2OW.js';
4
4
  import { isComposing } from './chunk-EDPMHSLZ.js';
5
5
  import { cx } from './chunk-ODEQTPFM.js';
@@ -6,7 +6,7 @@ import { ArtifactKindGround } from './chunk-W3A6NBUM.js';
6
6
  import { ArtifactKindGlyph } from './chunk-RSKW25Y5.js';
7
7
  import { ArtifactAccessGlyph } from './chunk-DOY3KC6I.js';
8
8
  import { AvatarStack } from './chunk-SHVK6EOL.js';
9
- import { Checkbox } from './chunk-2DESFB7K.js';
9
+ import { Checkbox } from './chunk-YER6BEBM.js';
10
10
  import { VisuallyHidden } from './chunk-RRRK2KB6.js';
11
11
  import { cx } from './chunk-ODEQTPFM.js';
12
12
  import './ArtifactKinds-27TE3KJL.css';
@@ -1,8 +1,8 @@
1
1
  import { useListbox, useHighlightRest } from './chunk-KW7T23RT.js';
2
- import { Kbd } from './chunk-VBBLHS2Y.js';
2
+ import { Kbd } from './chunk-25LIX6UI.js';
3
3
  import { HIT_AREA_CLASS } from './chunk-2YTOOH3A.js';
4
- import { useScrollerFocus, Modal } from './chunk-KQTWO46B.js';
5
- import { Input } from './chunk-ZR276S44.js';
4
+ import { useScrollerFocus, Modal } from './chunk-YOGPQDXA.js';
5
+ import { Input } from './chunk-NLYURJUF.js';
6
6
  import { Count } from './chunk-6YKTRAWI.js';
7
7
  import { isComposing } from './chunk-EDPMHSLZ.js';
8
8
  import { VisuallyHidden } from './chunk-RRRK2KB6.js';
@@ -1,5 +1,5 @@
1
1
  import { prefersReducedMotion } from './chunk-COS6LJ4K.js';
2
- import { announce } from './chunk-WGMKERCR.js';
2
+ import { announce } from './chunk-AZQBGKPR.js';
3
3
  import { IconButton } from './chunk-66H4BC5Z.js';
4
4
  import { cx } from './chunk-ODEQTPFM.js';
5
5
  import './ReorderHandle-CT5OMUSR.css';
@@ -1,6 +1,6 @@
1
1
  import { Eyebrow } from './chunk-RK4XPHVG.js';
2
2
  import { InlineCode } from './chunk-E3XKFND2.js';
3
- import { Checkbox } from './chunk-2DESFB7K.js';
3
+ import { Checkbox } from './chunk-YER6BEBM.js';
4
4
  import { titleWhenCut } from './chunk-WSIJDWUG.js';
5
5
  import { cx } from './chunk-ODEQTPFM.js';
6
6
  import './ConsequenceList-EEXTCT6J.css';
@@ -1,5 +1,5 @@
1
1
  import { Tag } from './chunk-ASBBB5AJ.js';
2
- import { announce } from './chunk-WGMKERCR.js';
2
+ import { announce } from './chunk-AZQBGKPR.js';
3
3
  import { isComposing } from './chunk-EDPMHSLZ.js';
4
4
  import { useFocusModality } from './chunk-4ITETIGZ.js';
5
5
  import { cx } from './chunk-ODEQTPFM.js';
@@ -1,4 +1,4 @@
1
- import { announce } from './chunk-WGMKERCR.js';
1
+ import { announce } from './chunk-AZQBGKPR.js';
2
2
  import { IconButton } from './chunk-66H4BC5Z.js';
3
3
  import { cx } from './chunk-ODEQTPFM.js';
4
4
  import './ArrangeFrame-BW76K5LZ.css';
@@ -1,5 +1,5 @@
1
1
  import { LayerNodeBridge } from './chunk-DFFQGGAD.js';
2
- import { Kbd } from './chunk-VBBLHS2Y.js';
2
+ import { Kbd } from './chunk-25LIX6UI.js';
3
3
  import { Button } from './chunk-YVMIT2OW.js';
4
4
  import { IconButton } from './chunk-66H4BC5Z.js';
5
5
  import { Tooltip } from './chunk-ZF5ELYJ3.js';
@@ -1,6 +1,6 @@
1
1
  import { Timeline } from './chunk-XDUXAQIS.js';
2
2
  import { Section } from './chunk-WFCWPXJN.js';
3
- import { Composer } from './chunk-XKC7EJGR.js';
3
+ import { Composer } from './chunk-2DFB7NHX.js';
4
4
  import { ArtifactPanel } from './chunk-X2N7XQDN.js';
5
5
  import { Disclosure } from './chunk-RUROK3EU.js';
6
6
  import { Button } from './chunk-YVMIT2OW.js';
@@ -31,6 +31,7 @@ function AgentHandoffPanel({
31
31
  briefHelper,
32
32
  briefMaxLength,
33
33
  briefRef,
34
+ briefDictation,
34
35
  starters = [],
35
36
  onStarter,
36
37
  children,
@@ -108,7 +109,8 @@ function AgentHandoffPanel({
108
109
  canSubmit: !held,
109
110
  placeholder: briefPlaceholder,
110
111
  maxLength: briefMaxLength,
111
- rows: 4
112
+ rows: 4,
113
+ dictation: briefDictation
112
114
  }
113
115
  ),
114
116
  briefHelper ? /* @__PURE__ */ jsx("p", { id: helperId, className: "crewlet-agent-handoff__helper", children: briefHelper }) : null,
@@ -1,4 +1,4 @@
1
- import { ConfirmModal } from './chunk-KQTWO46B.js';
1
+ import { ConfirmModal } from './chunk-YOGPQDXA.js';
2
2
  import { Callout } from './chunk-XJLGQ7U7.js';
3
3
  import { InlineCode } from './chunk-E3XKFND2.js';
4
4
  import './LinkInterstitial-ET4MSVSV.css';
@@ -0,0 +1,49 @@
1
+ // src/Dictation/labels.ts
2
+ var DICTATION_LABELS = {
3
+ dictate: "Dictate",
4
+ chooseMicrophone: "Choose a microphone",
5
+ unsupported: "Dictation needs a newer browser",
6
+ insecure: "Dictation needs this site on https",
7
+ policy: "This page does not allow the microphone",
8
+ resume: "Resume dictating",
9
+ cancel: "Cancel dictation",
10
+ accept: "Accept dictation",
11
+ listening: "Listening\u2026",
12
+ dictating: "Dictating. Enter to accept, Escape to cancel.",
13
+ pending: "Allow microphone access in your browser to dictate",
14
+ cancelled: "Dictation cancelled",
15
+ inserted: (words) => `Inserted ${words} ${words === 1 ? "word" : "words"}`,
16
+ nothing: "Nothing was heard, so nothing was inserted",
17
+ denied: "Microphone blocked for this site",
18
+ noDevice: "No microphone found",
19
+ busy: "The microphone is in use by another app",
20
+ elsewhere: (composer) => `Dictating in ${composer}`,
21
+ quiet: "Still listening",
22
+ preparing: (progress) => progress === void 0 ? "Preparing dictation\u2026" : `Preparing dictation\u2026 ${Math.round(progress * 100)}%`,
23
+ serviceBusy: "Dictation is busy right now. Try again in a moment.",
24
+ unavailable: "Dictation is not available in this browser",
25
+ browserPicks: "The browser picks the microphone for dictation.",
26
+ stopped: {
27
+ paused: "Paused. Accept, cancel, or resume.",
28
+ unplugged: "Microphone disconnected",
29
+ dropped: "Dictation stopped: connection lost",
30
+ refused: "Dictation stopped: the speech service refused it",
31
+ quota: "Dictation is paused: the company\u2019s spend limit is reached",
32
+ silence: "Stopped after a long silence. Accept, cancel, or resume.",
33
+ length: "Dictation reached its length limit. Accept, then dictate again to add more."
34
+ },
35
+ defaultDevice: "Default microphone",
36
+ allowToChoose: "Allow microphone access to choose",
37
+ deniedHelp: "Allow the microphone in the site settings next to the address bar, then press the mic again.",
38
+ retry: "Try again",
39
+ recheck: "Look for microphones again",
40
+ gone: "Your chosen microphone is not connected, so the default is used.",
41
+ switched: (device) => `Now using ${device}`,
42
+ level: "Input level"
43
+ };
44
+ function dictationLabels(overrides) {
45
+ if (!overrides) return DICTATION_LABELS;
46
+ return { ...DICTATION_LABELS, ...overrides, stopped: { ...DICTATION_LABELS.stopped, ...overrides.stopped } };
47
+ }
48
+
49
+ export { DICTATION_LABELS, dictationLabels };
@@ -1,4 +1,4 @@
1
- import { keyGlyph, isApplePlatform, Kbd } from './chunk-VBBLHS2Y.js';
1
+ import { keyGlyph, isApplePlatform, Kbd } from './chunk-25LIX6UI.js';
2
2
  import { useMediaMatch } from './chunk-COS6LJ4K.js';
3
3
  import { isComposing } from './chunk-EDPMHSLZ.js';
4
4
  import { cx } from './chunk-ODEQTPFM.js';
@@ -1,4 +1,4 @@
1
- import { useAnnouncer } from './chunk-WGMKERCR.js';
1
+ import { useAnnouncer } from './chunk-AZQBGKPR.js';
2
2
  import { cx } from './chunk-ODEQTPFM.js';
3
3
  import './NewItemsNotice-Q5ED73BQ.css';
4
4
  import { useRef, useEffect } from 'react';
@@ -2,7 +2,7 @@ import { Select } from './chunk-DPCXOBXN.js';
2
2
  import { today, shiftMonth, CalendarGrid, compareDays } from './chunk-EE3DJMSQ.js';
3
3
  import { Popover } from './chunk-SWZV6R46.js';
4
4
  import { Button } from './chunk-YVMIT2OW.js';
5
- import { Input } from './chunk-ZR276S44.js';
5
+ import { Input } from './chunk-NLYURJUF.js';
6
6
  import { IconButton } from './chunk-66H4BC5Z.js';
7
7
  import { isComposing } from './chunk-EDPMHSLZ.js';
8
8
  import { useFocusModality } from './chunk-4ITETIGZ.js';