@agent-native/core 0.175.4 → 0.175.5-nightly-20260827014436

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 (202) hide show
  1. package/corpus/templates/analytics/actions/get-explorer-dashboard.ts +1 -0
  2. package/corpus/templates/analytics/app/components/auth/AuthProvider.tsx +8 -6
  3. package/corpus/templates/analytics/app/components/dashboard/SqlChart.tsx +32 -0
  4. package/corpus/templates/analytics/app/components/layout/Layout.tsx +1 -1
  5. package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +66 -7
  6. package/corpus/templates/analytics/app/lib/prefetch-keys.ts +10 -0
  7. package/corpus/templates/analytics/app/pages/adhoc/explorer-dashboard/index.tsx +9 -7
  8. package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +10 -11
  9. package/corpus/templates/analytics/changelog/2026-08-24-feature-flag-changes-recover-from-temporary-workspace-direct.md +6 -0
  10. package/corpus/templates/analytics/changelog/2026-08-26-analytics-distinguishes-daily-from-weekly-activity-shows-sta.md +6 -0
  11. package/corpus/templates/analytics/changelog/2026-08-26-dashboard-metadata-now-shows-the-original-creator-separately.md +6 -0
  12. package/corpus/templates/analytics/changelog/2026-08-26-dashboard-names-stay-editable-when-the-analytics-sidebar-ref.md +6 -0
  13. package/corpus/templates/analytics/changelog/2026-08-26-fixed-the-agent-re-asking-dashboard-scope-questions-you-had-.md +6 -0
  14. package/corpus/templates/analytics/server/db/schema.ts +2 -0
  15. package/corpus/templates/analytics/server/lib/agent-readable-resource-context.ts +8 -2
  16. package/corpus/templates/analytics/server/lib/dashboards-store.ts +5 -0
  17. package/corpus/templates/analytics/server/lib/first-party-metric-catalog.ts +6 -4
  18. package/corpus/templates/analytics/server/lib/migrate-analytics-artifacts.ts +19 -1
  19. package/corpus/templates/analytics/server/lib/workspace-feature-flags.ts +40 -9
  20. package/corpus/templates/analytics/server/plugins/db.ts +10 -0
  21. package/corpus/templates/analytics/server/routes/api/dashboard-agent-context.json.get.ts +1 -0
  22. package/corpus/templates/analytics/shared/feature-flags.ts +11 -1
  23. package/corpus/templates/calendar/app/components/calendar/GoogleConnectBanner.tsx +2 -9
  24. package/corpus/templates/clips/.agents/skills/ai-video-tools/SKILL.md +8 -7
  25. package/corpus/templates/clips/.agents/skills/recording/SKILL.md +9 -8
  26. package/corpus/templates/clips/actions/import-loom-recording.ts +1 -1
  27. package/corpus/templates/clips/actions/lib/loom-import-job.ts +52 -35
  28. package/corpus/templates/clips/actions/request-transcript.ts +6 -183
  29. package/corpus/templates/clips/app/components/clips-avatar.tsx +46 -0
  30. package/corpus/templates/clips/app/components/library/recording-card.tsx +8 -7
  31. package/corpus/templates/clips/app/components/library/space-card.tsx +8 -5
  32. package/corpus/templates/clips/app/components/meetings/attendee-stack.tsx +7 -8
  33. package/corpus/templates/clips/app/components/meetings/transcript-bubbles.tsx +19 -12
  34. package/corpus/templates/clips/app/components/player/transcript-panel.tsx +128 -94
  35. package/corpus/templates/clips/app/components/recorder/microphone-visualizer.tsx +25 -104
  36. package/corpus/templates/clips/app/components/workspace/members-list.tsx +8 -6
  37. package/corpus/templates/clips/app/components/workspace/notifications-list.tsx +8 -6
  38. package/corpus/templates/clips/app/components/workspace/top-creators-table.tsx +8 -6
  39. package/corpus/templates/clips/app/routes/_app.meetings.$meetingId.tsx +8 -7
  40. package/corpus/templates/clips/app/routes/_app.settings._index.tsx +0 -26
  41. package/corpus/templates/clips/app/routes/r.$recordingId.tsx +1 -4
  42. package/corpus/templates/clips/changelog/2026-08-26-detected-calls-no-longer-duplicate-meetings-or-strand-the-prompt.md +6 -0
  43. package/corpus/templates/clips/desktop/src/app.tsx +8 -10
  44. package/corpus/templates/clips/desktop/src/components/live-waveform.tsx +99 -0
  45. package/corpus/templates/clips/desktop/src/hooks/useMeetingTranscription.ts +248 -55
  46. package/corpus/templates/clips/desktop/src/lib/agent-steps.ts +477 -0
  47. package/corpus/templates/clips/desktop/src/lib/ask-sheet-layout.ts +71 -0
  48. package/corpus/templates/clips/desktop/src/lib/meeting-ask.ts +297 -0
  49. package/corpus/templates/clips/desktop/src/lib/url.ts +24 -0
  50. package/corpus/templates/clips/desktop/src/overlays/ask-steps.tsx +155 -0
  51. package/corpus/templates/clips/desktop/src/overlays/flow-bar.tsx +7 -81
  52. package/corpus/templates/clips/desktop/src/overlays/live-transcript.tsx +29 -2
  53. package/corpus/templates/clips/desktop/src/overlays/meeting-notification.tsx +80 -22
  54. package/corpus/templates/clips/desktop/src/overlays/record-pill.tsx +13 -53
  55. package/corpus/templates/clips/desktop/src/overlays/recording-pill.tsx +1017 -82
  56. package/corpus/templates/clips/desktop/src/styles.css +796 -57
  57. package/corpus/templates/clips/desktop/src/tailwind.css +23 -2
  58. package/corpus/templates/clips/desktop/src-tauri/src/adhoc_meetings_watcher.rs +1765 -219
  59. package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +6 -0
  60. package/corpus/templates/clips/desktop/src-tauri/src/meetings_watcher.rs +45 -30
  61. package/corpus/templates/clips/desktop/src-tauri/src/native_screen/custom_capture.rs +5 -3
  62. package/corpus/templates/clips/desktop/src-tauri/src/notifications.rs +91 -0
  63. package/corpus/templates/clips/desktop/src-tauri/src/recording_indicator.rs +123 -27
  64. package/corpus/templates/clips/server/routes/_agent-native/google/callback.get.ts +16 -0
  65. package/corpus/templates/clips/shared/audio-meter.ts +145 -0
  66. package/corpus/templates/clips/shared/clips-ai-prefs.ts +0 -1
  67. package/corpus/templates/clips/shared/live-waveform.tsx +119 -0
  68. package/corpus/templates/content/app/components/editor/CommentsSidebar.tsx +44 -22
  69. package/corpus/templates/content/app/components/ui/avatar.tsx +1 -0
  70. package/corpus/templates/design/app/components/visual-editor/ReviewCanvasPins.tsx +4 -1
  71. package/corpus/templates/design/app/hooks/use-question-flow.ts +9 -2
  72. package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +111 -37
  73. package/corpus/templates/design/changelog/2026-08-26-design-no-longer-asks-users-to-confirm-guided-questions-they-have-already-answered.md +6 -0
  74. package/corpus/templates/dispatch/changelog/2026-08-26-signing-out-goes-straight-to-the-sign-in-page.md +5 -0
  75. package/corpus/templates/dispatch/server/lib/org-apps-directory.ts +96 -47
  76. package/corpus/templates/dispatch/server/plugins/org-apps-directory.ts +73 -29
  77. package/corpus/templates/factory/.env.example +6 -2
  78. package/corpus/templates/factory/AGENTS.md +3 -3
  79. package/corpus/templates/factory/README.md +4 -2
  80. package/corpus/templates/factory/server/connectors/credentials.ts +70 -4
  81. package/corpus/templates/mail/actions/get-email.ts +68 -21
  82. package/corpus/templates/mail/actions/get-thread.ts +92 -51
  83. package/corpus/templates/mail/app/components/GoogleConnectBanner.tsx +2 -9
  84. package/corpus/templates/mail/app/hooks/use-emails.ts +7 -4
  85. package/corpus/templates/mail/server/lib/mail-connector-catalog.ts +7 -4
  86. package/corpus/templates/plan/app/pages/PlansPage.tsx +23 -15
  87. package/corpus/templates/slides/actions/add-deck.ts +20 -0
  88. package/corpus/templates/slides/actions/create-deck.ts +17 -7
  89. package/corpus/templates/slides/actions/delete-deck.ts +45 -5
  90. package/corpus/templates/slides/actions/get-deck.ts +77 -11
  91. package/corpus/templates/slides/actions/patch-deck.ts +14 -2
  92. package/corpus/templates/slides/actions/save-deck.ts +20 -0
  93. package/corpus/templates/slides/app/components/comments/SlideCommentsPanel.tsx +18 -7
  94. package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +38 -14
  95. package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +2 -2
  96. package/corpus/templates/slides/app/components/ui/avatar.tsx +1 -0
  97. package/corpus/templates/slides/server/handlers/decks.ts +10 -0
  98. package/corpus/templates/slides/shared/slide-ids.ts +133 -0
  99. package/corpus/templates/tasks/DEVELOPING.md +8 -0
  100. package/corpus/templates/tasks/drizzle.config.ts +3 -1
  101. package/corpus/templates/tasks/drizzle.local.config.ts +6 -0
  102. package/corpus/templates/tasks/package.json +2 -1
  103. package/corpus/templates/tasks/server/db/migrations/meta/0000_snapshot.json +234 -0
  104. package/corpus/templates/tasks/server/db/migrations/meta/_journal.json +13 -0
  105. package/corpus/templates/tasks/server/db/migrations.ts +110 -0
  106. package/corpus/templates/tasks/server/plugins/db.ts +3 -87
  107. package/dist/client/AssistantChat.js +3 -10
  108. package/dist/client/guided-questions.d.ts +11 -1
  109. package/dist/client/guided-questions.js +24 -7
  110. package/dist/client/hooks/index.d.ts +2 -1
  111. package/dist/client/hooks/index.js +2 -1
  112. package/dist/client/org/OrgSwitcher.js +3 -17
  113. package/dist/client/review/ReviewThreadPanel.js +4 -2
  114. package/dist/client/sign-out.d.ts +15 -0
  115. package/dist/client/sign-out.js +82 -0
  116. package/dist/client/use-action.d.ts +2 -0
  117. package/dist/client/use-action.js +4 -2
  118. package/dist/client/use-session.d.ts +23 -1
  119. package/dist/client/use-session.js +46 -0
  120. package/dist/collab/client.js +20 -5
  121. package/dist/collab/presence.d.ts +3 -1
  122. package/dist/collab/presence.js +48 -45
  123. package/dist/collab/routes.d.ts +1 -1
  124. package/dist/db/drizzle-config.d.ts +7 -0
  125. package/dist/db/drizzle-config.js +35 -9
  126. package/dist/db/drizzle-migrations.d.ts +28 -0
  127. package/dist/db/drizzle-migrations.js +81 -0
  128. package/dist/db/index.d.ts +1 -1
  129. package/dist/db/migrations.d.ts +13 -1
  130. package/dist/db/migrations.js +60 -31
  131. package/dist/db/schema.js +4 -1
  132. package/dist/deploy/build.d.ts +6 -0
  133. package/dist/deploy/build.js +41 -0
  134. package/dist/file-upload/actions/upload-image.d.ts +1 -1
  135. package/dist/mcp/index.d.ts +1 -1
  136. package/dist/mcp/index.js +1 -1
  137. package/dist/mcp/org-directory.d.ts +19 -7
  138. package/dist/mcp/org-directory.js +92 -68
  139. package/dist/mcp/screen-memory-stdio.d.ts +7 -7
  140. package/dist/notifications/routes.d.ts +3 -3
  141. package/dist/org/context.d.ts +6 -0
  142. package/dist/org/context.js +22 -0
  143. package/dist/org/index.d.ts +1 -1
  144. package/dist/org/index.js +1 -1
  145. package/dist/resources/store.d.ts +12 -0
  146. package/dist/resources/store.js +55 -0
  147. package/dist/server/agent-discovery.d.ts +18 -2
  148. package/dist/server/agent-discovery.js +191 -22
  149. package/dist/server/auth.js +3 -2
  150. package/dist/server/builder-browser.d.ts +0 -4
  151. package/dist/server/builder-browser.js +23 -8
  152. package/dist/server/google-oauth.d.ts +18 -0
  153. package/dist/server/google-oauth.js +3 -3
  154. package/dist/server/onboarding-html.js +3 -3
  155. package/dist/server/poll.d.ts +4 -2
  156. package/dist/server/poll.js +8 -3
  157. package/dist/server/realtime-token.d.ts +1 -1
  158. package/dist/server/short-lived-token.d.ts +1 -1
  159. package/dist/server/short-lived-token.js +1 -1
  160. package/dist/shared/environment-lanes.d.ts +1 -0
  161. package/dist/shared/environment-lanes.js +1 -0
  162. package/dist/shared/google-profile-image.d.ts +2 -0
  163. package/dist/shared/google-profile-image.js +24 -0
  164. package/dist/shared/index.d.ts +1 -0
  165. package/dist/shared/index.js +1 -0
  166. package/dist/styles/agent-conversation.css +13 -0
  167. package/docs/content/creating-templates.mdx +10 -1
  168. package/docs/content/server-database.mdx +49 -3
  169. package/docs/content/server-plugins.mdx +39 -3
  170. package/docs/content/webmcp.mdx +2 -0
  171. package/package.json +2 -1
  172. package/corpus/templates/analytics/data/explorer-configs/_autosave.json +0 -18
  173. package/corpus/templates/analytics/data/explorer-configs/steve-chart.json +0 -18
  174. package/corpus/templates/analytics/data/explorer-dashboards/dashboard-1773260837897.json +0 -10
  175. package/corpus/templates/analytics/data/sync-config.json +0 -8
  176. package/corpus/templates/brain/data/sync-config.json +0 -1
  177. package/corpus/templates/calendar/data/availability.json +0 -32
  178. package/corpus/templates/calendar/data/settings.json +0 -6
  179. package/corpus/templates/calendar/data/sync-config.json +0 -10
  180. package/corpus/templates/chat/data/sync-config.json +0 -1
  181. package/corpus/templates/clips/data/sync-config.json +0 -1
  182. package/corpus/templates/clips/desktop/src/lib/audio-meter.ts +0 -80
  183. package/corpus/templates/clips/desktop/src/overlays/live-audio-bars.tsx +0 -113
  184. package/corpus/templates/design/data/sync-config.json +0 -1
  185. package/corpus/templates/factory/data/sync-config.json +0 -1
  186. package/corpus/templates/forms/data/settings.json +0 -8
  187. package/corpus/templates/forms/data/sync-config.json +0 -3
  188. package/corpus/templates/macros/data/sync-config.json +0 -4
  189. package/corpus/templates/mail/data/emails.defaults.json +0 -1
  190. package/corpus/templates/mail/data/labels.defaults.json +0 -59
  191. package/corpus/templates/mail/data/settings.defaults.json +0 -9
  192. package/corpus/templates/mail/data/sync-config.json +0 -8
  193. package/corpus/templates/slides/data/sync-config.json +0 -8
  194. package/corpus/templates/tasks/data/sync-config.json +0 -1
  195. package/dist/templates/chat/data/.gitkeep +0 -0
  196. package/dist/templates/chat/data/sync-config.json +0 -1
  197. package/dist/templates/default/data/.gitkeep +0 -0
  198. package/dist/templates/default/data/sync-config.json +0 -1
  199. package/src/templates/chat/data/.gitkeep +0 -0
  200. package/src/templates/chat/data/sync-config.json +0 -1
  201. package/src/templates/default/data/.gitkeep +0 -0
  202. package/src/templates/default/data/sync-config.json +0 -1
