@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.
- package/corpus/templates/analytics/actions/get-explorer-dashboard.ts +1 -0
- package/corpus/templates/analytics/app/components/auth/AuthProvider.tsx +8 -6
- package/corpus/templates/analytics/app/components/dashboard/SqlChart.tsx +32 -0
- package/corpus/templates/analytics/app/components/layout/Layout.tsx +1 -1
- package/corpus/templates/analytics/app/components/layout/Sidebar.tsx +66 -7
- package/corpus/templates/analytics/app/lib/prefetch-keys.ts +10 -0
- package/corpus/templates/analytics/app/pages/adhoc/explorer-dashboard/index.tsx +9 -7
- package/corpus/templates/analytics/app/pages/adhoc/sql-dashboard/index.tsx +10 -11
- package/corpus/templates/analytics/changelog/2026-08-24-feature-flag-changes-recover-from-temporary-workspace-direct.md +6 -0
- package/corpus/templates/analytics/changelog/2026-08-26-analytics-distinguishes-daily-from-weekly-activity-shows-sta.md +6 -0
- package/corpus/templates/analytics/changelog/2026-08-26-dashboard-metadata-now-shows-the-original-creator-separately.md +6 -0
- package/corpus/templates/analytics/changelog/2026-08-26-dashboard-names-stay-editable-when-the-analytics-sidebar-ref.md +6 -0
- package/corpus/templates/analytics/changelog/2026-08-26-fixed-the-agent-re-asking-dashboard-scope-questions-you-had-.md +6 -0
- package/corpus/templates/analytics/server/db/schema.ts +2 -0
- package/corpus/templates/analytics/server/lib/agent-readable-resource-context.ts +8 -2
- package/corpus/templates/analytics/server/lib/dashboards-store.ts +5 -0
- package/corpus/templates/analytics/server/lib/first-party-metric-catalog.ts +6 -4
- package/corpus/templates/analytics/server/lib/migrate-analytics-artifacts.ts +19 -1
- package/corpus/templates/analytics/server/lib/workspace-feature-flags.ts +40 -9
- package/corpus/templates/analytics/server/plugins/db.ts +10 -0
- package/corpus/templates/analytics/server/routes/api/dashboard-agent-context.json.get.ts +1 -0
- package/corpus/templates/analytics/shared/feature-flags.ts +11 -1
- package/corpus/templates/calendar/app/components/calendar/GoogleConnectBanner.tsx +2 -9
- package/corpus/templates/clips/.agents/skills/ai-video-tools/SKILL.md +8 -7
- package/corpus/templates/clips/.agents/skills/recording/SKILL.md +9 -8
- package/corpus/templates/clips/actions/import-loom-recording.ts +1 -1
- package/corpus/templates/clips/actions/lib/loom-import-job.ts +52 -35
- package/corpus/templates/clips/actions/request-transcript.ts +6 -183
- package/corpus/templates/clips/app/components/clips-avatar.tsx +46 -0
- package/corpus/templates/clips/app/components/library/recording-card.tsx +8 -7
- package/corpus/templates/clips/app/components/library/space-card.tsx +8 -5
- package/corpus/templates/clips/app/components/meetings/attendee-stack.tsx +7 -8
- package/corpus/templates/clips/app/components/meetings/transcript-bubbles.tsx +19 -12
- package/corpus/templates/clips/app/components/player/transcript-panel.tsx +128 -94
- package/corpus/templates/clips/app/components/recorder/microphone-visualizer.tsx +25 -104
- package/corpus/templates/clips/app/components/workspace/members-list.tsx +8 -6
- package/corpus/templates/clips/app/components/workspace/notifications-list.tsx +8 -6
- package/corpus/templates/clips/app/components/workspace/top-creators-table.tsx +8 -6
- package/corpus/templates/clips/app/routes/_app.meetings.$meetingId.tsx +8 -7
- package/corpus/templates/clips/app/routes/_app.settings._index.tsx +0 -26
- package/corpus/templates/clips/app/routes/r.$recordingId.tsx +1 -4
- package/corpus/templates/clips/changelog/2026-08-26-detected-calls-no-longer-duplicate-meetings-or-strand-the-prompt.md +6 -0
- package/corpus/templates/clips/desktop/src/app.tsx +8 -10
- package/corpus/templates/clips/desktop/src/components/live-waveform.tsx +99 -0
- package/corpus/templates/clips/desktop/src/hooks/useMeetingTranscription.ts +248 -55
- package/corpus/templates/clips/desktop/src/lib/agent-steps.ts +477 -0
- package/corpus/templates/clips/desktop/src/lib/ask-sheet-layout.ts +71 -0
- package/corpus/templates/clips/desktop/src/lib/meeting-ask.ts +297 -0
- package/corpus/templates/clips/desktop/src/lib/url.ts +24 -0
- package/corpus/templates/clips/desktop/src/overlays/ask-steps.tsx +155 -0
- package/corpus/templates/clips/desktop/src/overlays/flow-bar.tsx +7 -81
- package/corpus/templates/clips/desktop/src/overlays/live-transcript.tsx +29 -2
- package/corpus/templates/clips/desktop/src/overlays/meeting-notification.tsx +80 -22
- package/corpus/templates/clips/desktop/src/overlays/record-pill.tsx +13 -53
- package/corpus/templates/clips/desktop/src/overlays/recording-pill.tsx +1017 -82
- package/corpus/templates/clips/desktop/src/styles.css +796 -57
- package/corpus/templates/clips/desktop/src/tailwind.css +23 -2
- package/corpus/templates/clips/desktop/src-tauri/src/adhoc_meetings_watcher.rs +1765 -219
- package/corpus/templates/clips/desktop/src-tauri/src/lib.rs +6 -0
- package/corpus/templates/clips/desktop/src-tauri/src/meetings_watcher.rs +45 -30
- package/corpus/templates/clips/desktop/src-tauri/src/native_screen/custom_capture.rs +5 -3
- package/corpus/templates/clips/desktop/src-tauri/src/notifications.rs +91 -0
- package/corpus/templates/clips/desktop/src-tauri/src/recording_indicator.rs +123 -27
- package/corpus/templates/clips/server/routes/_agent-native/google/callback.get.ts +16 -0
- package/corpus/templates/clips/shared/audio-meter.ts +145 -0
- package/corpus/templates/clips/shared/clips-ai-prefs.ts +0 -1
- package/corpus/templates/clips/shared/live-waveform.tsx +119 -0
- package/corpus/templates/content/app/components/editor/CommentsSidebar.tsx +44 -22
- package/corpus/templates/content/app/components/ui/avatar.tsx +1 -0
- package/corpus/templates/design/app/components/visual-editor/ReviewCanvasPins.tsx +4 -1
- package/corpus/templates/design/app/hooks/use-question-flow.ts +9 -2
- package/corpus/templates/design/app/pages/DesignSystemSetup.tsx +111 -37
- package/corpus/templates/design/changelog/2026-08-26-design-no-longer-asks-users-to-confirm-guided-questions-they-have-already-answered.md +6 -0
- package/corpus/templates/dispatch/changelog/2026-08-26-signing-out-goes-straight-to-the-sign-in-page.md +5 -0
- package/corpus/templates/dispatch/server/lib/org-apps-directory.ts +96 -47
- package/corpus/templates/dispatch/server/plugins/org-apps-directory.ts +73 -29
- package/corpus/templates/factory/.env.example +6 -2
- package/corpus/templates/factory/AGENTS.md +3 -3
- package/corpus/templates/factory/README.md +4 -2
- package/corpus/templates/factory/server/connectors/credentials.ts +70 -4
- package/corpus/templates/mail/actions/get-email.ts +68 -21
- package/corpus/templates/mail/actions/get-thread.ts +92 -51
- package/corpus/templates/mail/app/components/GoogleConnectBanner.tsx +2 -9
- package/corpus/templates/mail/app/hooks/use-emails.ts +7 -4
- package/corpus/templates/mail/server/lib/mail-connector-catalog.ts +7 -4
- package/corpus/templates/plan/app/pages/PlansPage.tsx +23 -15
- package/corpus/templates/slides/actions/add-deck.ts +20 -0
- package/corpus/templates/slides/actions/create-deck.ts +17 -7
- package/corpus/templates/slides/actions/delete-deck.ts +45 -5
- package/corpus/templates/slides/actions/get-deck.ts +77 -11
- package/corpus/templates/slides/actions/patch-deck.ts +14 -2
- package/corpus/templates/slides/actions/save-deck.ts +20 -0
- package/corpus/templates/slides/app/components/comments/SlideCommentsPanel.tsx +18 -7
- package/corpus/templates/slides/app/components/design-system/DesignSystemSetup.tsx +38 -14
- package/corpus/templates/slides/app/components/editor/EditorToolbar.tsx +2 -2
- package/corpus/templates/slides/app/components/ui/avatar.tsx +1 -0
- package/corpus/templates/slides/server/handlers/decks.ts +10 -0
- package/corpus/templates/slides/shared/slide-ids.ts +133 -0
- package/corpus/templates/tasks/DEVELOPING.md +8 -0
- package/corpus/templates/tasks/drizzle.config.ts +3 -1
- package/corpus/templates/tasks/drizzle.local.config.ts +6 -0
- package/corpus/templates/tasks/package.json +2 -1
- package/corpus/templates/tasks/server/db/migrations/meta/0000_snapshot.json +234 -0
- package/corpus/templates/tasks/server/db/migrations/meta/_journal.json +13 -0
- package/corpus/templates/tasks/server/db/migrations.ts +110 -0
- package/corpus/templates/tasks/server/plugins/db.ts +3 -87
- package/dist/client/AssistantChat.js +3 -10
- package/dist/client/guided-questions.d.ts +11 -1
- package/dist/client/guided-questions.js +24 -7
- package/dist/client/hooks/index.d.ts +2 -1
- package/dist/client/hooks/index.js +2 -1
- package/dist/client/org/OrgSwitcher.js +3 -17
- package/dist/client/review/ReviewThreadPanel.js +4 -2
- package/dist/client/sign-out.d.ts +15 -0
- package/dist/client/sign-out.js +82 -0
- package/dist/client/use-action.d.ts +2 -0
- package/dist/client/use-action.js +4 -2
- package/dist/client/use-session.d.ts +23 -1
- package/dist/client/use-session.js +46 -0
- package/dist/collab/client.js +20 -5
- package/dist/collab/presence.d.ts +3 -1
- package/dist/collab/presence.js +48 -45
- package/dist/collab/routes.d.ts +1 -1
- package/dist/db/drizzle-config.d.ts +7 -0
- package/dist/db/drizzle-config.js +35 -9
- package/dist/db/drizzle-migrations.d.ts +28 -0
- package/dist/db/drizzle-migrations.js +81 -0
- package/dist/db/index.d.ts +1 -1
- package/dist/db/migrations.d.ts +13 -1
- package/dist/db/migrations.js +60 -31
- package/dist/db/schema.js +4 -1
- package/dist/deploy/build.d.ts +6 -0
- package/dist/deploy/build.js +41 -0
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/mcp/index.d.ts +1 -1
- package/dist/mcp/index.js +1 -1
- package/dist/mcp/org-directory.d.ts +19 -7
- package/dist/mcp/org-directory.js +92 -68
- package/dist/mcp/screen-memory-stdio.d.ts +7 -7
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/org/context.d.ts +6 -0
- package/dist/org/context.js +22 -0
- package/dist/org/index.d.ts +1 -1
- package/dist/org/index.js +1 -1
- package/dist/resources/store.d.ts +12 -0
- package/dist/resources/store.js +55 -0
- package/dist/server/agent-discovery.d.ts +18 -2
- package/dist/server/agent-discovery.js +191 -22
- package/dist/server/auth.js +3 -2
- package/dist/server/builder-browser.d.ts +0 -4
- package/dist/server/builder-browser.js +23 -8
- package/dist/server/google-oauth.d.ts +18 -0
- package/dist/server/google-oauth.js +3 -3
- package/dist/server/onboarding-html.js +3 -3
- package/dist/server/poll.d.ts +4 -2
- package/dist/server/poll.js +8 -3
- package/dist/server/realtime-token.d.ts +1 -1
- package/dist/server/short-lived-token.d.ts +1 -1
- package/dist/server/short-lived-token.js +1 -1
- package/dist/shared/environment-lanes.d.ts +1 -0
- package/dist/shared/environment-lanes.js +1 -0
- package/dist/shared/google-profile-image.d.ts +2 -0
- package/dist/shared/google-profile-image.js +24 -0
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.js +1 -0
- package/dist/styles/agent-conversation.css +13 -0
- package/docs/content/creating-templates.mdx +10 -1
- package/docs/content/server-database.mdx +49 -3
- package/docs/content/server-plugins.mdx +39 -3
- package/docs/content/webmcp.mdx +2 -0
- package/package.json +2 -1
- package/corpus/templates/analytics/data/explorer-configs/_autosave.json +0 -18
- package/corpus/templates/analytics/data/explorer-configs/steve-chart.json +0 -18
- package/corpus/templates/analytics/data/explorer-dashboards/dashboard-1773260837897.json +0 -10
- package/corpus/templates/analytics/data/sync-config.json +0 -8
- package/corpus/templates/brain/data/sync-config.json +0 -1
- package/corpus/templates/calendar/data/availability.json +0 -32
- package/corpus/templates/calendar/data/settings.json +0 -6
- package/corpus/templates/calendar/data/sync-config.json +0 -10
- package/corpus/templates/chat/data/sync-config.json +0 -1
- package/corpus/templates/clips/data/sync-config.json +0 -1
- package/corpus/templates/clips/desktop/src/lib/audio-meter.ts +0 -80
- package/corpus/templates/clips/desktop/src/overlays/live-audio-bars.tsx +0 -113
- package/corpus/templates/design/data/sync-config.json +0 -1
- package/corpus/templates/factory/data/sync-config.json +0 -1
- package/corpus/templates/forms/data/settings.json +0 -8
- package/corpus/templates/forms/data/sync-config.json +0 -3
- package/corpus/templates/macros/data/sync-config.json +0 -4
- package/corpus/templates/mail/data/emails.defaults.json +0 -1
- package/corpus/templates/mail/data/labels.defaults.json +0 -59
- package/corpus/templates/mail/data/settings.defaults.json +0 -9
- package/corpus/templates/mail/data/sync-config.json +0 -8
- package/corpus/templates/slides/data/sync-config.json +0 -8
- package/corpus/templates/tasks/data/sync-config.json +0 -1
- package/dist/templates/chat/data/.gitkeep +0 -0
- package/dist/templates/chat/data/sync-config.json +0 -1
- package/dist/templates/default/data/.gitkeep +0 -0
- package/dist/templates/default/data/sync-config.json +0 -1
- package/src/templates/chat/data/.gitkeep +0 -0
- package/src/templates/chat/data/sync-config.json +0 -1
- package/src/templates/default/data/.gitkeep +0 -0
- package/src/templates/default/data/sync-config.json +0 -1
|
@@ -4,29 +4,67 @@ import {
|
|
|
4
4
|
IconChevronDown,
|
|
5
5
|
IconChevronUp,
|
|
6
6
|
IconCopy,
|
|
7
|
-
IconExternalLink,
|
|
8
7
|
IconLoader2,
|
|
9
8
|
IconPlayerPauseFilled,
|
|
10
9
|
IconPlayerPlayFilled,
|
|
11
|
-
IconPlayerStopFilled,
|
|
12
10
|
IconX,
|
|
13
11
|
} from "@tabler/icons-react";
|
|
14
12
|
import { invoke } from "@tauri-apps/api/core";
|
|
13
|
+
import { PhysicalSize } from "@tauri-apps/api/dpi";
|
|
15
14
|
import { emit, listen } from "@tauri-apps/api/event";
|
|
16
15
|
import { getCurrentWindow } from "@tauri-apps/api/window";
|
|
17
16
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
18
17
|
|
|
18
|
+
import { LiveWaveform } from "../components/live-waveform";
|
|
19
|
+
import { Button } from "../components/ui/button";
|
|
20
|
+
import { Spinner } from "../components/ui/spinner";
|
|
21
|
+
import { applyFrame, settleSteps, type AgentStep } from "../lib/agent-steps";
|
|
22
|
+
import {
|
|
23
|
+
ASK_SHEET_DEFAULT,
|
|
24
|
+
ASK_SHEET_DISMISS_AT,
|
|
25
|
+
clampAskSheetHeight,
|
|
26
|
+
isPinnedToBottom,
|
|
27
|
+
isSheetGripTap,
|
|
28
|
+
} from "../lib/ask-sheet-layout";
|
|
29
|
+
import {
|
|
30
|
+
type AskTurn,
|
|
31
|
+
buildMeetingAskPrompt,
|
|
32
|
+
fenceTranscript,
|
|
33
|
+
MAX_ASK_HISTORY_TURNS,
|
|
34
|
+
streamMeetingAsk,
|
|
35
|
+
} from "../lib/meeting-ask";
|
|
19
36
|
import { isDirectPillClick, type ScreenPoint } from "../lib/pill-interaction";
|
|
20
37
|
import { speakerFor, type TranscriptLine } from "../lib/transcription-engine";
|
|
21
|
-
import {
|
|
38
|
+
import { loadStoredServerUrl } from "../lib/url";
|
|
39
|
+
import { AskSteps } from "./ask-steps";
|
|
22
40
|
import { LiveTranscript, type FinalLine } from "./live-transcript";
|
|
23
41
|
import { PillLogo } from "./pill-logo";
|
|
24
42
|
|
|
43
|
+
/** Cap height as a fraction of font size, for the system faces this stack
|
|
44
|
+
* resolves to. Used to find a line of text's optical centre. */
|
|
45
|
+
const CAP_HEIGHT_RATIO = 0.72;
|
|
46
|
+
|
|
47
|
+
/** A cursor crossing the capsule should not open it. Matches the recorder. */
|
|
48
|
+
const HOVER_INTENT_MS = 150;
|
|
49
|
+
|
|
50
|
+
/** The capsule's one spacing step, matched in styles.css. */
|
|
51
|
+
const TRANSPORT_GAP_PX = 8;
|
|
52
|
+
|
|
53
|
+
/** Longer than any reveal transition. Past this the browser is not advancing
|
|
54
|
+
* the animation, so the reveal has to finish itself. */
|
|
55
|
+
const TRANSITION_STALL_MS = 400;
|
|
56
|
+
|
|
57
|
+
/** Matches `pill-ask-sheet-out` in styles.css. */
|
|
58
|
+
const ASK_SHEET_EXIT_MS = 200;
|
|
59
|
+
|
|
25
60
|
type PillMode = "meeting" | "clip";
|
|
26
61
|
|
|
27
62
|
interface PillContext {
|
|
28
63
|
meetingId?: string | null;
|
|
29
64
|
mode?: PillMode;
|
|
65
|
+
title?: string | null;
|
|
66
|
+
/** On screen, but capture has not attached yet. Never claim "recording". */
|
|
67
|
+
starting?: boolean;
|
|
30
68
|
}
|
|
31
69
|
|
|
32
70
|
/**
|
|
@@ -40,9 +78,14 @@ interface PillContext {
|
|
|
40
78
|
* and capture-excluded — see `recording_indicator.rs`. We only deal with
|
|
41
79
|
* sizing the window when the user toggles the chevron.
|
|
42
80
|
*/
|
|
81
|
+
const pillDemoMode = import.meta.env.DEV && !("__TAURI_INTERNALS__" in window);
|
|
82
|
+
|
|
43
83
|
export function MeetingPill() {
|
|
44
84
|
const [expanded, setExpanded] = useState(false);
|
|
45
85
|
const [paused, setPaused] = useState(false);
|
|
86
|
+
/** Demo harness only: the meter reads capture events in the real app. */
|
|
87
|
+
const [demoLevel, setDemoLevel] = useState<number | null>(null);
|
|
88
|
+
const demoLevelTimerRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
|
46
89
|
const [elapsed, setElapsed] = useState(0);
|
|
47
90
|
const [ctx, setCtx] = useState<PillContext>({ mode: "clip" });
|
|
48
91
|
const ctxRef = useRef<PillContext>({ mode: "clip" });
|
|
@@ -57,6 +100,79 @@ export function MeetingPill() {
|
|
|
57
100
|
const [transcriptCopied, setTranscriptCopied] = useState(false);
|
|
58
101
|
const [preloadedLines, setPreloadedLines] = useState<FinalLine[]>([]);
|
|
59
102
|
const [ask, setAsk] = useState("");
|
|
103
|
+
// Inline ask conversation (the Wispr interaction): a sheet rises from the
|
|
104
|
+
// composer with the running exchange — user questions as chat bubbles,
|
|
105
|
+
// streamed answers, and contextual suggestion chips. In Tauri the answers
|
|
106
|
+
// stream live from the agent chat (see `streamMeetingAsk`); the demo
|
|
107
|
+
// branch streams canned answers so the interaction stays designable in a
|
|
108
|
+
// plain browser tab.
|
|
109
|
+
const [askMessages, setAskMessages] = useState<
|
|
110
|
+
Array<{
|
|
111
|
+
role: "user" | "assistant";
|
|
112
|
+
text: string;
|
|
113
|
+
streaming?: boolean;
|
|
114
|
+
steps?: AgentStep[];
|
|
115
|
+
}>
|
|
116
|
+
>([]);
|
|
117
|
+
// The flex column the transcript and the answer sheet divide between them.
|
|
118
|
+
const pillInnerRef = useRef<HTMLDivElement | null>(null);
|
|
119
|
+
const [askSheetOpen, setAskSheetOpen] = useState(false);
|
|
120
|
+
/** Held open for the exit animation. A drawer that vanishes on close reads
|
|
121
|
+
* as a bug even when the entrance is right. */
|
|
122
|
+
const [askSheetClosing, setAskSheetClosing] = useState(false);
|
|
123
|
+
const askSheetExitRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
|
124
|
+
const [askSheetHeight, setAskSheetHeight] = useState(ASK_SHEET_DEFAULT);
|
|
125
|
+
const askStreamRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
|
126
|
+
const askAbortRef = useRef<AbortController | null>(null);
|
|
127
|
+
const chipsAbortRef = useRef<AbortController | null>(null);
|
|
128
|
+
const chipsFetchedAtRef = useRef(0);
|
|
129
|
+
const [askChips, setAskChips] = useState<
|
|
130
|
+
Array<{ label: string; ask: string }>
|
|
131
|
+
>([]);
|
|
132
|
+
|
|
133
|
+
/** The last ~2 minutes of transcript, capped, most recent last — inlined
|
|
134
|
+
* into the ask scaffold so simple questions need no tool round trip and
|
|
135
|
+
* chip generation sees what was just said. */
|
|
136
|
+
const recentTranscriptText = () => {
|
|
137
|
+
const lines = transcriptLinesRef.current;
|
|
138
|
+
const latest = lines[lines.length - 1]?.startMs ?? null;
|
|
139
|
+
const windowed =
|
|
140
|
+
latest === null
|
|
141
|
+
? lines.slice(-20)
|
|
142
|
+
: lines.filter(
|
|
143
|
+
(l) => l.startMs === null || latest - l.startMs <= 120_000,
|
|
144
|
+
);
|
|
145
|
+
let out = windowed
|
|
146
|
+
.map((l) => `${speakerFor(l.source)}: ${l.text}`)
|
|
147
|
+
.join("\n");
|
|
148
|
+
if (out.length > 2_400) out = out.slice(-2_400);
|
|
149
|
+
return out;
|
|
150
|
+
};
|
|
151
|
+
// Follow-up context for the live transport: prior scaffolded questions and
|
|
152
|
+
// final answers, sent as `history` with each ask (no threadId — see
|
|
153
|
+
// `streamMeetingAsk`). Reset with the session.
|
|
154
|
+
const askHistoryRef = useRef<AskTurn[]>([]);
|
|
155
|
+
const askSheetScrollRef = useRef<HTMLDivElement | null>(null);
|
|
156
|
+
/** Whether the reader is at the live edge of the answer, so growth should
|
|
157
|
+
* follow it. Same rule the transcript uses: a token stream that hard-scrolls
|
|
158
|
+
* on every delta makes scrolling up to re-read an earlier turn impossible. */
|
|
159
|
+
const askPinnedRef = useRef(true);
|
|
160
|
+
const scrollAskSheetIfPinned = useCallback(() => {
|
|
161
|
+
const el = askSheetScrollRef.current;
|
|
162
|
+
if (el && askPinnedRef.current) el.scrollTop = el.scrollHeight;
|
|
163
|
+
}, []);
|
|
164
|
+
const sheetDragRef = useRef<{
|
|
165
|
+
startY: number;
|
|
166
|
+
startHeight: number;
|
|
167
|
+
} | null>(null);
|
|
168
|
+
/**
|
|
169
|
+
* Whether the last grip gesture travelled far enough to be a resize.
|
|
170
|
+
*
|
|
171
|
+
* `click` fires after `pointerup`, so the drag state is always already
|
|
172
|
+
* cleared by the time the click handler runs — testing it there let every
|
|
173
|
+
* resize, including one that grew the sheet, dismiss it on release.
|
|
174
|
+
*/
|
|
175
|
+
const sheetDragMovedRef = useRef(false);
|
|
60
176
|
const activeMeetingIdRef = useRef<string | null>(null);
|
|
61
177
|
// Detached / "floating" mode — Wispr-style pill that auto-moves to the
|
|
62
178
|
// top-right when the main app loses focus, with a drag handle. Driven by
|
|
@@ -93,13 +209,31 @@ export function MeetingPill() {
|
|
|
93
209
|
};
|
|
94
210
|
trackListen(
|
|
95
211
|
listen<PillContext>("clips:pill-context", (ev) => {
|
|
96
|
-
const next: PillContext = {
|
|
97
|
-
meetingId: ev.payload?.meetingId ?? null,
|
|
98
|
-
mode: ev.payload?.mode ?? "clip",
|
|
99
|
-
};
|
|
100
212
|
const prev = ctxRef.current;
|
|
213
|
+
const meetingId = ev.payload?.meetingId ?? null;
|
|
214
|
+
const mode = ev.payload?.mode ?? "clip";
|
|
101
215
|
const isSameSession =
|
|
102
|
-
prev.meetingId ===
|
|
216
|
+
prev.meetingId === meetingId && prev.mode === mode;
|
|
217
|
+
const next: PillContext = {
|
|
218
|
+
meetingId,
|
|
219
|
+
mode,
|
|
220
|
+
// Rust re-emits this event on every `recording_pill_show` without a
|
|
221
|
+
// `title` or a `starting` field, so within one session absent means
|
|
222
|
+
// "no opinion" and the previous value stands — coercing `starting`
|
|
223
|
+
// to false there would race the flag to a live-looking pill.
|
|
224
|
+
//
|
|
225
|
+
// Across a session it means the opposite. A meeting's first context
|
|
226
|
+
// carries no title (the fetch that finds it has not returned yet),
|
|
227
|
+
// so carrying the old one opened the new meeting under the previous
|
|
228
|
+
// meeting's name — and scaffolded any ask made in that window with
|
|
229
|
+
// it, which is a wrong answer rather than a wrong label.
|
|
230
|
+
title:
|
|
231
|
+
ev.payload?.title ?? (isSameSession ? prev.title : null) ?? null,
|
|
232
|
+
starting:
|
|
233
|
+
ev.payload?.starting ??
|
|
234
|
+
(isSameSession ? prev.starting : false) ??
|
|
235
|
+
false,
|
|
236
|
+
};
|
|
103
237
|
ctxRef.current = next;
|
|
104
238
|
setCtx(next);
|
|
105
239
|
// The Rust side re-shows (and re-emits this event for) the same pill
|
|
@@ -123,6 +257,17 @@ export function MeetingPill() {
|
|
|
123
257
|
setExpanded(false);
|
|
124
258
|
// Reset transcript state for the new session.
|
|
125
259
|
setPreloadedLines([]);
|
|
260
|
+
// A new session is a new meeting: drop the old ask conversation and
|
|
261
|
+
// abort any in-flight answer so it can't stream into the wrong sheet.
|
|
262
|
+
askAbortRef.current?.abort();
|
|
263
|
+
askAbortRef.current = null;
|
|
264
|
+
chipsAbortRef.current?.abort();
|
|
265
|
+
chipsAbortRef.current = null;
|
|
266
|
+
chipsFetchedAtRef.current = 0;
|
|
267
|
+
setAskChips([]);
|
|
268
|
+
askHistoryRef.current = [];
|
|
269
|
+
setAskMessages([]);
|
|
270
|
+
setAskSheetOpen(false);
|
|
126
271
|
activeMeetingIdRef.current =
|
|
127
272
|
ev.payload?.mode === "meeting" ? (next.meetingId ?? null) : null;
|
|
128
273
|
if (stopFallbackRef.current) {
|
|
@@ -131,10 +276,18 @@ export function MeetingPill() {
|
|
|
131
276
|
}
|
|
132
277
|
}),
|
|
133
278
|
);
|
|
279
|
+
// Capture emits levels continuously once it attaches, including through
|
|
280
|
+
// silence — the first one means the engine is live.
|
|
281
|
+
trackListen(
|
|
282
|
+
listen("voice:audio-level", () => {
|
|
283
|
+
clearStartingRef.current();
|
|
284
|
+
}),
|
|
285
|
+
);
|
|
134
286
|
trackListen(
|
|
135
287
|
listen<{ paused: boolean; elapsedMs: number }>(
|
|
136
288
|
"clips:recorder-state",
|
|
137
289
|
(ev) => {
|
|
290
|
+
clearStartingRef.current();
|
|
138
291
|
// Meeting capture has its own optimistic pause state. Ordinary clips
|
|
139
292
|
// follow the recorder's authoritative broadcast so this reused pill
|
|
140
293
|
// cannot drift or emit an inverted command.
|
|
@@ -188,6 +341,67 @@ export function MeetingPill() {
|
|
|
188
341
|
// Signal that all listeners are registered. app.tsx listens for this and
|
|
189
342
|
// re-emits the pill context and transcript preload for a fresh window.
|
|
190
343
|
emit("clips:pill-ready", {}).catch(() => {});
|
|
344
|
+
// Recovery: the context event is push-only, so a pill window that mounts
|
|
345
|
+
// after it fired (webview reload, popover restart) would strand in clip
|
|
346
|
+
// mode with no ask bar. Rust owns the active meeting id — ask it.
|
|
347
|
+
invoke<string | null>("get_active_meeting_id")
|
|
348
|
+
.then((meetingId) => {
|
|
349
|
+
if (!meetingId || stopped) return;
|
|
350
|
+
// Recovery only covers "no context ever arrived". This lookup is
|
|
351
|
+
// asynchronous, so by the time it answers a real `clips:pill-context`
|
|
352
|
+
// may have landed — and that event is authoritative where this is a
|
|
353
|
+
// guess. Applying it anyway replaced the live context with one carrying
|
|
354
|
+
// `title: null` and no `starting` flag, which is how a starting pill
|
|
355
|
+
// lost its spinner and a titled meeting lost its name.
|
|
356
|
+
if (ctxRef.current.meetingId !== null) return;
|
|
357
|
+
const next: PillContext = { meetingId, mode: "meeting", title: null };
|
|
358
|
+
ctxRef.current = next;
|
|
359
|
+
setCtx(next);
|
|
360
|
+
activeMeetingIdRef.current = meetingId;
|
|
361
|
+
})
|
|
362
|
+
.catch(() => {});
|
|
363
|
+
if (pillDemoMode) {
|
|
364
|
+
// Open in the starting state the real pill now shows, so the spinner is
|
|
365
|
+
// reviewable in the harness rather than only during a live start.
|
|
366
|
+
ctxRef.current = {
|
|
367
|
+
mode: "meeting",
|
|
368
|
+
meetingId: "demo",
|
|
369
|
+
title: "Promotion readiness review",
|
|
370
|
+
starting: true,
|
|
371
|
+
};
|
|
372
|
+
setCtx(ctxRef.current);
|
|
373
|
+
setTimeout(() => {
|
|
374
|
+
ctxRef.current = { ...ctxRef.current, starting: false };
|
|
375
|
+
setCtx(ctxRef.current);
|
|
376
|
+
}, 4_000);
|
|
377
|
+
activeMeetingIdRef.current = "demo";
|
|
378
|
+
setExpanded(true);
|
|
379
|
+
setPreloadedLines([
|
|
380
|
+
{
|
|
381
|
+
source: "system",
|
|
382
|
+
text: "So XIE went through a bunch of different questions and we've settled on three. Yesterday we just swapped one completely out because it used to be a design system question.",
|
|
383
|
+
startMs: 406_000,
|
|
384
|
+
},
|
|
385
|
+
{
|
|
386
|
+
source: "system",
|
|
387
|
+
text: "but the design system indexing can take up to an hour. And so.",
|
|
388
|
+
startMs: 417_000,
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
source: "mic",
|
|
392
|
+
text: "Alright, that makes sense. Do we have a fallback if the indexing is still running when the review starts?",
|
|
393
|
+
startMs: 431_000,
|
|
394
|
+
},
|
|
395
|
+
{
|
|
396
|
+
source: "system",
|
|
397
|
+
text: "We can pin the previous index and swap when the fresh one lands.",
|
|
398
|
+
startMs: 449_000,
|
|
399
|
+
},
|
|
400
|
+
] as FinalLine[]);
|
|
401
|
+
demoLevelTimerRef.current = setInterval(() => {
|
|
402
|
+
setDemoLevel(0.04 + Math.random() * 0.28);
|
|
403
|
+
}, 90);
|
|
404
|
+
}
|
|
191
405
|
return () => {
|
|
192
406
|
stopped = true;
|
|
193
407
|
unlistens.forEach((u) => {
|
|
@@ -201,6 +415,16 @@ export function MeetingPill() {
|
|
|
201
415
|
clearTimeout(stopFallbackRef.current);
|
|
202
416
|
stopFallbackRef.current = null;
|
|
203
417
|
}
|
|
418
|
+
askAbortRef.current?.abort();
|
|
419
|
+
askAbortRef.current = null;
|
|
420
|
+
if (askSheetExitRef.current) {
|
|
421
|
+
clearTimeout(askSheetExitRef.current);
|
|
422
|
+
askSheetExitRef.current = null;
|
|
423
|
+
}
|
|
424
|
+
if (demoLevelTimerRef.current) {
|
|
425
|
+
clearInterval(demoLevelTimerRef.current);
|
|
426
|
+
demoLevelTimerRef.current = null;
|
|
427
|
+
}
|
|
204
428
|
};
|
|
205
429
|
}, []);
|
|
206
430
|
|
|
@@ -269,11 +493,233 @@ export function MeetingPill() {
|
|
|
269
493
|
|
|
270
494
|
// Stable callback for LiveTranscript to push locked-in lines up. Stable
|
|
271
495
|
// identity matters — it's a dep of an effect inside LiveTranscript.
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
496
|
+
/**
|
|
497
|
+
* Leave the starting state on evidence, not only on being told.
|
|
498
|
+
*
|
|
499
|
+
* `clips:pill-context` with `starting: false` is the intended signal, but it
|
|
500
|
+
* is a single push event: one dropped emit and the pill claims it is still
|
|
501
|
+
* starting a session that is already recording. Audio arriving IS the
|
|
502
|
+
* session, so anything that could only happen after capture attached also
|
|
503
|
+
* clears it.
|
|
504
|
+
*/
|
|
505
|
+
/** The capsule and the transport segment inside it, for measured growth. */
|
|
506
|
+
const capsuleRef = useRef<HTMLDivElement | null>(null);
|
|
507
|
+
const transportRef = useRef<HTMLDivElement | null>(null);
|
|
508
|
+
const windowOpChainRef = useRef<Promise<void>>(Promise.resolve());
|
|
509
|
+
const clearStartingRef = useRef<() => void>(() => {});
|
|
510
|
+
|
|
511
|
+
const clearStarting = useCallback(() => {
|
|
512
|
+
if (!ctxRef.current.starting) return;
|
|
513
|
+
ctxRef.current = { ...ctxRef.current, starting: false };
|
|
514
|
+
setCtx(ctxRef.current);
|
|
515
|
+
}, []);
|
|
516
|
+
|
|
517
|
+
clearStartingRef.current = clearStarting;
|
|
518
|
+
|
|
519
|
+
/**
|
|
520
|
+
* Serialize window ops. Two resizes in flight read each other's stale
|
|
521
|
+
* geometry and the capsule ends up the wrong size — the same queue the
|
|
522
|
+
* recorder pill runs its segment growth through.
|
|
523
|
+
*/
|
|
524
|
+
const queueWindowOp = (op: () => Promise<void>) => {
|
|
525
|
+
windowOpChainRef.current = windowOpChainRef.current
|
|
526
|
+
.then(op)
|
|
527
|
+
.catch((err) => {
|
|
528
|
+
console.warn("[clips-pill] window op failed", err);
|
|
529
|
+
});
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Size the window around the capsule's own layout, keeping the top edge
|
|
534
|
+
* fixed so growth extends downward — away from the cursor that is sitting
|
|
535
|
+
* on the logo at the top.
|
|
536
|
+
*/
|
|
537
|
+
const syncCapsuleWindow = useCallback((extraLogicalHeight: number) => {
|
|
538
|
+
const el = capsuleRef.current;
|
|
539
|
+
if (!el || pillDemoMode) return;
|
|
540
|
+
// offsetHeight is a layout metric, immune to a transition in flight; a
|
|
541
|
+
// rect read mid-animation locks the window to a half-open size.
|
|
542
|
+
const contentH = el.offsetHeight + extraLogicalHeight;
|
|
543
|
+
const contentW = el.offsetWidth;
|
|
544
|
+
queueWindowOp(async () => {
|
|
545
|
+
const win = getCurrentWindow();
|
|
546
|
+
const [size, scale] = await Promise.all([
|
|
547
|
+
win.outerSize(),
|
|
548
|
+
win.scaleFactor(),
|
|
549
|
+
]);
|
|
550
|
+
const w = Math.ceil(contentW * scale);
|
|
551
|
+
const h = Math.ceil(contentH * scale);
|
|
552
|
+
if (size.width === w && size.height === h) return;
|
|
553
|
+
await win.setSize(new PhysicalSize(w, h));
|
|
554
|
+
});
|
|
275
555
|
}, []);
|
|
276
556
|
|
|
557
|
+
/**
|
|
558
|
+
* Grow the capsule to reveal pause and stop, then let the segment animate
|
|
559
|
+
* its own height open — window first so there is room to grow into, and on
|
|
560
|
+
* the way out the window shrinks only once the segment has closed.
|
|
561
|
+
*/
|
|
562
|
+
useEffect(() => {
|
|
563
|
+
if (expanded || detached || ctx.mode !== "meeting" || finished) return;
|
|
564
|
+
const seg = transportRef.current;
|
|
565
|
+
if (!seg) return;
|
|
566
|
+
// Nothing to pause or end until capture has attached.
|
|
567
|
+
const open = hovered && !ctx.starting;
|
|
568
|
+
|
|
569
|
+
let release: (() => void) | null = null;
|
|
570
|
+
|
|
571
|
+
/**
|
|
572
|
+
* The segment's own content height. `scrollHeight` cannot be used: the
|
|
573
|
+
* transport buttons carry hit-target overlays that extend past their box,
|
|
574
|
+
* and scrollHeight counts that overflow — which showed up as dead space
|
|
575
|
+
* under the last control.
|
|
576
|
+
*/
|
|
577
|
+
const contentHeight = () => {
|
|
578
|
+
const kids = Array.from(seg.children).filter(
|
|
579
|
+
(kid): kid is HTMLElement =>
|
|
580
|
+
kid instanceof HTMLElement &&
|
|
581
|
+
window.getComputedStyle(kid).display !== "none",
|
|
582
|
+
);
|
|
583
|
+
const gap = parseFloat(window.getComputedStyle(seg).rowGap) || 0;
|
|
584
|
+
const stacked = kids.reduce((total, kid) => total + kid.offsetHeight, 0);
|
|
585
|
+
return stacked + gap * Math.max(0, kids.length - 1);
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
const apply = () => {
|
|
589
|
+
const target = open ? contentHeight() : 0;
|
|
590
|
+
if (open) seg.dataset.open = "true";
|
|
591
|
+
else delete seg.dataset.open;
|
|
592
|
+
seg.style.transition = "";
|
|
593
|
+
seg.style.height = `${target}px`;
|
|
594
|
+
seg.style.marginTop = open ? `${TRANSPORT_GAP_PX}px` : "0px";
|
|
595
|
+
seg.style.opacity = open ? "1" : "0";
|
|
596
|
+
// Grow the window first so the capsule has somewhere to open into. It
|
|
597
|
+
// is transparent below the capsule, so the extra frame is invisible
|
|
598
|
+
// until the segment fills it.
|
|
599
|
+
if (open) syncCapsuleWindow(target + TRANSPORT_GAP_PX);
|
|
600
|
+
|
|
601
|
+
// This window is never the key window, and the browser can stop
|
|
602
|
+
// advancing animations in one — the transition then never progresses
|
|
603
|
+
// and the capsule stays at the size it started from. Wait for the real
|
|
604
|
+
// transition, and if it never arrives, drop it and snap to the end.
|
|
605
|
+
let settled = false;
|
|
606
|
+
const settle = () => {
|
|
607
|
+
if (settled) return;
|
|
608
|
+
settled = true;
|
|
609
|
+
if (!open) syncCapsuleWindow(0);
|
|
610
|
+
};
|
|
611
|
+
const forceSnap = () => {
|
|
612
|
+
if (settled) return;
|
|
613
|
+
seg.style.transition = "none";
|
|
614
|
+
seg.style.height = `${target}px`;
|
|
615
|
+
seg.style.marginTop = open ? `${TRANSPORT_GAP_PX}px` : "0px";
|
|
616
|
+
seg.style.opacity = open ? "1" : "0";
|
|
617
|
+
// Read back so the snapped value commits before the transition is
|
|
618
|
+
// restored, or the restore just re-animates from the old value.
|
|
619
|
+
void seg.offsetHeight;
|
|
620
|
+
seg.style.transition = "";
|
|
621
|
+
settle();
|
|
622
|
+
};
|
|
623
|
+
seg.addEventListener("transitionend", settle, { once: true });
|
|
624
|
+
const stalled = setTimeout(forceSnap, TRANSITION_STALL_MS);
|
|
625
|
+
release = () => {
|
|
626
|
+
seg.removeEventListener("transitionend", settle);
|
|
627
|
+
clearTimeout(stalled);
|
|
628
|
+
};
|
|
629
|
+
};
|
|
630
|
+
|
|
631
|
+
// Opening waits out a cursor that is only passing over. Closing does not,
|
|
632
|
+
// so the capsule never lingers open under a cursor that has left.
|
|
633
|
+
let intent: ReturnType<typeof setTimeout> | null = null;
|
|
634
|
+
if (open && !seg.dataset.open) intent = setTimeout(apply, HOVER_INTENT_MS);
|
|
635
|
+
else apply();
|
|
636
|
+
|
|
637
|
+
return () => {
|
|
638
|
+
if (intent) clearTimeout(intent);
|
|
639
|
+
release?.();
|
|
640
|
+
};
|
|
641
|
+
}, [
|
|
642
|
+
hovered,
|
|
643
|
+
expanded,
|
|
644
|
+
detached,
|
|
645
|
+
ctx.mode,
|
|
646
|
+
ctx.starting,
|
|
647
|
+
finished,
|
|
648
|
+
syncCapsuleWindow,
|
|
649
|
+
]);
|
|
650
|
+
|
|
651
|
+
/**
|
|
652
|
+
* Put the header's glyphs on the title's optical centre line.
|
|
653
|
+
*
|
|
654
|
+
* Flexbox centres boxes, and a text box is not centred on its own ink: the
|
|
655
|
+
* ink sits wherever the font's ascent, descent and half-leading put it.
|
|
656
|
+
* Chrome and this app's webview do not resolve `-apple-system` to the same
|
|
657
|
+
* metrics — measured in the shipped webview, the controls sat 3.68px below
|
|
658
|
+
* the title's cap centre while Chrome put them within 0.15px. So the row is
|
|
659
|
+
* aligned by measurement rather than by construction: the shift is computed
|
|
660
|
+
* from the real rendered text and applied to everything that is not text.
|
|
661
|
+
*/
|
|
662
|
+
useEffect(() => {
|
|
663
|
+
if (!expanded || pillDemoMode) return;
|
|
664
|
+
let frame = 0;
|
|
665
|
+
const align = () => {
|
|
666
|
+
const header = pillInnerRef.current?.querySelector(".pill-header");
|
|
667
|
+
const title = header?.querySelector(".pill-title");
|
|
668
|
+
const controls = header?.querySelector<HTMLElement>(".pill-controls");
|
|
669
|
+
if (!header || !title || !controls) return;
|
|
670
|
+
const marker = document.createElement("span");
|
|
671
|
+
marker.style.cssText = "display:inline-block;width:0;height:0;";
|
|
672
|
+
title.appendChild(marker);
|
|
673
|
+
const baseline = marker.getBoundingClientRect().top;
|
|
674
|
+
title.removeChild(marker);
|
|
675
|
+
if (!baseline) return;
|
|
676
|
+
const fontSize = parseFloat(window.getComputedStyle(title).fontSize);
|
|
677
|
+
// Cap centre: half a cap-height above the baseline. 0.72em is the cap
|
|
678
|
+
// ratio for the system faces this stack resolves to, and a few
|
|
679
|
+
// hundredths of an em either way is invisible at 13px.
|
|
680
|
+
const capCentre = baseline - (fontSize * CAP_HEIGHT_RATIO) / 2;
|
|
681
|
+
const rect = controls.getBoundingClientRect();
|
|
682
|
+
const shift = capCentre - (rect.top + rect.bottom) / 2;
|
|
683
|
+
const style = (header as HTMLElement).style;
|
|
684
|
+
style.setProperty("--header-ink-shift", `${shift.toFixed(2)}px`);
|
|
685
|
+
|
|
686
|
+
// The meter is measured from its own bars rather than sharing the
|
|
687
|
+
// controls' shift: its band is what the eye lines up against the text,
|
|
688
|
+
// and its box does not necessarily sit where their boxes do.
|
|
689
|
+
const bars = Array.from(
|
|
690
|
+
header.querySelectorAll<HTMLElement>(".pill-wave-meter i"),
|
|
691
|
+
);
|
|
692
|
+
if (bars.length) {
|
|
693
|
+
const rects = bars.map((bar) => bar.getBoundingClientRect());
|
|
694
|
+
const band =
|
|
695
|
+
(Math.min(...rects.map((r) => r.top)) +
|
|
696
|
+
Math.max(...rects.map((r) => r.bottom))) /
|
|
697
|
+
2;
|
|
698
|
+
style.setProperty(
|
|
699
|
+
"--header-meter-shift",
|
|
700
|
+
`${(capCentre - band).toFixed(2)}px`,
|
|
701
|
+
);
|
|
702
|
+
}
|
|
703
|
+
};
|
|
704
|
+
// After layout, and again on the next frame so a late font swap lands.
|
|
705
|
+
align();
|
|
706
|
+
frame = requestAnimationFrame(align);
|
|
707
|
+
const timer = setTimeout(align, 400);
|
|
708
|
+
return () => {
|
|
709
|
+
cancelAnimationFrame(frame);
|
|
710
|
+
clearTimeout(timer);
|
|
711
|
+
};
|
|
712
|
+
}, [expanded, ctx.title, ctx.starting, finished]);
|
|
713
|
+
|
|
714
|
+
const handleTranscriptLines = useCallback(
|
|
715
|
+
(lines: TranscriptLine[]) => {
|
|
716
|
+
transcriptLinesRef.current = lines;
|
|
717
|
+
setHasTranscriptLines(lines.length > 0);
|
|
718
|
+
if (lines.length) clearStarting();
|
|
719
|
+
},
|
|
720
|
+
[clearStarting],
|
|
721
|
+
);
|
|
722
|
+
|
|
277
723
|
const handleCopyTranscript = async () => {
|
|
278
724
|
const lines = transcriptLinesRef.current;
|
|
279
725
|
if (!lines.length) return;
|
|
@@ -289,19 +735,410 @@ export function MeetingPill() {
|
|
|
289
735
|
}
|
|
290
736
|
};
|
|
291
737
|
|
|
738
|
+
/** Canned step rows so the demo harness shows the real streaming shape. */
|
|
739
|
+
const demoAskSteps = (progress: number, done: boolean): AgentStep[] => {
|
|
740
|
+
const steps: AgentStep[] = [
|
|
741
|
+
{
|
|
742
|
+
key: "demo-think",
|
|
743
|
+
label: "Thought",
|
|
744
|
+
kind: "think",
|
|
745
|
+
status: "done",
|
|
746
|
+
detail:
|
|
747
|
+
"The ask is about what was decided, so the meeting itself comes first, then anything similar from past meetings.",
|
|
748
|
+
},
|
|
749
|
+
{
|
|
750
|
+
key: "demo-read",
|
|
751
|
+
label: "Reading this meeting",
|
|
752
|
+
kind: "read",
|
|
753
|
+
status: progress >= 6 ? "done" : "running",
|
|
754
|
+
detail: progress >= 6 ? "1 result" : undefined,
|
|
755
|
+
},
|
|
756
|
+
];
|
|
757
|
+
if (progress >= 6) {
|
|
758
|
+
steps.push({
|
|
759
|
+
key: "demo-search",
|
|
760
|
+
label: "Searching past meetings",
|
|
761
|
+
kind: "search",
|
|
762
|
+
status: progress >= 14 ? "done" : "running",
|
|
763
|
+
detail: progress >= 14 ? "3 results" : undefined,
|
|
764
|
+
});
|
|
765
|
+
}
|
|
766
|
+
return done ? settleSteps(steps) : steps;
|
|
767
|
+
};
|
|
768
|
+
|
|
769
|
+
const openAskSheet = () => {
|
|
770
|
+
if (askSheetExitRef.current) {
|
|
771
|
+
clearTimeout(askSheetExitRef.current);
|
|
772
|
+
askSheetExitRef.current = null;
|
|
773
|
+
}
|
|
774
|
+
setAskSheetClosing(false);
|
|
775
|
+
setAskSheetOpen(true);
|
|
776
|
+
};
|
|
777
|
+
|
|
778
|
+
const submitAsk = (question: string) => {
|
|
779
|
+
const mid = activeMeetingIdRef.current;
|
|
780
|
+
if (!question || !mid) return;
|
|
781
|
+
refreshAskChips();
|
|
782
|
+
if (pillDemoMode) {
|
|
783
|
+
if (askStreamRef.current) clearInterval(askStreamRef.current);
|
|
784
|
+
const canned = question.toLowerCase().includes("miss")
|
|
785
|
+
? "Your key points since you tuned out:\n1. The question set is final: three questions, with the design system one swapped out yesterday.\n2. Indexing risk: it can take up to an hour, raised as the main open concern.\n3. Fallback agreed: pin the previous index and swap when the fresh one lands."
|
|
786
|
+
: "You landed on three questions after swapping out the design system one. The open risk is indexing time (up to an hour); the fallback is pinning the previous index and swapping when the fresh one lands.";
|
|
787
|
+
const words = canned.split(" ");
|
|
788
|
+
let i = 0;
|
|
789
|
+
openAskSheet();
|
|
790
|
+
setAskMessages((m) => [
|
|
791
|
+
...m,
|
|
792
|
+
{ role: "user", text: question },
|
|
793
|
+
{ role: "assistant", text: "", streaming: true },
|
|
794
|
+
]);
|
|
795
|
+
askStreamRef.current = setInterval(() => {
|
|
796
|
+
i += 2;
|
|
797
|
+
const done = i >= words.length;
|
|
798
|
+
setAskMessages((m) => {
|
|
799
|
+
const next = [...m];
|
|
800
|
+
next[next.length - 1] = {
|
|
801
|
+
role: "assistant",
|
|
802
|
+
text: words.slice(0, i).join(" "),
|
|
803
|
+
streaming: !done,
|
|
804
|
+
steps: demoAskSteps(i, done),
|
|
805
|
+
};
|
|
806
|
+
return next;
|
|
807
|
+
});
|
|
808
|
+
if (done && askStreamRef.current) {
|
|
809
|
+
clearInterval(askStreamRef.current);
|
|
810
|
+
askStreamRef.current = null;
|
|
811
|
+
}
|
|
812
|
+
}, 55);
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
// Live transport: stream the answer from the agent chat into the same
|
|
816
|
+
// askMessages the demo branch fills, instead of ejecting to the web app.
|
|
817
|
+
askAbortRef.current?.abort();
|
|
818
|
+
const controller = new AbortController();
|
|
819
|
+
askAbortRef.current = controller;
|
|
820
|
+
openAskSheet();
|
|
821
|
+
// Asking is a request to watch the answer, so follow the live edge again
|
|
822
|
+
// even if the reader had scrolled up through an earlier turn.
|
|
823
|
+
askPinnedRef.current = true;
|
|
824
|
+
setAskMessages((m) => [
|
|
825
|
+
// A superseded in-flight answer keeps its partial text; drop its caret.
|
|
826
|
+
...m.map((msg) => (msg.streaming ? { ...msg, streaming: false } : msg)),
|
|
827
|
+
{ role: "user", text: question },
|
|
828
|
+
{ role: "assistant", text: "", streaming: true },
|
|
829
|
+
]);
|
|
830
|
+
const appendToAnswer = (delta: string) => {
|
|
831
|
+
// A late chunk racing the abort must not touch the next ask's bubble.
|
|
832
|
+
if (controller.signal.aborted) return;
|
|
833
|
+
setAskMessages((m) => {
|
|
834
|
+
const last = m[m.length - 1];
|
|
835
|
+
if (!last || last.role !== "assistant") return m;
|
|
836
|
+
return [...m.slice(0, -1), { ...last, text: last.text + delta }];
|
|
837
|
+
});
|
|
838
|
+
};
|
|
839
|
+
// Tool calls, their outcomes, and progress labels land on the answer
|
|
840
|
+
// bubble as they stream, so the wait reads as work rather than a hang.
|
|
841
|
+
const updateSteps = (next: (steps: AgentStep[]) => AgentStep[]) => {
|
|
842
|
+
if (controller.signal.aborted) return;
|
|
843
|
+
setAskMessages((m) => {
|
|
844
|
+
const last = m[m.length - 1];
|
|
845
|
+
if (!last || last.role !== "assistant") return m;
|
|
846
|
+
const steps = next(last.steps ?? []);
|
|
847
|
+
if (steps === last.steps) return m;
|
|
848
|
+
return [...m.slice(0, -1), { ...last, steps }];
|
|
849
|
+
});
|
|
850
|
+
};
|
|
851
|
+
const title = ctxRef.current.title ?? null;
|
|
852
|
+
const recentTranscript = recentTranscriptText();
|
|
853
|
+
void (async () => {
|
|
854
|
+
try {
|
|
855
|
+
const { answer, incomplete } = await streamMeetingAsk({
|
|
856
|
+
serverUrl: loadStoredServerUrl(),
|
|
857
|
+
meetingId: mid,
|
|
858
|
+
meetingTitle: title,
|
|
859
|
+
question,
|
|
860
|
+
history: askHistoryRef.current,
|
|
861
|
+
signal: controller.signal,
|
|
862
|
+
recentTranscript,
|
|
863
|
+
onFrame: (frame) => updateSteps((steps) => applyFrame(steps, frame)),
|
|
864
|
+
onTextDelta: appendToAnswer,
|
|
865
|
+
});
|
|
866
|
+
if (controller.signal.aborted) return;
|
|
867
|
+
const exchange: AskTurn[] = [
|
|
868
|
+
{
|
|
869
|
+
role: "user",
|
|
870
|
+
content: buildMeetingAskPrompt(
|
|
871
|
+
mid,
|
|
872
|
+
title,
|
|
873
|
+
question,
|
|
874
|
+
recentTranscript,
|
|
875
|
+
),
|
|
876
|
+
},
|
|
877
|
+
// The note rides along so a follow-up turn sees that this reply was
|
|
878
|
+
// cut off rather than treating the fragment as what it decided to say.
|
|
879
|
+
{
|
|
880
|
+
role: "assistant",
|
|
881
|
+
content: incomplete
|
|
882
|
+
? `${answer}\n\n(${incomplete.message})`
|
|
883
|
+
: answer,
|
|
884
|
+
},
|
|
885
|
+
];
|
|
886
|
+
askHistoryRef.current = [...askHistoryRef.current, ...exchange].slice(
|
|
887
|
+
-MAX_ASK_HISTORY_TURNS,
|
|
888
|
+
);
|
|
889
|
+
setAskMessages((m) => {
|
|
890
|
+
const last = m[m.length - 1];
|
|
891
|
+
if (!last || last.role !== "assistant") return m;
|
|
892
|
+
return [
|
|
893
|
+
...m.slice(0, -1),
|
|
894
|
+
{
|
|
895
|
+
...last,
|
|
896
|
+
// A run cut at a timeout, a loop cap, or an approval gate leaves
|
|
897
|
+
// a fragment on screen. Say so on the bubble, or the fragment
|
|
898
|
+
// reads as the whole answer.
|
|
899
|
+
text: incomplete
|
|
900
|
+
? last.text
|
|
901
|
+
? `${last.text}\n\n${incomplete.message}`
|
|
902
|
+
: incomplete.message
|
|
903
|
+
: last.text,
|
|
904
|
+
streaming: false,
|
|
905
|
+
steps: last.steps
|
|
906
|
+
? settleSteps(last.steps, incomplete)
|
|
907
|
+
: last.steps,
|
|
908
|
+
},
|
|
909
|
+
];
|
|
910
|
+
});
|
|
911
|
+
} catch (err) {
|
|
912
|
+
if (controller.signal.aborted) return;
|
|
913
|
+
const line =
|
|
914
|
+
err instanceof Error && err.message.trim()
|
|
915
|
+
? err.message.trim()
|
|
916
|
+
: "Couldn't reach the agent. Try again.";
|
|
917
|
+
setAskMessages((m) => {
|
|
918
|
+
const last = m[m.length - 1];
|
|
919
|
+
if (!last || last.role !== "assistant") return m;
|
|
920
|
+
return [
|
|
921
|
+
...m.slice(0, -1),
|
|
922
|
+
{
|
|
923
|
+
...last,
|
|
924
|
+
text: last.text ? `${last.text}\n${line}` : line,
|
|
925
|
+
streaming: false,
|
|
926
|
+
// The run died mid-step, so whatever was in flight did not
|
|
927
|
+
// finish. Settling it as done would caption a failed ask with
|
|
928
|
+
// "Read" and "Searched".
|
|
929
|
+
steps: last.steps
|
|
930
|
+
? settleSteps(last.steps, { kind: "error", message: line })
|
|
931
|
+
: last.steps,
|
|
932
|
+
},
|
|
933
|
+
];
|
|
934
|
+
});
|
|
935
|
+
}
|
|
936
|
+
})();
|
|
937
|
+
};
|
|
938
|
+
|
|
292
939
|
const handleAskSubmit = (e: React.FormEvent) => {
|
|
293
940
|
e.preventDefault();
|
|
294
941
|
const question = ask.trim();
|
|
295
|
-
|
|
296
|
-
if (!question || !mid) return;
|
|
942
|
+
if (!question) return;
|
|
297
943
|
setAsk("");
|
|
298
|
-
|
|
944
|
+
submitAsk(question);
|
|
945
|
+
};
|
|
946
|
+
|
|
947
|
+
/** Chips are proposed by the agent from the recent transcript (tools off,
|
|
948
|
+
* JSON only), so they track what was actually just said — a spoken "we
|
|
949
|
+
* should meet Wednesday at 7" should surface a booking chip. Static
|
|
950
|
+
* fallbacks cover failures and the first seconds of a meeting. */
|
|
951
|
+
const refreshAskChips = () => {
|
|
952
|
+
if (pillDemoMode) return;
|
|
953
|
+
const mid = activeMeetingIdRef.current;
|
|
954
|
+
if (!mid) return;
|
|
955
|
+
const now = Date.now();
|
|
956
|
+
if (now - chipsFetchedAtRef.current < 60_000) return;
|
|
957
|
+
chipsFetchedAtRef.current = now;
|
|
958
|
+
const transcript = recentTranscriptText();
|
|
959
|
+
if (!transcript.trim()) return;
|
|
960
|
+
chipsAbortRef.current?.abort();
|
|
961
|
+
const controller = new AbortController();
|
|
962
|
+
chipsAbortRef.current = controller;
|
|
963
|
+
void streamMeetingAsk({
|
|
964
|
+
serverUrl: loadStoredServerUrl(),
|
|
299
965
|
meetingId: mid,
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
966
|
+
meetingTitle: ctxRef.current.title ?? null,
|
|
967
|
+
question: "chips",
|
|
968
|
+
history: [],
|
|
969
|
+
signal: controller.signal,
|
|
970
|
+
onTextDelta: () => {},
|
|
971
|
+
// Nothing the user typed drives this turn — it fires on a timer and its
|
|
972
|
+
// only input is what people in the room said. "Do not use any tools" in
|
|
973
|
+
// the prompt is a request; plan mode is the server refusing at dispatch,
|
|
974
|
+
// so a transcript that talks the model into calling a connected action
|
|
975
|
+
// cannot get one executed. Chips are only ever suggestions; the write
|
|
976
|
+
// happens later, from a chip the user actually taps, which runs in "act".
|
|
977
|
+
mode: "plan",
|
|
978
|
+
promptOverride: [
|
|
979
|
+
"Do not use any tools. Reply with ONLY a JSON array, no prose and no code fences.",
|
|
980
|
+
// Plan mode appends a system prompt telling the model to ask
|
|
981
|
+
// clarifying questions and present a written plan of what it would
|
|
982
|
+
// touch. That is right for a planning turn and wrong for this one,
|
|
983
|
+
// which has to come back as parseable JSON, so the conflict is settled
|
|
984
|
+
// here rather than left to chance.
|
|
985
|
+
"You are in read-only mode. That is expected and correct for this request: it only writes suggestion labels, so there is nothing to plan or approve. Do not describe a plan, do not list tools or risks, and do not ask a clarifying question — if the transcript is too thin to suggest anything, reply with an empty array [].",
|
|
986
|
+
"Based on the live-meeting transcript below, propose up to 3 quick assistant actions or questions the user is most likely to want right now. Prefer concrete actions grounded in what was said (booking something mentioned, drafting a follow-up, checking whether a topic was discussed in past meetings).",
|
|
987
|
+
'Each array item: {"label": "chip text, 24 chars max", "ask": "the full request to run"}.',
|
|
988
|
+
"",
|
|
989
|
+
...fenceTranscript(transcript),
|
|
990
|
+
].join("\n"),
|
|
991
|
+
})
|
|
992
|
+
.then(({ answer, incomplete }) => {
|
|
993
|
+
if (controller.signal.aborted) return;
|
|
994
|
+
// A cut-off run's JSON array is very likely missing its tail. Chips are
|
|
995
|
+
// a garnish, so drop them rather than showing whichever ones survived.
|
|
996
|
+
if (incomplete) return;
|
|
997
|
+
const match = answer.match(/\[[\s\S]*\]/);
|
|
998
|
+
if (!match) return;
|
|
999
|
+
const parsed = JSON.parse(match[0]) as Array<{
|
|
1000
|
+
label?: unknown;
|
|
1001
|
+
ask?: unknown;
|
|
1002
|
+
}>;
|
|
1003
|
+
const chips = parsed
|
|
1004
|
+
.filter(
|
|
1005
|
+
(c) => typeof c.label === "string" && typeof c.ask === "string",
|
|
1006
|
+
)
|
|
1007
|
+
.slice(0, 3)
|
|
1008
|
+
.map((c) => ({
|
|
1009
|
+
label: (c.label as string).slice(0, 28),
|
|
1010
|
+
ask: c.ask as string,
|
|
1011
|
+
}));
|
|
1012
|
+
if (chips.length) setAskChips(chips);
|
|
1013
|
+
})
|
|
1014
|
+
.catch(() => {
|
|
1015
|
+
// Chip generation is a garnish: failures keep the static fallbacks.
|
|
1016
|
+
});
|
|
1017
|
+
};
|
|
1018
|
+
|
|
1019
|
+
const closeAskSheet = () => {
|
|
1020
|
+
if (askStreamRef.current) {
|
|
1021
|
+
clearInterval(askStreamRef.current);
|
|
1022
|
+
askStreamRef.current = null;
|
|
1023
|
+
}
|
|
1024
|
+
// Dismissing the sheet abandons the in-flight answer; keep the partial
|
|
1025
|
+
// text (minus its caret) for when the sheet reopens.
|
|
1026
|
+
askAbortRef.current?.abort();
|
|
1027
|
+
askAbortRef.current = null;
|
|
1028
|
+
setAskMessages((m) =>
|
|
1029
|
+
m.map((msg) => (msg.streaming ? { ...msg, streaming: false } : msg)),
|
|
1030
|
+
);
|
|
1031
|
+
setAskSheetClosing(true);
|
|
1032
|
+
if (askSheetExitRef.current) clearTimeout(askSheetExitRef.current);
|
|
1033
|
+
askSheetExitRef.current = setTimeout(() => {
|
|
1034
|
+
askSheetExitRef.current = null;
|
|
1035
|
+
setAskSheetClosing(false);
|
|
1036
|
+
setAskSheetOpen(false);
|
|
1037
|
+
}, ASK_SHEET_EXIT_MS);
|
|
1038
|
+
};
|
|
1039
|
+
|
|
1040
|
+
// Text deltas, step rows, and each new question all grow the sheet. Follow
|
|
1041
|
+
// them from one place after the DOM has the new content, rather than
|
|
1042
|
+
// scrolling imperatively inside the handlers, where the height being read is
|
|
1043
|
+
// still the previous render's.
|
|
1044
|
+
useEffect(() => {
|
|
1045
|
+
scrollAskSheetIfPinned();
|
|
1046
|
+
}, [askMessages, askSheetOpen, scrollAskSheetIfPinned]);
|
|
1047
|
+
|
|
1048
|
+
// Losing height — the grip resize, the panel resize clamp — scrolls the
|
|
1049
|
+
// newest text out of view with nothing to bring it back. Same treatment the
|
|
1050
|
+
// transcript already gets, and only while the reader is at the live edge.
|
|
1051
|
+
useEffect(() => {
|
|
1052
|
+
const el = askSheetScrollRef.current;
|
|
1053
|
+
if (!el || typeof ResizeObserver === "undefined") return;
|
|
1054
|
+
const observer = new ResizeObserver(() => scrollAskSheetIfPinned());
|
|
1055
|
+
observer.observe(el);
|
|
1056
|
+
return () => observer.disconnect();
|
|
1057
|
+
}, [askSheetOpen, scrollAskSheetIfPinned]);
|
|
1058
|
+
|
|
1059
|
+
// A split that leaves the transcript room on a tall window can starve it on a
|
|
1060
|
+
// short one, so the ratio is re-clamped against the panel's real height
|
|
1061
|
+
// whenever that height changes.
|
|
1062
|
+
useEffect(() => {
|
|
1063
|
+
const host = pillInnerRef.current;
|
|
1064
|
+
if (!host || !askSheetOpen || typeof ResizeObserver === "undefined") return;
|
|
1065
|
+
const observer = new ResizeObserver(() => {
|
|
1066
|
+
const total = host.clientHeight;
|
|
1067
|
+
if (total <= 0) return;
|
|
1068
|
+
setAskSheetHeight((current) => clampAskSheetHeight(current, total));
|
|
1069
|
+
});
|
|
1070
|
+
observer.observe(host);
|
|
1071
|
+
return () => observer.disconnect();
|
|
1072
|
+
}, [askSheetOpen]);
|
|
1073
|
+
|
|
1074
|
+
// The sheet's grab handle: drag to resize, pull down far enough to dismiss.
|
|
1075
|
+
const handleSheetHandlePointerDown = (e: React.PointerEvent) => {
|
|
1076
|
+
e.preventDefault();
|
|
1077
|
+
e.currentTarget.setPointerCapture(e.pointerId);
|
|
1078
|
+
sheetDragRef.current = { startY: e.clientY, startHeight: askSheetHeight };
|
|
1079
|
+
sheetDragMovedRef.current = false;
|
|
1080
|
+
};
|
|
1081
|
+
const handleSheetHandlePointerMove = (e: React.PointerEvent) => {
|
|
1082
|
+
const drag = sheetDragRef.current;
|
|
1083
|
+
if (!drag) return;
|
|
1084
|
+
if (!isSheetGripTap(e.clientY - drag.startY)) {
|
|
1085
|
+
sheetDragMovedRef.current = true;
|
|
1086
|
+
}
|
|
1087
|
+
const total = pillInnerRef.current?.clientHeight ?? 340;
|
|
1088
|
+
const next = drag.startHeight + (drag.startY - e.clientY) / total;
|
|
1089
|
+
setAskSheetHeight(clampAskSheetHeight(next, total));
|
|
1090
|
+
};
|
|
1091
|
+
const handleSheetHandlePointerUp = () => {
|
|
1092
|
+
if (!sheetDragRef.current) return;
|
|
1093
|
+
sheetDragRef.current = null;
|
|
1094
|
+
if (askSheetHeight <= ASK_SHEET_DISMISS_AT) {
|
|
1095
|
+
setAskSheetHeight(ASK_SHEET_DEFAULT);
|
|
1096
|
+
closeAskSheet();
|
|
1097
|
+
}
|
|
1098
|
+
};
|
|
1099
|
+
// A cancelled pointer never delivers `pointerup`. Without this the drag stays
|
|
1100
|
+
// live and a later hover over the grip resizes the sheet with no button held.
|
|
1101
|
+
const handleSheetHandlePointerCancel = () => {
|
|
1102
|
+
sheetDragRef.current = null;
|
|
303
1103
|
};
|
|
304
1104
|
|
|
1105
|
+
// Persist the user's expanded-panel size while they drag the native edge
|
|
1106
|
+
// grips (the window is resizable only while expanded).
|
|
1107
|
+
useEffect(() => {
|
|
1108
|
+
if (pillDemoMode || !expanded) return;
|
|
1109
|
+
let timer: ReturnType<typeof setTimeout> | null = null;
|
|
1110
|
+
let unlisten: (() => void) | null = null;
|
|
1111
|
+
void getCurrentWindow()
|
|
1112
|
+
.onResized(({ payload }) => {
|
|
1113
|
+
if (timer) clearTimeout(timer);
|
|
1114
|
+
timer = setTimeout(() => {
|
|
1115
|
+
void invoke("recording_pill_save_expanded_size", {
|
|
1116
|
+
w: payload.width,
|
|
1117
|
+
h: payload.height,
|
|
1118
|
+
}).catch(() => {});
|
|
1119
|
+
}, 500);
|
|
1120
|
+
})
|
|
1121
|
+
.then((u) => {
|
|
1122
|
+
unlisten = u;
|
|
1123
|
+
})
|
|
1124
|
+
.catch(() => {});
|
|
1125
|
+
return () => {
|
|
1126
|
+
if (timer) clearTimeout(timer);
|
|
1127
|
+
unlisten?.();
|
|
1128
|
+
};
|
|
1129
|
+
}, [expanded]);
|
|
1130
|
+
|
|
1131
|
+
// Escape closes the ask sheet before anything else.
|
|
1132
|
+
useEffect(() => {
|
|
1133
|
+
if (!askSheetOpen) return;
|
|
1134
|
+
const onKey = (e: KeyboardEvent) => {
|
|
1135
|
+
if (e.key === "Escape") closeAskSheet();
|
|
1136
|
+
};
|
|
1137
|
+
window.addEventListener("keydown", onKey);
|
|
1138
|
+
return () => window.removeEventListener("keydown", onKey);
|
|
1139
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1140
|
+
}, [askSheetOpen]);
|
|
1141
|
+
|
|
305
1142
|
const handlePillMouseDown = (e: React.MouseEvent) => {
|
|
306
1143
|
if (e.button !== 0) return;
|
|
307
1144
|
const target = e.target as HTMLElement;
|
|
@@ -338,14 +1175,25 @@ export function MeetingPill() {
|
|
|
338
1175
|
invoke("recording_pill_hide").catch(() => {});
|
|
339
1176
|
};
|
|
340
1177
|
|
|
341
|
-
const mm = String(Math.floor(elapsed / 60))
|
|
1178
|
+
const mm = String(Math.floor(elapsed / 60));
|
|
342
1179
|
const ss = String(elapsed % 60).padStart(2, "0");
|
|
343
1180
|
const stopLabel =
|
|
344
1181
|
ctx.mode === "meeting" ? "Stop transcription" : "Stop recording";
|
|
345
1182
|
|
|
346
1183
|
return (
|
|
347
|
-
<div
|
|
1184
|
+
<div
|
|
1185
|
+
className="pill-outer"
|
|
1186
|
+
style={
|
|
1187
|
+
pillDemoMode
|
|
1188
|
+
? { width: 480, height: 340, margin: 40, position: "relative" }
|
|
1189
|
+
: undefined
|
|
1190
|
+
}
|
|
1191
|
+
>
|
|
348
1192
|
<div
|
|
1193
|
+
ref={(node) => {
|
|
1194
|
+
pillInnerRef.current = node;
|
|
1195
|
+
capsuleRef.current = node;
|
|
1196
|
+
}}
|
|
349
1197
|
className={`pill-inner${expanded ? "" : " pill-inner-compact"}${
|
|
350
1198
|
hovered ? " pill-hovered" : ""
|
|
351
1199
|
}`}
|
|
@@ -363,17 +1211,37 @@ export function MeetingPill() {
|
|
|
363
1211
|
onClick={!expanded && !detached ? handlePillMediaClick : undefined}
|
|
364
1212
|
>
|
|
365
1213
|
<div className="pill-media">
|
|
366
|
-
<PillLogo className="pill-logo" />
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
1214
|
+
{expanded && !detached ? null : <PillLogo className="pill-logo" />}
|
|
1215
|
+
{expanded && !detached && ctx.mode === "meeting" ? (
|
|
1216
|
+
<span className="pill-title" title={ctx.title ?? undefined}>
|
|
1217
|
+
{ctx.title || "Meeting notes"}
|
|
1218
|
+
</span>
|
|
1219
|
+
) : null}
|
|
1220
|
+
{ctx.starting ? (
|
|
1221
|
+
<Spinner className="pill-media-spinner size-3.5" />
|
|
1222
|
+
) : (
|
|
1223
|
+
<LiveWaveform
|
|
1224
|
+
className="pill-wave-meter"
|
|
1225
|
+
bars={expanded && !detached ? 5 : 4}
|
|
1226
|
+
dimmed={paused || finished}
|
|
1227
|
+
level={pillDemoMode ? demoLevel : null}
|
|
1228
|
+
/>
|
|
1229
|
+
)}
|
|
371
1230
|
</div>
|
|
372
|
-
<div className="pill-controls">
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
1231
|
+
<div className="pill-controls" ref={transportRef}>
|
|
1232
|
+
{ctx.starting ? (
|
|
1233
|
+
<span className="pill-timer pill-timer-starting">
|
|
1234
|
+
<Spinner className="size-3" />
|
|
1235
|
+
Starting
|
|
1236
|
+
</span>
|
|
1237
|
+
) : expanded && !detached && ctx.mode === "meeting" ? null : (
|
|
1238
|
+
<span
|
|
1239
|
+
className={`pill-timer${!paused && !finished ? " pill-timer-live" : ""}`}
|
|
1240
|
+
>
|
|
1241
|
+
{mm}:{ss}
|
|
1242
|
+
</span>
|
|
1243
|
+
)}
|
|
1244
|
+
{!finished ? (
|
|
377
1245
|
<button
|
|
378
1246
|
type="button"
|
|
379
1247
|
onClick={onPauseClick}
|
|
@@ -393,7 +1261,7 @@ export function MeetingPill() {
|
|
|
393
1261
|
<button
|
|
394
1262
|
type="button"
|
|
395
1263
|
onClick={onStopClick}
|
|
396
|
-
disabled={stopping}
|
|
1264
|
+
disabled={stopping || ctx.starting === true}
|
|
397
1265
|
data-no-drag
|
|
398
1266
|
className="pill-stop-btn"
|
|
399
1267
|
aria-label={stopping ? "Stopping" : stopLabel}
|
|
@@ -402,7 +1270,24 @@ export function MeetingPill() {
|
|
|
402
1270
|
{stopping ? (
|
|
403
1271
|
<IconLoader2 className="pill-spinner" size={14} />
|
|
404
1272
|
) : (
|
|
405
|
-
<
|
|
1273
|
+
<span aria-hidden className="pill-stop-square" />
|
|
1274
|
+
)}
|
|
1275
|
+
</button>
|
|
1276
|
+
) : null}
|
|
1277
|
+
{expanded && !finished ? (
|
|
1278
|
+
<button
|
|
1279
|
+
type="button"
|
|
1280
|
+
data-no-drag
|
|
1281
|
+
className="pill-copy-btn"
|
|
1282
|
+
onClick={handleCopyTranscript}
|
|
1283
|
+
disabled={!hasTranscriptLines}
|
|
1284
|
+
aria-label="Copy transcript"
|
|
1285
|
+
title="Copy transcript"
|
|
1286
|
+
>
|
|
1287
|
+
{transcriptCopied ? (
|
|
1288
|
+
<IconCheck size={14} />
|
|
1289
|
+
) : (
|
|
1290
|
+
<IconCopy size={14} />
|
|
406
1291
|
)}
|
|
407
1292
|
</button>
|
|
408
1293
|
) : null}
|
|
@@ -470,66 +1355,116 @@ export function MeetingPill() {
|
|
|
470
1355
|
</div>
|
|
471
1356
|
) : null}
|
|
472
1357
|
<div className="pill-transcript-area">
|
|
473
|
-
<div className="pill-pane-label pill-pane-label-row">
|
|
474
|
-
<span>Transcript</span>
|
|
475
|
-
<button
|
|
476
|
-
type="button"
|
|
477
|
-
data-no-drag
|
|
478
|
-
className="pill-copy-btn"
|
|
479
|
-
onClick={handleCopyTranscript}
|
|
480
|
-
disabled={!hasTranscriptLines}
|
|
481
|
-
aria-label="Copy transcript"
|
|
482
|
-
title="Copy transcript"
|
|
483
|
-
>
|
|
484
|
-
{transcriptCopied ? (
|
|
485
|
-
<IconCheck size={12} />
|
|
486
|
-
) : (
|
|
487
|
-
<IconCopy size={12} />
|
|
488
|
-
)}
|
|
489
|
-
</button>
|
|
490
|
-
</div>
|
|
491
1358
|
<LiveTranscript
|
|
492
1359
|
onLinesChange={handleTranscriptLines}
|
|
493
1360
|
initialLines={preloadedLines}
|
|
494
1361
|
/>
|
|
495
1362
|
</div>
|
|
496
|
-
{
|
|
497
|
-
<
|
|
498
|
-
|
|
1363
|
+
{askSheetOpen ? (
|
|
1364
|
+
<div
|
|
1365
|
+
className="pill-ask-sheet"
|
|
1366
|
+
data-state={askSheetClosing ? "closing" : "open"}
|
|
1367
|
+
style={{ height: `${Math.round(askSheetHeight * 100)}%` }}
|
|
1368
|
+
data-no-drag
|
|
1369
|
+
>
|
|
1370
|
+
<div
|
|
1371
|
+
className="pill-ask-sheet-grip"
|
|
1372
|
+
role="button"
|
|
1373
|
+
tabIndex={0}
|
|
1374
|
+
aria-label="Resize or dismiss answers"
|
|
499
1375
|
data-no-drag
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
title="Ask"
|
|
1376
|
+
onPointerDown={handleSheetHandlePointerDown}
|
|
1377
|
+
onPointerMove={handleSheetHandlePointerMove}
|
|
1378
|
+
onPointerUp={handleSheetHandlePointerUp}
|
|
1379
|
+
onPointerCancel={handleSheetHandlePointerCancel}
|
|
1380
|
+
onLostPointerCapture={handleSheetHandlePointerCancel}
|
|
1381
|
+
onClick={(e) => {
|
|
1382
|
+
if (e.detail > 0 && !sheetDragMovedRef.current) {
|
|
1383
|
+
closeAskSheet();
|
|
1384
|
+
}
|
|
1385
|
+
}}
|
|
1386
|
+
onKeyDown={(e) => {
|
|
1387
|
+
if (e.key === "Enter" || e.key === " ") closeAskSheet();
|
|
1388
|
+
}}
|
|
514
1389
|
>
|
|
515
|
-
<
|
|
516
|
-
</
|
|
517
|
-
<
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
const mid = activeMeetingIdRef.current;
|
|
523
|
-
if (mid)
|
|
524
|
-
emit("clips:open-meeting", { meetingId: mid }).catch(
|
|
525
|
-
() => {},
|
|
526
|
-
);
|
|
1390
|
+
<span className="pill-ask-sheet-handle" aria-hidden />
|
|
1391
|
+
</div>
|
|
1392
|
+
<div
|
|
1393
|
+
className="pill-ask-sheet-scroll"
|
|
1394
|
+
ref={askSheetScrollRef}
|
|
1395
|
+
onScroll={(e) => {
|
|
1396
|
+
askPinnedRef.current = isPinnedToBottom(e.currentTarget);
|
|
527
1397
|
}}
|
|
528
|
-
aria-label="Open in browser"
|
|
529
|
-
title="Open this meeting in the browser"
|
|
530
1398
|
>
|
|
531
|
-
|
|
532
|
-
|
|
1399
|
+
{askMessages.map((m, i) =>
|
|
1400
|
+
m.role === "user" ? (
|
|
1401
|
+
<div key={i} className="pill-ask-msg-user">
|
|
1402
|
+
{m.text}
|
|
1403
|
+
</div>
|
|
1404
|
+
) : (
|
|
1405
|
+
<div key={i} className="pill-ask-msg-assistant">
|
|
1406
|
+
<AskSteps steps={m.steps} streaming={m.streaming} />
|
|
1407
|
+
{m.text}
|
|
1408
|
+
{m.streaming ? (
|
|
1409
|
+
<span className="pill-ask-thread-caret" aria-hidden />
|
|
1410
|
+
) : null}
|
|
1411
|
+
</div>
|
|
1412
|
+
),
|
|
1413
|
+
)}
|
|
1414
|
+
</div>
|
|
1415
|
+
<div className="pill-ask-suggestions" data-no-drag>
|
|
1416
|
+
{(askChips.length
|
|
1417
|
+
? askChips
|
|
1418
|
+
: [
|
|
1419
|
+
{ label: "What did I miss?", ask: "What did I miss?" },
|
|
1420
|
+
{
|
|
1421
|
+
label: "Summarize decisions",
|
|
1422
|
+
ask: "Summarize the decisions made so far",
|
|
1423
|
+
},
|
|
1424
|
+
{
|
|
1425
|
+
label: "Suggest questions",
|
|
1426
|
+
ask: "Suggest questions I should ask next",
|
|
1427
|
+
},
|
|
1428
|
+
]
|
|
1429
|
+
).map((chip) => (
|
|
1430
|
+
<Button
|
|
1431
|
+
key={chip.label}
|
|
1432
|
+
type="button"
|
|
1433
|
+
variant="outline"
|
|
1434
|
+
size="sm"
|
|
1435
|
+
data-no-drag
|
|
1436
|
+
className="h-7 shrink-0 rounded-full px-3 text-xs font-normal"
|
|
1437
|
+
onClick={() => submitAsk(chip.ask)}
|
|
1438
|
+
>
|
|
1439
|
+
{chip.label}
|
|
1440
|
+
</Button>
|
|
1441
|
+
))}
|
|
1442
|
+
</div>
|
|
1443
|
+
</div>
|
|
1444
|
+
) : null}
|
|
1445
|
+
{ctx.mode === "meeting" ? (
|
|
1446
|
+
<form className="pill-ask-bar" onSubmit={handleAskSubmit}>
|
|
1447
|
+
<div className="pill-ask-field" data-no-drag>
|
|
1448
|
+
<input
|
|
1449
|
+
data-no-drag
|
|
1450
|
+
className="pill-ask-input"
|
|
1451
|
+
value={ask}
|
|
1452
|
+
onChange={(e) => setAsk(e.target.value)}
|
|
1453
|
+
placeholder="Ask anything"
|
|
1454
|
+
aria-label="Ask anything about this meeting"
|
|
1455
|
+
disabled={!ctx.meetingId}
|
|
1456
|
+
/>
|
|
1457
|
+
<button
|
|
1458
|
+
type="submit"
|
|
1459
|
+
data-no-drag
|
|
1460
|
+
className="pill-ask-send"
|
|
1461
|
+
disabled={!ask.trim() || !ctx.meetingId}
|
|
1462
|
+
aria-label="Ask"
|
|
1463
|
+
title="Ask"
|
|
1464
|
+
>
|
|
1465
|
+
<IconArrowUp size={13} />
|
|
1466
|
+
</button>
|
|
1467
|
+
</div>
|
|
533
1468
|
</form>
|
|
534
1469
|
) : null}
|
|
535
1470
|
</div>
|