@@ -129,6 +129,9 @@ export function MeetingNotification() {
129
129
  const [pending, setPending] = useState(false);
130
130
  const autoHideTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
131
131
  const dataRef = useRef<NotificationData | null>(null);
132
+ /** What this reminder was showing when it stepped aside for a starting pill.
133
+ * Held only until that start reports success or failure. */
134
+ const startingRef = useRef<NotificationData | null>(null);
132
135
  const dismissedKeysRef = useRef(new Map<string, number>());
133
136
  // Real DOM hover only fires while this overlay window is key, which macOS
134
137
  // won't grant it without a click (`show_without_activation` never
@@ -206,6 +209,14 @@ export function MeetingNotification() {
206
209
  options?: { hydrated?: boolean },
207
210
  ) {
208
211
  if (isDismissed(payload)) return;
212
+ // A newer reminder owns this card now. Whatever start was holding it open
213
+ // for a possible failure has lost its claim, so it cannot reappear over
214
+ // this one later.
215
+ startingRef.current = null;
216
+ // A visible reminder means a pill is likely within a minute or two. Build
217
+ // its webview now, hidden: on the first meeting of a session that build
218
+ // otherwise lands between the click and anything appearing.
219
+ invoke("recording_pill_prewarm").catch(() => {});
209
220
  setData(payload);
210
221
  setError(null);
211
222
  setMenuOpen(false);
@@ -237,11 +248,13 @@ export function MeetingNotification() {
237
248
  }).catch(() => {});
238
249
  };
239
250
 
240
- trackListen(
241
- listen<NotificationData>("meetings:show-notification", (ev) => {
251
+ const showListener = listen<NotificationData>(
252
+ "meetings:show-notification",
253
+ (ev) => {
242
254
  showNotification(ev.payload);
243
- }),
255
+ },
244
256
  );
257
+ trackListen(showListener);
245
258
 
246
259
  trackListen(
247
260
  listen<{ hovered: boolean }>("meetings:notification-hover", (ev) => {
@@ -249,33 +262,75 @@ export function MeetingNotification() {
249
262
  }),
250
263
  );
251
264
 
265
+ const hideListener = listen<TranscriptionStatusPayload>(
266
+ "meetings:hide-notification",
267
+ (ev) => {
268
+ if (ev.payload.meetingId !== dataRef.current?.meetingId) return;
269
+ // Startup hides this as soon as the pill is on screen, before capture
270
+ // has attached. Keep what was on screen so a failure after that point
271
+ // still has something to reappear as.
272
+ startingRef.current = dataRef.current;
273
+ hideNotification();
274
+ },
275
+ );
276
+ trackListen(hideListener);
277
+ const errorListener = listen<TranscriptionStatusPayload>(
278
+ "meetings:transcription-error",
279
+ (ev) => {
280
+ // `hideNotification` nulls `dataRef`, so matching only against it
281
+ // drops the error for exactly the case that produces one: a start
282
+ // that failed after the reminder stepped aside.
283
+ const starting = startingRef.current;
284
+ const restoring =
285
+ !dataRef.current &&
286
+ starting !== null &&
287
+ starting.meetingId === ev.payload.meetingId;
288
+ if (!restoring && ev.payload.meetingId !== dataRef.current?.meetingId)
289
+ return;
290
+ if (restoring) {
291
+ setData(starting);
292
+ setMenuOpen(false);
293
+ }
294
+ startingRef.current = null;
295
+ setPending(false);
296
+ setError(ev.payload.error || "Could not start notes.");
297
+ scheduleAutoHide(15_000);
298
+ },
299
+ );
300
+ trackListen(errorListener);
301
+ const startedListener = listen<TranscriptionStatusPayload>(
302
+ "meetings:transcription-started",
303
+ (ev) => {
304
+ if (startingRef.current?.meetingId === ev.payload.meetingId) {
305
+ startingRef.current = null;
306
+ }
307
+ },
308
+ );
309
+ trackListen(startedListener);
310
+
252
311
  // Cold overlay boot: hydrate any payload stored before this webview
253
312
  // mounted (calendar or adhoc).
254
- invoke<NotificationData | null>("take_pending_meeting_notification")
313
+ //
314
+ // Every listener has to be live first, because `take` is destructive and
315
+ // each event lost in the gap is lost permanently. A hide landing before the
316
+ // hide listener registers leaves a card nothing can take back; a show
317
+ // landing before the show listener registers is dropped while the payload it
318
+ // duplicated has already been consumed, so no card appears at all.
319
+ Promise.all([showListener, hideListener, errorListener, startedListener])
320
+ .then(() =>
321
+ invoke<NotificationData | null>("take_pending_meeting_notification"),
322
+ )
255
323
  .then((pending) => {
256
324
  if (stopped || !pending) return;
325
+ // The take is asynchronous, so a live `meetings:show-notification` may
326
+ // have arrived while it was in flight. That payload is newer than this
327
+ // one by definition, and hydration is only a cold-boot fallback, so it
328
+ // must not replace what the live path already put on screen.
329
+ if (dataRef.current) return;
257
330
  showNotification(pending, { hydrated: true });
258
331
  })
259
332
  .catch(() => {});
260
333
 
261
- trackListen(
262
- listen<TranscriptionStatusPayload>("meetings:hide-notification", (ev) => {
263
- if (ev.payload.meetingId !== dataRef.current?.meetingId) return;
264
- hideNotification();
265
- }),
266
- );
267
- trackListen(
268
- listen<TranscriptionStatusPayload>(
269
- "meetings:transcription-error",
270
- (ev) => {
271
- if (ev.payload.meetingId !== dataRef.current?.meetingId) return;
272
- setPending(false);
273
- setError(ev.payload.error || "Could not start notes.");
274
- scheduleAutoHide(15_000);
275
- },
276
- ),
277
- );
278
-
279
334
  return () => {
280
335
  stopped = true;
281
336
  clearAutoHide();
@@ -329,6 +384,9 @@ export function MeetingNotification() {
329
384
 
330
385
  function dismissNotification() {
331
386
  const current = dataRef.current;
387
+ // An explicit dismissal outranks a pending start: this reminder must not
388
+ // come back on its own, even to report a failure.
389
+ startingRef.current = null;
332
390
  if (current) {
333
391
  dismissedKeysRef.current.set(
334
392
  notificationKey(current),
@@ -20,6 +20,7 @@ import { useEffect, useRef, useState } from "react";
20
20
  import type { FocusEvent } from "react";
21
21
  import { flushSync } from "react-dom";
22
22
 
23
+ import { LiveWaveform } from "../components/live-waveform";
23
24
  import {
24
25
  completionCardState,
25
26
  isCompletionForSession,
@@ -130,7 +131,8 @@ export function RecordingPill() {
130
131
  const [paused, setPaused] = useState(false);
131
132
  const [elapsed, setElapsed] = useState(0);
132
133
  const [enabled, setEnabled] = useState(demoMode);
133
- const [barHeights, setBarHeights] = useState<number[]>([4, 4, 4, 4, 4]);
134
+ /** Demo harness only: the meter reads capture events in the real app. */
135
+ const [demoLevel, setDemoLevel] = useState<number | null>(null);
134
136
  const [announcement, setAnnouncement] = useState("");
135
137
  const [confirmQuestion, setConfirmQuestion] = useState("");
136
138
  // What the confirm's action button does. Both intents share the confirm
@@ -164,7 +166,6 @@ export function RecordingPill() {
164
166
  const fallbackTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
165
167
  const shrinkTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
166
168
  const stallTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
167
- const levelDecayRef = useRef<ReturnType<typeof setTimeout> | null>(null);
168
169
  const animatingUntilRef = useRef(0);
169
170
  const pauseTransitionRef = useRef<"pause" | "resume" | null>(null);
170
171
  const pauseTransitionTimerRef = useRef<ReturnType<typeof setTimeout> | null>(
@@ -188,32 +189,6 @@ export function RecordingPill() {
188
189
  elapsedRef.current = elapsed;
189
190
  viewUrlRef.current = viewUrl;
190
191
 
191
- // Auto-gain state: raw mic peaks rarely pass ~0.3 even when shouting, so a
192
- // fixed scale leaves the meter nearly flat. Levels are normalized against a
193
- // slowly-decaying rolling peak, like a real meter's AGC.
194
- const meterGainRef = useRef(0.04);
195
- const meterHistoryRef = useRef<number[]>([0, 0, 0, 0, 0]);
196
-
197
- /**
198
- * Each level event pushes one normalized sample through a five-slot
199
- * history, so the lines are the actual signal scrolling by — a waveform,
200
- * not a glyph — and shouting pins them to the top of the range.
201
- */
202
- function applyMicLevel(raw: number) {
203
- const level = Math.max(0, Math.min(1, raw));
204
- meterGainRef.current = Math.max(level, meterGainRef.current * 0.985, 0.04);
205
- const norm = Math.min(1, level / meterGainRef.current) ** 0.7;
206
- const history = meterHistoryRef.current;
207
- history.shift();
208
- history.push(norm);
209
- setBarHeights(history.map((v) => 3 + Math.round(v * 11)));
210
- if (levelDecayRef.current) clearTimeout(levelDecayRef.current);
211
- levelDecayRef.current = setTimeout(() => {
212
- meterHistoryRef.current = [0, 0, 0, 0, 0];
213
- setBarHeights([4, 4, 4, 4, 4]);
214
- }, 350);
215
- }
216
-
217
192
  function clearPauseTransition() {
218
193
  pauseTransitionRef.current = null;
219
194
  if (pauseTransitionTimerRef.current) {
@@ -784,19 +759,13 @@ export function RecordingPill() {
784
759
  else void safeInvoke("show_popover");
785
760
  }),
786
761
  );
787
- track(
788
- safeListen<{ level?: number; source?: string }>(
789
- "voice:audio-level",
790
- (payload) => {
791
- if ((payload?.source ?? "mic") !== "mic") return;
792
- applyMicLevel(Number(payload?.level) || 0);
793
- },
794
- ),
795
- );
796
762
  // The handshake goes out only once our own listeners exist. The recorder
797
763
  // answers `toolbar-ready` immediately, and `listen()` is asynchronous, so
798
764
  // emitting first can drop the reply — costing the pill its enable and its
799
765
  // session identity until some later event happens to arrive.
766
+ //
767
+ // The audio-level listener that used to sit here is gone: the meter is the
768
+ // shared `LiveWaveform`, which subscribes to capture itself.
800
769
  void Promise.allSettled(registrations).then((results) => {
801
770
  const failures = results.flatMap((r) =>
802
771
  r.status === "rejected" ? [r.reason] : [],
@@ -821,7 +790,6 @@ export function RecordingPill() {
821
790
  fallbackTimerRef,
822
791
  shrinkTimerRef,
823
792
  stallTimerRef,
824
- levelDecayRef,
825
793
  pauseTransitionTimerRef,
826
794
  ]) {
827
795
  if (t.current) clearTimeout(t.current);
@@ -940,7 +908,7 @@ export function RecordingPill() {
940
908
  }, 500);
941
909
  const levels = setInterval(() => {
942
910
  if (modeRef.current !== "done" && !pausedRef.current) {
943
- applyMicLevel(0.05 + Math.random() * 0.3);
911
+ setDemoLevel(0.05 + Math.random() * 0.3);
944
912
  }
945
913
  }, 90);
946
914
  return () => {
@@ -1051,7 +1019,6 @@ export function RecordingPill() {
1051
1019
  const showPaused = paused;
1052
1020
  const meterFlat = showPaused || !enabled;
1053
1021
  const timerText = formatTimer(elapsed);
1054
- const shownBarHeights = meterFlat ? [4, 4, 4, 4, 4] : barHeights;
1055
1022
 
1056
1023
  const card = completionCardState(doneStage, {
1057
1024
  hasLink: Boolean(viewUrl),
@@ -1210,19 +1177,12 @@ export function RecordingPill() {
1210
1177
  style={{ width: "auto", opacity: 1 }}
1211
1178
  >
1212
1179
  <span className="inline-flex flex-none items-center">
1213
- <span
1214
- aria-hidden
1215
- className="ml-3.5 flex h-3.5 w-[18px] flex-none items-center justify-center gap-[2px] transition-opacity duration-150"
1216
- style={{ opacity: meterFlat ? 0.3 : 1 }}
1217
- >
1218
- {shownBarHeights.map((h, i) => (
1219
- <i
1220
- key={i}
1221
- className="block w-[2px] rounded-full bg-[var(--pill-meter)] transition-[height] duration-100 ease-out"
1222
- style={{ height: `${h}px` }}
1223
- />
1224
- ))}
1225
- </span>
1180
+ <LiveWaveform
1181
+ className="ml-3.5 h-3.5 w-[18px] flex-none"
1182
+ sources="mic"
1183
+ dimmed={meterFlat}
1184
+ level={demoMode ? demoLevel : null}
1185
+ />
1226
1186
  <button
1227
1187
  type="button"
1228
1188
  onClick={togglePause}