@agents24/chat-react 0.5.47 → 0.5.48
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +31 -1
- package/dist/{chunk-YRUYJFPJ.js → chunk-3UKX2RRE.js} +2 -5
- package/dist/chunk-3UKX2RRE.js.map +1 -0
- package/dist/index.cjs +1 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +1 -1
- package/dist/registry/agents24-chat.json +16 -16
- package/dist/runtime/index.cjs +7 -1
- package/dist/runtime/index.cjs.map +1 -1
- package/dist/runtime/index.js +7 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/use-agent-chat-runtime.d.ts +7 -0
- package/dist/scaffold/app.d.ts +5 -3
- package/dist/scaffold/components/chat/chat-composer.d.ts +4 -2
- package/dist/scaffold/components/chat/chat-message.d.ts +3 -2
- package/dist/scaffold/components/chat/chat-shell.d.ts +3 -2
- package/dist/scaffold/components/chat/message-parts.d.ts +3 -2
- package/dist/scaffold/index.cjs +284 -384
- package/dist/scaffold/index.cjs.map +1 -1
- package/dist/scaffold/index.d.ts +1 -1
- package/dist/scaffold/index.js +267 -366
- package/dist/scaffold/index.js.map +1 -1
- package/dist/styles.css +41 -5
- package/dist/ui/agent-chat-composer.d.ts +4 -1
- package/dist/ui/agent-chat-message.d.ts +3 -1
- package/dist/ui/agent-response-timeline.d.ts +3 -2
- package/dist/ui/attachment-text.d.ts +14 -0
- package/dist/ui/bubble.d.ts +1 -1
- package/dist/ui/completed-tool-activity.d.ts +36 -0
- package/dist/ui/composer-attachments.d.ts +2 -0
- package/dist/ui/index.cjs +2412 -1439
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.ts +6 -0
- package/dist/ui/index.js +2340 -1371
- package/dist/ui/index.js.map +1 -1
- package/dist/ui/message-response.d.ts +1 -1
- package/dist/ui/microphone-input.d.ts +24 -0
- package/dist/ui/pcm-capture.d.ts +14 -0
- package/dist/ui/realtime-dictation.d.ts +30 -0
- package/dist/ui/tool-sessions.d.ts +18 -2
- package/dist/ui/use-agent-chat-composer.d.ts +7 -2
- package/dist/ui/use-agent-chat-dictation.d.ts +65 -0
- package/dist/ui/voice-dictation.d.ts +32 -0
- package/package.json +5 -4
- package/scaffold/src/app.tsx +13 -4
- package/scaffold/src/chat.css +0 -1
- package/scaffold/src/components/chat/chat-composer.tsx +29 -25
- package/scaffold/src/components/chat/chat-message.tsx +4 -1
- package/scaffold/src/components/chat/chat-shell.tsx +8 -3
- package/scaffold/src/components/chat/external-link-dialog.tsx +30 -20
- package/scaffold/src/components/chat/message-parts.tsx +4 -1
- package/scaffold/src/index.tsx +1 -0
- package/dist/chunk-YRUYJFPJ.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# `@agents24/chat-react`
|
|
2
2
|
|
|
3
|
-
Last Updated: 2026-
|
|
3
|
+
Last Updated: 2026-11-09
|
|
4
4
|
|
|
5
5
|
Reusable React chat UI, runtime orchestration, and the canonical source-owned Agents24 chat scaffold.
|
|
6
6
|
|
|
@@ -166,3 +166,33 @@ The source is yours to edit. Runtime packages remain dependencies and supply sha
|
|
|
166
166
|
`Agents24ChatComposer` and `Agents24ChatComposerProps` from `/scaffold` expose the complete default composer, including Agent/model selectors and context status. The complete scaffold accepts `components={{ Composer: MyComposer }}` alongside its Timeline slot. A replacement receives the complete composer props and must preserve accessible validation, recording, cancellation, and queue controls. When rendering the complete composer outside a scaffold, wrap it in the exported `Agents24ChatThemeProvider` and `Agents24ChatTooltipProvider`; pass `mode="inherit"` for host-owned appearance.
|
|
167
167
|
|
|
168
168
|
For a packaged scaffold embedded in a host theme, use `themeMode="inherit"` and import `@agents24/chat-react/scaffold/inherit.css` from your stylesheet instead of the preset scaffold stylesheet. Authentication remains host-owned; the scaffold provides the identity footer, not a sign-in gate.
|
|
169
|
+
|
|
170
|
+
## Audio attachment transcripts
|
|
171
|
+
|
|
172
|
+
Declare a Speech to Text `processed_text` workflow export, then pass `attachmentTextOutputs: ["audio_transcript"]` to `useAgentChatRuntime` or the scaffold App. The name must exist on the selected Agent. The controller requests it on initial and queued sends, fetches text when available, and restores output pages on reconnect. Ordinary audio keeps its attachment with a bounded transcript preview; explicit dictation becomes a text bubble. Copy includes the authorized text. Original submission text/IDs are preserved. Results are scoped, ephemeral and expiry-aware; unavailable or blank results preserve the source.
|
|
173
|
+
|
|
174
|
+
## Direct dictation and audio previews
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
Ordinary audio attachments keep their audio presentation when a selected processed-text export arrives. Clicking or keyboard-activating the audio opens a transcript preview capped at 600 Unicode characters; long results show the beginning plus an ellipsis. Copy retains the full authorized transcript.
|
|
178
|
+
|
|
179
|
+
`useAgentChatDictation` from `/ui` owns the shared recording/edit/send state machine and composes `useAgentChatComposer`. In explicitly configured completed-file mode, its host supplies a transcriber for Stop-to-edit. Send during capture submits the original audio immediately with `createDictationComposerFile`; it does not call that transcriber. Send after edit-transcription has started reuses that result and submits text, avoiding duplicate STT. Scope changes and cancellation discard late results; shared composer validation, upload ownership and failure restoration remain authoritative.
|
|
180
|
+
|
|
181
|
+
`PortableUpload.transcriptPresentation: "dictation"` is an explicit presentation hint. Clients carry an ordered `transcript_presentations` multipart array; the backend validates count/values and audio MIME, persists `metadata.transcript_presentation`, and includes the hint in upload idempotency identity. Canonical upload and timeline descriptors expose typed `transcript_presentation`, which React retains across history hydration. Pending dictation shows “Audio recording” and “Transcribing…” before fully becoming the ordinary user-message text bubble on authorized transcript arrival, with a reduced-motion-aware transition. Attachment, preview and placeholder styling is package-owned and independent of host Tailwind scanning. Omitted hints preserve ordinary audio behavior. The hint does not select a Model or change execution authority.
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
## Native live dictation
|
|
185
|
+
|
|
186
|
+
Configure `workflow_contract.dictation` on the Agent with a `realtime_speech_to_text` model. The runtime exposes `runtime.dictation`; pass it as `realtimeDictation` to a public/source-owned composer, or as `realtime` to `useAgentChatDictation`. The default scaffold wires this automatically. Availability comes from authorized bootstrap and is independent of audio attachment acceptance.
|
|
187
|
+
|
|
188
|
+
The package captures mono PCM16 and connects directly to the Agents24 session socket. Partial transcripts stay hidden. Stop finalizes once and appends speech to the editable draft. Send finalizes the same session, displays the compact pending recording row, and submits ordinary text with `dictationSessionId` provenance. It uploads no dictated recording and invokes no file STT. Existing text and independently attached files are preserved. Late Send reuses the pending finalization. Blank speech sends nothing; a live failure preserves the draft and asks the user to record again. There is no automatic fallback or audio replay. Completed results may be recovered through authorized session reads without another transcription.
|
|
189
|
+
|
|
190
|
+
Custom hosts forward the third composer submission context to `runtime.submit({ text, files, dictationSessionId: context?.dictationSessionId })`. Explicit file-transcription mode remains opt-in. Original audio attachments retain their existing UI and bounded transcript preview.
|
|
191
|
+
|
|
192
|
+
## Microphone input selection
|
|
193
|
+
|
|
194
|
+
The composer has one microphone control, implemented by the shared `MicrophoneInput` primitive. Native dictation availability comes from authorized bootstrap (`features.dictation`); audio recording availability comes separately from enabled audio input with `recording_enabled`. With one available mode, clicking starts it directly. With both, clicking opens a keyboard-accessible menu containing **Dictate text** and **Record audio**, without acquiring the microphone until a mode is chosen. Escape and outside click dismiss the menu. No available modes means no microphone control.
|
|
195
|
+
|
|
196
|
+
Dictate text uses the native realtime session and submits ordinary text with its session reference. Stop edits the draft; Send finalizes the same session. Record audio creates an ordinary attachment using the shared file recorder, without dictation presentation metadata or a native session reference. It follows the existing workflow/file-STT path. Neither mode automatically switches into the other. Platform, public/scaffold composers and Tavi share this selection primitive; hosts retain their layout and localization.
|
|
197
|
+
|
|
198
|
+
The platform control adapter obtains availability through the authorized Agent/version `dictation-config` endpoint. Both new-chat streaming and existing-thread submission forward `dictation_session_id`. Graph normalization preserves dictation configuration on Save; Agent model references include its selected realtime model. Audio attachments are not synthesized from native dictation.
|
|
@@ -5,10 +5,7 @@ function getAgentChatActivity(message, parts = message.parts, isLoading = false)
|
|
|
5
5
|
if (status === "waiting") return message.activity?.capacityWait ? "capacity" : "waiting";
|
|
6
6
|
if (status === "interrupted" || status === "cancelling") return status;
|
|
7
7
|
if (!isLoading && status !== "running") return null;
|
|
8
|
-
|
|
9
|
-
const tail = parts[parts.length - 1];
|
|
10
|
-
if (tail?.kind === "text" && tail.text.trim() || !parts.length && message.content.trim()) return null;
|
|
11
|
-
return "thinking";
|
|
8
|
+
return parts.length === 0 && !message.content.trim() ? "thinking" : null;
|
|
12
9
|
}
|
|
13
10
|
|
|
14
11
|
// src/streaming-text.ts
|
|
@@ -200,4 +197,4 @@ export {
|
|
|
200
197
|
isActiveStreamingTextPart,
|
|
201
198
|
useStreamingText
|
|
202
199
|
};
|
|
203
|
-
//# sourceMappingURL=chunk-
|
|
200
|
+
//# sourceMappingURL=chunk-3UKX2RRE.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/activity.ts","../src/streaming-text.ts"],"sourcesContent":["import type { ChatMessage, ChatPart } from \"./types\";\n\nexport type AgentChatActivity = \"thinking\" | \"capacity\" | \"waiting\" | \"interrupted\" | \"cancelling\";\n\n/** Activity is independent of token streaming. Waiting never animates old text. */\nexport function getAgentChatActivity(\n message: ChatMessage,\n parts: readonly ChatPart[] = message.parts,\n isLoading = false,\n): AgentChatActivity | null {\n if (message.role !== \"assistant\" || message.isFinal || message.responseCompletion\n || parts.some(part => part.kind === \"hitl\" && part.status === \"pending\")) return null;\n const status = message.activity?.status;\n if (status === \"waiting\") return message.activity?.capacityWait ? \"capacity\" : \"waiting\";\n if (status === \"interrupted\" || status === \"cancelling\") return status;\n if (!isLoading && status !== \"running\") return null;\n // The generic placeholder owns the empty turn. Once content is visible,\n // canonical tool, model, and node activity own their respective rows.\n return parts.length === 0 && !message.content.trim() ? \"thinking\" : null;\n}\n","import { useEffect, useRef, useState } from \"react\";\n\nimport type { ChatMessage, ChatPart } from \"./types\";\n\nexport type StreamingTextMode = \"streaming\" | \"static\";\n\nexport type StreamingTextCache = {\n get: (id: string) => string | undefined;\n set: (id: string, text: string) => void;\n};\n\nexport type UseStreamingTextOptions = {\n id: string;\n isStreaming: boolean;\n text: string;\n cache?: StreamingTextCache | false;\n charsPerSecond?: number;\n catchupThreshold?: number;\n maxCatchupChars?: number;\n};\n\nexport type UseStreamingTextResult = {\n displayedText: string;\n isAnimating: boolean;\n mode: StreamingTextMode;\n parseIncompleteMarkdown: boolean;\n};\n\nconst DEFAULT_COMPLETED_TEXT_CACHE_SIZE = 200;\nconst STREAM_RUNWAY_MS = 80;\nconst STREAM_IDLE_RELEASE_MS = 120;\nconst defaultCompletedTextCache = new Map<string, string>();\n\nconst defaultStreamingTextCache: StreamingTextCache = {\n get: (id) => defaultCompletedTextCache.get(id),\n set: (id, text) => {\n defaultCompletedTextCache.set(id, text);\n if (defaultCompletedTextCache.size > DEFAULT_COMPLETED_TEXT_CACHE_SIZE) {\n const firstKey = defaultCompletedTextCache.keys().next().value;\n if (firstKey) defaultCompletedTextCache.delete(firstKey);\n }\n },\n};\n\nexport const getActiveStreamingTextPartId = (\n message: ChatMessage,\n streamingMessageId: string | null\n) => {\n if (message.role !== \"assistant\" || message.responseCompletion || streamingMessageId !== message.id) return null;\n const trailingPart = message.parts[message.parts.length - 1];\n return trailingPart?.kind === \"text\" ? trailingPart.id : null;\n};\n\nexport const isActiveStreamingTextPart = (\n message: ChatMessage,\n part: ChatPart,\n streamingMessageId: string | null\n) => part.kind === \"text\" && part.id === getActiveStreamingTextPartId(message, streamingMessageId);\n\nconst graphemeEndOffsets = (value: string): number[] => {\n if (!value) return [];\n\n if (typeof Intl !== \"undefined\" && \"Segmenter\" in Intl) {\n const segmenter = new Intl.Segmenter(undefined, { granularity: \"grapheme\" });\n return Array.from(segmenter.segment(value), ({ index, segment }) => index + segment.length);\n }\n\n const characters = Array.from(value);\n const offsets: number[] = [];\n let offset = 0;\n let regionalIndicators = 0;\n characters.forEach((character, index) => {\n const previous = characters[index - 1];\n const codePoint = character.codePointAt(0) ?? 0;\n const isRegionalIndicator = codePoint >= 0x1f1e6 && codePoint <= 0x1f1ff;\n const continuesCluster =\n index > 0 &&\n (/^\\p{Mark}$/u.test(character) ||\n (codePoint >= 0xfe00 && codePoint <= 0xfe0f) ||\n (codePoint >= 0x1f3fb && codePoint <= 0x1f3ff) ||\n character === \"\\u200d\" ||\n previous === \"\\u200d\" ||\n (isRegionalIndicator && regionalIndicators % 2 === 1));\n if (!continuesCluster) {\n if (offset > 0) offsets.push(offset);\n regionalIndicators = 0;\n }\n offset += character.length;\n regionalIndicators = isRegionalIndicator ? regionalIndicators + 1 : 0;\n });\n offsets.push(offset);\n return offsets;\n};\n\nexport function useStreamingText({\n id,\n isStreaming,\n text,\n cache = defaultStreamingTextCache,\n charsPerSecond = 72,\n catchupThreshold = 40,\n maxCatchupChars = 20,\n}: UseStreamingTextOptions): UseStreamingTextResult {\n const cacheAdapter = cache === false ? null : cache;\n const [displayedText, setDisplayedText] = useState(() => {\n const cachedText = cacheAdapter?.get(id);\n return cachedText && text.startsWith(cachedText) ? cachedText : text;\n });\n const targetRef = useRef(text);\n const displayedRef = useRef(displayedText);\n const rafRef = useRef<number | null>(null);\n const lastFrameAtRef = useRef<number | null>(null);\n const targetUpdatedAtRef = useRef<number | null>(null);\n const progressRemainderRef = useRef(0);\n const idRef = useRef(id);\n const streamingRef = useRef(isStreaming);\n const reduceMotionRef = useRef(false);\n\n useEffect(() => {\n if (isStreaming || !text) return;\n cacheAdapter?.set(id, text);\n }, [cacheAdapter, id, isStreaming, text]);\n\n useEffect(() => {\n targetRef.current = text;\n targetUpdatedAtRef.current =\n typeof performance === \"undefined\" ? null : performance.now();\n\n if (\n !isStreaming ||\n reduceMotionRef.current ||\n !text.startsWith(displayedRef.current)\n ) {\n displayedRef.current = text;\n setDisplayedText(text);\n progressRemainderRef.current = 0;\n }\n }, [isStreaming, text]);\n\n useEffect(() => {\n if (idRef.current === id) return;\n\n idRef.current = id;\n const cachedText = cacheAdapter?.get(id);\n const initial = cachedText && text.startsWith(cachedText) ? cachedText : text;\n displayedRef.current = initial;\n setDisplayedText(initial);\n lastFrameAtRef.current = null;\n targetUpdatedAtRef.current =\n typeof performance === \"undefined\" ? null : performance.now();\n progressRemainderRef.current = 0;\n }, [cacheAdapter, id, isStreaming, text]);\n\n useEffect(() => {\n streamingRef.current = isStreaming;\n\n if (typeof window === \"undefined\") {\n displayedRef.current = text;\n setDisplayedText(text);\n return;\n }\n\n const reduceMotion =\n typeof window.matchMedia === \"function\" &&\n window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n reduceMotionRef.current = reduceMotion;\n\n if (reduceMotion || !isStreaming) {\n displayedRef.current = text;\n setDisplayedText(text);\n return;\n }\n\n const cachedText = cacheAdapter?.get(id);\n if (cachedText === text) {\n displayedRef.current = text;\n setDisplayedText(text);\n return;\n }\n\n if (!text.startsWith(displayedRef.current)) {\n displayedRef.current = text;\n setDisplayedText(text);\n }\n\n const tick = (timestamp: number) => {\n const previousTimestamp = lastFrameAtRef.current ?? timestamp;\n lastFrameAtRef.current = timestamp;\n\n const target = targetRef.current;\n const current = displayedRef.current;\n\n if (!streamingRef.current || reduceMotionRef.current) {\n displayedRef.current = target;\n setDisplayedText(target);\n rafRef.current = null;\n return;\n }\n\n if (!target.startsWith(current)) {\n displayedRef.current = target;\n setDisplayedText(target);\n progressRemainderRef.current = 0;\n rafRef.current = window.requestAnimationFrame(tick);\n return;\n }\n\n const pending = target.slice(current.length);\n const pendingOffsets = graphemeEndOffsets(pending);\n if (pendingOffsets.length === 0) {\n rafRef.current = window.requestAnimationFrame(tick);\n return;\n }\n\n const elapsedMs = Math.max(0, timestamp - previousTimestamp);\n const targetIdleMs =\n targetUpdatedAtRef.current === null\n ? STREAM_IDLE_RELEASE_MS\n : Math.max(0, timestamp - targetUpdatedAtRef.current);\n const runway =\n targetIdleMs >= STREAM_IDLE_RELEASE_MS\n ? 0\n : Math.min(\n pendingOffsets.length - 1,\n Math.max(1, Math.ceil((charsPerSecond * STREAM_RUNWAY_MS) / 1000))\n );\n const eligibleGraphemes = pendingOffsets.length - runway;\n\n progressRemainderRef.current += (elapsedMs / 1000) * charsPerSecond;\n let step = Math.floor(progressRemainderRef.current);\n if (current.length === 0 && eligibleGraphemes > 0) step = Math.max(1, step);\n\n const catchupStep =\n pendingOffsets.length > catchupThreshold\n ? Math.min(maxCatchupChars, Math.ceil(pendingOffsets.length / 10))\n : 0;\n step = Math.min(eligibleGraphemes, Math.max(step, catchupStep));\n\n if (step > 0) {\n progressRemainderRef.current = Math.max(0, progressRemainderRef.current - step);\n const next = current + pending.slice(0, pendingOffsets[step - 1]);\n displayedRef.current = next;\n setDisplayedText(next);\n }\n rafRef.current = window.requestAnimationFrame(tick);\n };\n\n if (rafRef.current === null) {\n rafRef.current = window.requestAnimationFrame(tick);\n }\n\n return () => {\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n }\n lastFrameAtRef.current = null;\n progressRemainderRef.current = 0;\n };\n }, [cacheAdapter, catchupThreshold, charsPerSecond, id, isStreaming, maxCatchupChars]);\n\n const reduceMotion =\n typeof window !== \"undefined\" &&\n typeof window.matchMedia === \"function\" &&\n window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n\n return {\n displayedText: !isStreaming || reduceMotion ? text : displayedText,\n isAnimating: isStreaming,\n mode: isStreaming ? \"streaming\" : \"static\",\n parseIncompleteMarkdown: isStreaming,\n };\n}\n"],"mappings":";AAKO,SAAS,qBACd,SACA,QAA6B,QAAQ,OACrC,YAAY,OACc;AAC1B,MAAI,QAAQ,SAAS,eAAe,QAAQ,WAAW,QAAQ,sBAC1D,MAAM,KAAK,UAAQ,KAAK,SAAS,UAAU,KAAK,WAAW,SAAS,EAAG,QAAO;AACnF,QAAM,SAAS,QAAQ,UAAU;AACjC,MAAI,WAAW,UAAW,QAAO,QAAQ,UAAU,eAAe,aAAa;AAC/E,MAAI,WAAW,iBAAiB,WAAW,aAAc,QAAO;AAChE,MAAI,CAAC,aAAa,WAAW,UAAW,QAAO;AAG/C,SAA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UAAU,IAAI;AAC9E,cAAM,OAAO,UAAU,QAAQ,MAAM,GAAG,eAAe,OAAO,CAAC,CAAC;AAChE,qBAAa,UAAU;AACvB,yBAAiB,IAAI;AAAA,MACvB;AACA,aAAO,UAAU,OAAO,sBAAsB,IAAI;AAAA,IACpD;AAEA,QAAI,OAAO,YAAY,MAAM;AAC3B,aAAO,UAAU,OAAO,sBAAsB,IAAI;AAAA,IACpD;AAEA,WAAO,MAAM;AACX,UAAI,OAAO,YAAY,MAAM;AAC3B,6BAAqB,OAAO,OAAO;AACnC,eAAO,UAAU;AAAA,MACnB;AACA,qBAAe,UAAU;AACzB,2BAAqB,UAAU;AAAA,IACjC;AAAA,EACF,GAAG,CAAC,cAAc,kBAAkB,gBAAgB,IAAI,aAAa,eAAe,CAAC;AAErF,QAAM,eACJ,OAAO,WAAW,eAClB,OAAO,OAAO,eAAe,cAC7B,OAAO,WAAW,kCAAkC,EAAE;AAExD,SAAO;AAAA,IACL,eAAe,CAAC,eAAe,eAAe,OAAO;AAAA,IACrD,aAAa;AAAA,IACb,MAAM,cAAc,cAAc;AAAA,IAClC,yBAAyB;AAAA,EAC3B;AACF;","names":["reduceMotion"]}
|
package/dist/index.cjs
CHANGED
|
@@ -432,10 +432,7 @@ function getAgentChatActivity(message, parts = message.parts, isLoading = false)
|
|
|
432
432
|
if (status === "waiting") return message.activity?.capacityWait ? "capacity" : "waiting";
|
|
433
433
|
if (status === "interrupted" || status === "cancelling") return status;
|
|
434
434
|
if (!isLoading && status !== "running") return null;
|
|
435
|
-
|
|
436
|
-
const tail = parts[parts.length - 1];
|
|
437
|
-
if (tail?.kind === "text" && tail.text.trim() || !parts.length && message.content.trim()) return null;
|
|
438
|
-
return "thinking";
|
|
435
|
+
return parts.length === 0 && !message.content.trim() ? "thinking" : null;
|
|
439
436
|
}
|
|
440
437
|
|
|
441
438
|
// src/mcp-oauth.ts
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/latest-thread-scroller.tsx","../src/activity.ts","../src/mcp-oauth.ts","../src/streaming-text.ts","../src/viewport.ts"],"sourcesContent":["export * from \"./latest-thread-scroller\";\nexport * from \"./activity\";\nexport * from \"./mcp-oauth\";\nexport * from \"./streaming-text\";\nexport * from \"./types\";\nexport * from \"./viewport\";\n","import * as React from \"react\";\nimport {\n MessageScroller,\n useMessageScroller,\n useMessageScrollerVisibility,\n} from \"@shadcn/react/message-scroller\";\n\nconst cx = (...values: Array<string | false | null | undefined>) =>\n values.filter(Boolean).join(\" \");\n\n/** Anchor the current turn only; older user anchors can trigger a late jump. */\nexport function latestThreadAnchorId(messages: readonly { id: string; role: string }[]): string | null {\n for (let index = messages.length - 1; index >= 0; index -= 1) {\n if (messages[index].role === \"user\") return messages[index].id;\n }\n return null;\n}\n\ntype MessageScrollerProviderProps = React.ComponentProps<\n typeof MessageScroller.Provider\n>;\ntype MessageScrollerRootProps = React.ComponentProps<typeof MessageScroller.Root>;\ntype MessageScrollerViewportProps = React.ComponentProps<\n typeof MessageScroller.Viewport\n>;\ntype MessageScrollerContentProps = React.ComponentProps<\n typeof MessageScroller.Content\n>;\ntype MessageScrollerItemProps = React.ComponentProps<typeof MessageScroller.Item>;\ntype MessageScrollerButtonProps = React.ComponentProps<typeof MessageScroller.Button>;\n\ntype LatestThreadScrollerLayoutContextValue = {\n contentElement: HTMLElement | null;\n rootElement: HTMLElement | null;\n setContentElement: (node: HTMLElement | null) => void;\n setRootElement: (node: HTMLElement | null) => void;\n};\n\nconst LatestThreadScrollerLayoutContext =\n React.createContext<LatestThreadScrollerLayoutContextValue | null>(null);\n\nconst useLatestThreadScrollerLayout = () =>\n React.useContext(LatestThreadScrollerLayoutContext);\n\nfunction RestoreThreadPosition({ restoreKey }: { restoreKey?: string | null }) {\n const { scrollToEnd } = useMessageScroller();\n React.useLayoutEffect(() => {\n if (restoreKey) scrollToEnd({ behavior: \"auto\" });\n }, [restoreKey, scrollToEnd]);\n return null;\n}\n\nexport type LatestThreadScrollerProviderProps = MessageScrollerProviderProps & {\n /** Scroll to the latest turn when a different transcript is opened. */\n restoreKey?: string | null;\n};\n\nexport function LatestThreadScrollerProvider({\n autoScroll = true,\n children,\n defaultScrollPosition = \"last-anchor\",\n restoreKey,\n scrollPreviousItemPeek = 64,\n ...props\n}: LatestThreadScrollerProviderProps) {\n return (\n <MessageScroller.Provider\n autoScroll={autoScroll}\n defaultScrollPosition={defaultScrollPosition}\n scrollPreviousItemPeek={scrollPreviousItemPeek}\n {...props}\n >\n {children}\n <RestoreThreadPosition restoreKey={restoreKey} />\n </MessageScroller.Provider>\n );\n}\n\nexport type LatestThreadScrollerRootProps = MessageScrollerRootProps;\n\nexport function LatestThreadScrollerRoot({\n className,\n ref,\n ...props\n}: LatestThreadScrollerRootProps) {\n const [rootElement, setRootElement] = React.useState<HTMLElement | null>(null);\n const [contentElement, setContentElement] =\n React.useState<HTMLElement | null>(null);\n const layoutContext = React.useMemo<LatestThreadScrollerLayoutContextValue>(\n () => ({\n contentElement,\n rootElement,\n setContentElement,\n setRootElement,\n }),\n [contentElement, rootElement]\n );\n const setRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n setRootElement(node);\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n },\n [ref]\n );\n\n return (\n <LatestThreadScrollerLayoutContext.Provider value={layoutContext}>\n <MessageScroller.Root\n ref={setRef}\n className={cx(\n \"a24-scroller relative flex size-full min-h-0 flex-1 flex-col overflow-hidden\",\n className\n )}\n {...props}\n />\n </LatestThreadScrollerLayoutContext.Provider>\n );\n}\n\nexport type LatestThreadScrollerViewportProps =\n MessageScrollerViewportProps & {\n onViewportChange?: (node: HTMLElement | null) => void;\n };\n\nexport function LatestThreadScrollerViewport({\n className,\n onViewportChange,\n preserveScrollOnPrepend = true,\n ref,\n ...props\n}: LatestThreadScrollerViewportProps) {\n const setRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n onViewportChange?.(node);\n },\n [onViewportChange, ref]\n );\n\n return (\n <MessageScroller.Viewport\n ref={setRef}\n className={cx(\n \"a24-scroller__viewport size-full min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain\",\n className\n )}\n preserveScrollOnPrepend={preserveScrollOnPrepend}\n {...props}\n />\n );\n}\n\nexport type LatestThreadScrollerContentProps = MessageScrollerContentProps;\n\nexport function LatestThreadScrollerContent({\n className,\n ref,\n ...props\n}: LatestThreadScrollerContentProps) {\n const layout = useLatestThreadScrollerLayout();\n const setRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n layout?.setContentElement(node);\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n },\n [layout, ref]\n );\n\n return (\n <MessageScroller.Content\n ref={setRef}\n data-agents24-latest-thread-content=\"\"\n className={cx(\"a24-scroller__content flex h-max min-h-full flex-col gap-3 p-4\", className)}\n {...props}\n />\n );\n}\n\nexport type LatestThreadScrollerItemProps = Omit<\n MessageScrollerItemProps,\n \"messageId\"\n> & {\n messageId: string;\n};\n\nexport function LatestThreadScrollerItem({\n className,\n messageId,\n ...props\n}: LatestThreadScrollerItemProps) {\n return (\n <MessageScroller.Item\n className={cx(\n \"a24-scroller__item min-w-0 shrink-0 overflow-visible\",\n className\n )}\n messageId={messageId}\n {...props}\n />\n );\n}\n\nexport type LatestThreadScrollerButtonProps = Omit<\n MessageScrollerButtonProps,\n \"render\"\n> & {\n className?: string;\n render?: MessageScrollerButtonProps[\"render\"];\n};\n\nexport function LatestThreadScrollerButton({\n children,\n className,\n direction = \"end\",\n render,\n ...props\n}: LatestThreadScrollerButtonProps) {\n if (render) {\n return (\n <MessageScroller.Button\n direction={direction}\n render={render}\n {...props}\n />\n );\n }\n\n return (\n <MessageScroller.Button\n direction={direction}\n render={(buttonProps) => (\n <button\n {...(buttonProps as Record<string, unknown>)}\n aria-label={\n direction === \"end\"\n ? \"Scroll to latest message\"\n : \"Scroll to first message\"\n }\n className={cx(\n \"a24-scroller__button absolute bottom-4 left-1/2 z-50 flex size-9 -translate-x-1/2 items-center justify-center rounded-full border border-border bg-background text-foreground shadow-md transition-[background-color,border-color,color,opacity,transform] duration-200 data-[active=false]:pointer-events-none data-[active=false]:translate-y-2 data-[active=false]:opacity-0 data-[active=true]:translate-y-0 data-[active=true]:opacity-100\",\n className\n )}\n type=\"button\"\n >\n {children ?? (direction === \"end\" ? \"↓\" : \"↑\")}\n </button>\n )}\n {...props}\n />\n );\n}\n\nexport type LatestThreadScrollerOutlineItem = {\n id: string;\n label: string;\n messageIds?: string[];\n responsePreview?: string;\n};\n\nexport type LatestThreadScrollerOutlineProps = {\n cardClassName?: string;\n className?: string;\n contentMaxWidth?: number;\n dir?: \"ltr\" | \"rtl\";\n items: LatestThreadScrollerOutlineItem[];\n minContainerWidthForRail?: number;\n minSideGutterForRail?: number;\n side?: \"left\" | \"right\";\n verticalOffset?: string;\n};\n\nexport function LatestThreadScrollerOutline({\n cardClassName,\n className,\n contentMaxWidth = 768,\n dir = \"ltr\",\n items,\n minContainerWidthForRail = 0,\n minSideGutterForRail = 48,\n side,\n verticalOffset = \"3.5rem\",\n}: LatestThreadScrollerOutlineProps) {\n const navRef = React.useRef<HTMLElement | null>(null);\n const layout = useLatestThreadScrollerLayout();\n const [hasSideRoom, setHasSideRoom] = React.useState(false);\n const [hoveredIndex, setHoveredIndex] = React.useState<number | null>(null);\n const { scrollToMessage } = useMessageScroller();\n const { currentAnchorId, visibleMessageIds } = useMessageScrollerVisibility();\n const visibleMessageIdSet = React.useMemo(\n () => new Set(visibleMessageIds),\n [visibleMessageIds]\n );\n const focusIndex = hoveredIndex ?? -1;\n const railSide = side ?? (dir === \"rtl\" ? \"right\" : \"left\");\n\n React.useEffect(() => {\n const root = layout?.rootElement ?? navRef.current?.parentElement;\n if (!root) return;\n\n const updateSideRoom = () => {\n const rootRect = root.getBoundingClientRect();\n const rootWidth = rootRect.width;\n const content = layout?.contentElement;\n const sideGutter = content\n ? Math.max(\n 0,\n railSide === \"left\"\n ? content.getBoundingClientRect().left - rootRect.left\n : rootRect.right - content.getBoundingClientRect().right\n )\n : Math.max(0, (rootWidth - contentMaxWidth) / 2);\n const nextHasSideRoom =\n rootWidth >= minContainerWidthForRail &&\n sideGutter >= minSideGutterForRail;\n setHasSideRoom((current) =>\n current === nextHasSideRoom ? current : nextHasSideRoom\n );\n };\n\n updateSideRoom();\n if (typeof ResizeObserver === \"undefined\") return;\n const resizeObserver = new ResizeObserver(updateSideRoom);\n resizeObserver.observe(root);\n const content = layout?.contentElement;\n if (content) {\n resizeObserver.observe(content);\n }\n return () => resizeObserver.disconnect();\n }, [\n contentMaxWidth,\n layout?.contentElement,\n layout?.rootElement,\n minContainerWidthForRail,\n minSideGutterForRail,\n railSide,\n ]);\n\n if (items.length < 2) {\n return null;\n }\n\n return (\n <nav\n ref={navRef}\n aria-label=\"Transcript outline\"\n data-side={railSide}\n data-visible={hasSideRoom ? \"\" : undefined}\n className={cx(\n \"a24-outline pointer-events-none absolute z-10 max-h-[min(18rem,calc(100%-10rem))] w-16 overflow-visible\",\n hasSideRoom ? \"hidden md:block\" : \"hidden\",\n railSide === \"left\" ? \"left-1\" : \"right-1\",\n className\n )}\n dir={dir}\n style={{\n top: \"50%\",\n transform: `translateY(calc(-50% - ${verticalOffset}))`,\n }}\n >\n <div className=\"a24-outline__rail pointer-events-auto flex flex-col gap-0 py-1\">\n {items.map((item, index) => {\n const itemMessageIds =\n item.messageIds && item.messageIds.length > 0\n ? item.messageIds\n : [item.id];\n const active = itemMessageIds.some(\n (messageId) =>\n visibleMessageIdSet.has(messageId) || messageId === currentAnchorId\n );\n const distance =\n focusIndex >= 0 ? Math.abs(index - focusIndex) : Number.POSITIVE_INFINITY;\n const isFocused = distance === 0;\n const isNear = distance === 1;\n const isNextNear = distance === 2;\n const barWidth = isFocused\n ? 50\n : isNear\n ? 36\n : isNextNear\n ? 23\n : 10;\n const barTone = focusIndex < 0\n ? active ? 80 : 18\n : isFocused ? 80 : isNear ? 32 : isNextNear ? 24 : 16;\n const fallbackLabel = `Turn ${index + 1}`;\n const previewLabel =\n item.label && item.label !== fallbackLabel ? item.label : \"\";\n const responsePreview = (item.responsePreview || \"\").trim();\n\n return (\n <button\n key={item.id}\n type=\"button\"\n data-active={active}\n data-side={railSide}\n dir=\"ltr\"\n className={cx(\n \"a24-outline__button group relative flex h-2 w-16 items-center rounded-sm outline-none\",\n railSide === \"left\" ? \"justify-start\" : \"justify-end\"\n )}\n aria-label={`Jump to ${item.label || fallbackLabel}`}\n onBlur={() => setHoveredIndex(null)}\n onFocus={() => setHoveredIndex(index)}\n onMouseEnter={() => setHoveredIndex(index)}\n onMouseLeave={() => setHoveredIndex(null)}\n onClick={() =>\n scrollToMessage(item.id, {\n align: \"start\",\n behavior: \"smooth\",\n })\n }\n >\n <span\n className=\"a24-outline__bar h-0.5 rounded-full transition-[width,background-color] duration-150 ease-out\"\n style={{\n backgroundColor: `color-mix(in oklch, var(--a24-text) ${barTone}%, transparent)`,\n width: barWidth,\n }}\n />\n {previewLabel ? (\n <span\n dir={dir}\n className={cx(\n \"a24-outline__preview pointer-events-none absolute top-1/2 z-20 max-h-32 w-64 -translate-y-1/2 overflow-hidden rounded-lg border border-border/80 bg-background p-3 text-start opacity-0 shadow-lg transition-[opacity,transform] duration-200 group-hover:pointer-events-auto group-hover:opacity-100 group-focus-visible:pointer-events-auto group-focus-visible:opacity-100\",\n railSide === \"left\"\n ? \"left-full ml-2 -translate-x-1 group-hover:translate-x-0 group-focus-visible:translate-x-0\"\n : \"right-full mr-2 translate-x-1 group-hover:translate-x-0 group-focus-visible:translate-x-0\",\n cardClassName\n )}\n >\n <span\n className=\"block overflow-hidden text-sm leading-5 text-foreground\"\n style={{\n display: \"-webkit-box\",\n WebkitBoxOrient: \"vertical\",\n WebkitLineClamp: responsePreview ? 2 : 4,\n }}\n >\n {previewLabel}\n </span>\n {responsePreview ? (\n <span\n className=\"mt-1 block overflow-hidden text-sm leading-5 text-muted-foreground\"\n style={{\n display: \"-webkit-box\",\n WebkitBoxOrient: \"vertical\",\n WebkitLineClamp: 2,\n }}\n >\n {responsePreview}\n </span>\n ) : null}\n </span>\n ) : null}\n </button>\n );\n })}\n </div>\n </nav>\n );\n}\n\nexport const LatestThreadScroller = {\n Provider: LatestThreadScrollerProvider,\n Root: LatestThreadScrollerRoot,\n Viewport: LatestThreadScrollerViewport,\n Content: LatestThreadScrollerContent,\n Item: LatestThreadScrollerItem,\n Button: LatestThreadScrollerButton,\n Outline: LatestThreadScrollerOutline,\n};\n","import type { ChatMessage, ChatPart } from \"./types\";\n\nexport type AgentChatActivity = \"thinking\" | \"capacity\" | \"waiting\" | \"interrupted\" | \"cancelling\";\n\n/** Activity is independent of token streaming. Waiting never animates old text. */\nexport function getAgentChatActivity(\n message: ChatMessage,\n parts: readonly ChatPart[] = message.parts,\n isLoading = false,\n): AgentChatActivity | null {\n if (message.role !== \"assistant\" || message.isFinal || message.responseCompletion\n || parts.some(part => part.kind === \"hitl\" && part.status === \"pending\")) return null;\n const status = message.activity?.status;\n if (status === \"waiting\") return message.activity?.capacityWait ? \"capacity\" : \"waiting\";\n if (status === \"interrupted\" || status === \"cancelling\") return status;\n if (!isLoading && status !== \"running\") return null;\n if (parts.some(part => part.kind === \"tool\" && [\"input-streaming\", \"input-available\"].includes(part.state)\n || part.kind === \"model-turn\" && part.turnKind === \"agent\" && part.status === \"running\"\n || part.kind === \"node-activity\" && part.defaultChatVisible && part.status === \"running\"\n || part.kind === \"context-compression\" && part.status === \"started\"\n || part.kind === \"reasoning\" && Boolean(part.text || part.label)\n || part.kind === \"ui-blocks\" && [\"input-streaming\", \"input-available\"].includes(part.state))) return null;\n const tail = parts[parts.length - 1];\n if (tail?.kind === \"text\" && tail.text.trim() || !parts.length && message.content.trim()) return null;\n return \"thinking\";\n}\n","import type { McpCallbackResult } from \"@agents24/client\";\nimport type { ChatMcpOauthCompletion, WaitForMcpOauthCompleteInput } from \"./types\";\n\nconst UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\n\ntype CryptoLike = {\n getRandomValues<T extends Uint8Array>(array: T): T;\n randomUUID(): string;\n subtle: { digest(algorithm: string, data: Uint8Array): Promise<ArrayBuffer> };\n};\n\nexport function browserChatCrypto(): CryptoLike {\n const value = (globalThis as unknown as { crypto?: CryptoLike }).crypto;\n if (!value?.subtle || !value.randomUUID) {\n throw new Error(\"Secure browser crypto is required for MCP authorization.\");\n }\n return value;\n}\n\nfunction base64Url(bytes: Uint8Array): string {\n let binary = \"\";\n bytes.forEach((byte) => { binary += String.fromCharCode(byte); });\n return btoa(binary).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/g, \"\");\n}\n\nexport async function createMcpPkceProof(): Promise<{ challenge: string; verifier: string }> {\n const crypto = browserChatCrypto();\n const verifier = base64Url(crypto.getRandomValues(new Uint8Array(32)));\n const digest = await crypto.subtle.digest(\"SHA-256\", new TextEncoder().encode(verifier));\n return { challenge: base64Url(new Uint8Array(digest)), verifier };\n}\n\nfunction isLoopback(hostname: string): boolean {\n return hostname === \"localhost\" || hostname === \"127.0.0.1\" || hostname === \"[::1]\";\n}\n\nfunction normalizedOrigin(value: string): string {\n try {\n const url = new URL(value);\n if (url.protocol !== \"https:\" && !(url.protocol === \"http:\" && isLoopback(url.hostname))) {\n throw new Error(\"unsafe callback origin\");\n }\n if (url.origin === \"null\") throw new Error(\"opaque callback origin\");\n return url.origin;\n } catch {\n throw new Error(\"MCP authorization returned an invalid callback origin.\");\n }\n}\n\nexport function validateMcpCallbackResult(\n result: McpCallbackResult,\n expectedServerId: string,\n): McpCallbackResult {\n const serverId = String(result.server_id || \"\").trim();\n const connectionId = String(result.connection_id || \"\").trim();\n if (!serverId || serverId !== expectedServerId) {\n throw new Error(\"MCP authorization completed for an unexpected server.\");\n }\n if (!UUID_PATTERN.test(connectionId)) {\n throw new Error(\"MCP authorization returned an invalid connection identity.\");\n }\n return result;\n}\n\nexport function waitForMcpOauthComplete({\n popup,\n callbackOrigin,\n popupNonce,\n requireConnectionId = false,\n serverId,\n runId,\n interruptId,\n signal,\n timeoutMs = 120_000,\n}: WaitForMcpOauthCompleteInput): Promise<ChatMcpOauthCompletion> {\n if (!popup) return Promise.reject(new Error(\"Could not open the MCP authorization popup.\"));\n const expectedOrigin = normalizedOrigin(callbackOrigin);\n const expectedServerId = String(serverId || \"\").trim();\n const expectedPopupNonce = String(popupNonce || \"\").trim();\n if (!expectedServerId) return Promise.reject(new Error(\"MCP authorization is missing its server identity.\"));\n if (!expectedPopupNonce) return Promise.reject(new Error(\"MCP authorization is missing its popup binding.\"));\n const aborted = () => new DOMException(\"MCP authorization detached.\", \"AbortError\");\n if (signal?.aborted) return Promise.reject(aborted());\n const returnFocusTo = typeof document !== \"undefined\"\n ? document.activeElement as { focus?: () => void } | null\n : null;\n\n return new Promise((resolve, reject) => {\n let settled = false;\n const finish = (result: ChatMcpOauthCompletion | Error) => {\n if (settled) return;\n settled = true;\n window.clearTimeout(timeout);\n window.clearInterval(closeTimer);\n window.removeEventListener(\"message\", onMessage);\n signal?.removeEventListener(\"abort\", onAbort);\n if (!signal?.aborted) returnFocusTo?.focus?.();\n if (result instanceof Error) reject(result);\n else resolve(result);\n };\n const onAbort = () => finish(aborted());\n const onMessage = (event: MessageEvent) => {\n if (event.source !== popup || event.origin !== expectedOrigin) return;\n const data = event.data as {\n type?: string;\n code?: string;\n connection_id?: string;\n popup_nonce?: string;\n server_id?: string;\n run_id?: string;\n interrupt_id?: string;\n success?: boolean;\n } | null;\n if (\n data?.type !== \"agents24.mcp.callback\" ||\n data.server_id !== expectedServerId ||\n data.popup_nonce !== expectedPopupNonce ||\n (runId !== undefined && data.run_id !== runId) ||\n (interruptId !== undefined && data.interrupt_id !== interruptId)\n ) return;\n if (data.success === false) {\n finish(new Error(\"MCP authorization could not be completed.\"));\n return;\n }\n const code = String(data.code || \"\").trim();\n if (!code || code.length > 2048) return;\n const connectionId = String(data.connection_id || \"\").trim();\n if ((requireConnectionId || connectionId) && !UUID_PATTERN.test(connectionId)) return;\n finish({\n code,\n ...(connectionId ? { connectionId } : {}),\n popupNonce: expectedPopupNonce,\n serverId: expectedServerId,\n });\n };\n const timeout = window.setTimeout(\n () => finish(new Error(\"MCP authorization timed out.\")),\n Math.max(1, timeoutMs),\n );\n const closeTimer = window.setInterval(() => {\n if (popup.closed) finish(new Error(\"MCP authorization window was closed before connecting.\"));\n }, 500);\n window.addEventListener(\"message\", onMessage);\n signal?.addEventListener(\"abort\", onAbort, { once: true });\n });\n}\n","import { useEffect, useRef, useState } from \"react\";\n\nimport type { ChatMessage, ChatPart } from \"./types\";\n\nexport type StreamingTextMode = \"streaming\" | \"static\";\n\nexport type StreamingTextCache = {\n get: (id: string) => string | undefined;\n set: (id: string, text: string) => void;\n};\n\nexport type UseStreamingTextOptions = {\n id: string;\n isStreaming: boolean;\n text: string;\n cache?: StreamingTextCache | false;\n charsPerSecond?: number;\n catchupThreshold?: number;\n maxCatchupChars?: number;\n};\n\nexport type UseStreamingTextResult = {\n displayedText: string;\n isAnimating: boolean;\n mode: StreamingTextMode;\n parseIncompleteMarkdown: boolean;\n};\n\nconst DEFAULT_COMPLETED_TEXT_CACHE_SIZE = 200;\nconst STREAM_RUNWAY_MS = 80;\nconst STREAM_IDLE_RELEASE_MS = 120;\nconst defaultCompletedTextCache = new Map<string, string>();\n\nconst defaultStreamingTextCache: StreamingTextCache = {\n get: (id) => defaultCompletedTextCache.get(id),\n set: (id, text) => {\n defaultCompletedTextCache.set(id, text);\n if (defaultCompletedTextCache.size > DEFAULT_COMPLETED_TEXT_CACHE_SIZE) {\n const firstKey = defaultCompletedTextCache.keys().next().value;\n if (firstKey) defaultCompletedTextCache.delete(firstKey);\n }\n },\n};\n\nexport const getActiveStreamingTextPartId = (\n message: ChatMessage,\n streamingMessageId: string | null\n) => {\n if (message.role !== \"assistant\" || message.responseCompletion || streamingMessageId !== message.id) return null;\n const trailingPart = message.parts[message.parts.length - 1];\n return trailingPart?.kind === \"text\" ? trailingPart.id : null;\n};\n\nexport const isActiveStreamingTextPart = (\n message: ChatMessage,\n part: ChatPart,\n streamingMessageId: string | null\n) => part.kind === \"text\" && part.id === getActiveStreamingTextPartId(message, streamingMessageId);\n\nconst graphemeEndOffsets = (value: string): number[] => {\n if (!value) return [];\n\n if (typeof Intl !== \"undefined\" && \"Segmenter\" in Intl) {\n const segmenter = new Intl.Segmenter(undefined, { granularity: \"grapheme\" });\n return Array.from(segmenter.segment(value), ({ index, segment }) => index + segment.length);\n }\n\n const characters = Array.from(value);\n const offsets: number[] = [];\n let offset = 0;\n let regionalIndicators = 0;\n characters.forEach((character, index) => {\n const previous = characters[index - 1];\n const codePoint = character.codePointAt(0) ?? 0;\n const isRegionalIndicator = codePoint >= 0x1f1e6 && codePoint <= 0x1f1ff;\n const continuesCluster =\n index > 0 &&\n (/^\\p{Mark}$/u.test(character) ||\n (codePoint >= 0xfe00 && codePoint <= 0xfe0f) ||\n (codePoint >= 0x1f3fb && codePoint <= 0x1f3ff) ||\n character === \"\\u200d\" ||\n previous === \"\\u200d\" ||\n (isRegionalIndicator && regionalIndicators % 2 === 1));\n if (!continuesCluster) {\n if (offset > 0) offsets.push(offset);\n regionalIndicators = 0;\n }\n offset += character.length;\n regionalIndicators = isRegionalIndicator ? regionalIndicators + 1 : 0;\n });\n offsets.push(offset);\n return offsets;\n};\n\nexport function useStreamingText({\n id,\n isStreaming,\n text,\n cache = defaultStreamingTextCache,\n charsPerSecond = 72,\n catchupThreshold = 40,\n maxCatchupChars = 20,\n}: UseStreamingTextOptions): UseStreamingTextResult {\n const cacheAdapter = cache === false ? null : cache;\n const [displayedText, setDisplayedText] = useState(() => {\n const cachedText = cacheAdapter?.get(id);\n return cachedText && text.startsWith(cachedText) ? cachedText : text;\n });\n const targetRef = useRef(text);\n const displayedRef = useRef(displayedText);\n const rafRef = useRef<number | null>(null);\n const lastFrameAtRef = useRef<number | null>(null);\n const targetUpdatedAtRef = useRef<number | null>(null);\n const progressRemainderRef = useRef(0);\n const idRef = useRef(id);\n const streamingRef = useRef(isStreaming);\n const reduceMotionRef = useRef(false);\n\n useEffect(() => {\n if (isStreaming || !text) return;\n cacheAdapter?.set(id, text);\n }, [cacheAdapter, id, isStreaming, text]);\n\n useEffect(() => {\n targetRef.current = text;\n targetUpdatedAtRef.current =\n typeof performance === \"undefined\" ? null : performance.now();\n\n if (\n !isStreaming ||\n reduceMotionRef.current ||\n !text.startsWith(displayedRef.current)\n ) {\n displayedRef.current = text;\n setDisplayedText(text);\n progressRemainderRef.current = 0;\n }\n }, [isStreaming, text]);\n\n useEffect(() => {\n if (idRef.current === id) return;\n\n idRef.current = id;\n const cachedText = cacheAdapter?.get(id);\n const initial = cachedText && text.startsWith(cachedText) ? cachedText : text;\n displayedRef.current = initial;\n setDisplayedText(initial);\n lastFrameAtRef.current = null;\n targetUpdatedAtRef.current =\n typeof performance === \"undefined\" ? null : performance.now();\n progressRemainderRef.current = 0;\n }, [cacheAdapter, id, isStreaming, text]);\n\n useEffect(() => {\n streamingRef.current = isStreaming;\n\n if (typeof window === \"undefined\") {\n displayedRef.current = text;\n setDisplayedText(text);\n return;\n }\n\n const reduceMotion =\n typeof window.matchMedia === \"function\" &&\n window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n reduceMotionRef.current = reduceMotion;\n\n if (reduceMotion || !isStreaming) {\n displayedRef.current = text;\n setDisplayedText(text);\n return;\n }\n\n const cachedText = cacheAdapter?.get(id);\n if (cachedText === text) {\n displayedRef.current = text;\n setDisplayedText(text);\n return;\n }\n\n if (!text.startsWith(displayedRef.current)) {\n displayedRef.current = text;\n setDisplayedText(text);\n }\n\n const tick = (timestamp: number) => {\n const previousTimestamp = lastFrameAtRef.current ?? timestamp;\n lastFrameAtRef.current = timestamp;\n\n const target = targetRef.current;\n const current = displayedRef.current;\n\n if (!streamingRef.current || reduceMotionRef.current) {\n displayedRef.current = target;\n setDisplayedText(target);\n rafRef.current = null;\n return;\n }\n\n if (!target.startsWith(current)) {\n displayedRef.current = target;\n setDisplayedText(target);\n progressRemainderRef.current = 0;\n rafRef.current = window.requestAnimationFrame(tick);\n return;\n }\n\n const pending = target.slice(current.length);\n const pendingOffsets = graphemeEndOffsets(pending);\n if (pendingOffsets.length === 0) {\n rafRef.current = window.requestAnimationFrame(tick);\n return;\n }\n\n const elapsedMs = Math.max(0, timestamp - previousTimestamp);\n const targetIdleMs =\n targetUpdatedAtRef.current === null\n ? STREAM_IDLE_RELEASE_MS\n : Math.max(0, timestamp - targetUpdatedAtRef.current);\n const runway =\n targetIdleMs >= STREAM_IDLE_RELEASE_MS\n ? 0\n : Math.min(\n pendingOffsets.length - 1,\n Math.max(1, Math.ceil((charsPerSecond * STREAM_RUNWAY_MS) / 1000))\n );\n const eligibleGraphemes = pendingOffsets.length - runway;\n\n progressRemainderRef.current += (elapsedMs / 1000) * charsPerSecond;\n let step = Math.floor(progressRemainderRef.current);\n if (current.length === 0 && eligibleGraphemes > 0) step = Math.max(1, step);\n\n const catchupStep =\n pendingOffsets.length > catchupThreshold\n ? Math.min(maxCatchupChars, Math.ceil(pendingOffsets.length / 10))\n : 0;\n step = Math.min(eligibleGraphemes, Math.max(step, catchupStep));\n\n if (step > 0) {\n progressRemainderRef.current = Math.max(0, progressRemainderRef.current - step);\n const next = current + pending.slice(0, pendingOffsets[step - 1]);\n displayedRef.current = next;\n setDisplayedText(next);\n }\n rafRef.current = window.requestAnimationFrame(tick);\n };\n\n if (rafRef.current === null) {\n rafRef.current = window.requestAnimationFrame(tick);\n }\n\n return () => {\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n }\n lastFrameAtRef.current = null;\n progressRemainderRef.current = 0;\n };\n }, [cacheAdapter, catchupThreshold, charsPerSecond, id, isStreaming, maxCatchupChars]);\n\n const reduceMotion =\n typeof window !== \"undefined\" &&\n typeof window.matchMedia === \"function\" &&\n window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n\n return {\n displayedText: !isStreaming || reduceMotion ? text : displayedText,\n isAnimating: isStreaming,\n mode: isStreaming ? \"streaming\" : \"static\",\n parseIncompleteMarkdown: isStreaming,\n };\n}\n","export {\n MessageScroller,\n useMessageScroller,\n useMessageScrollerScrollable,\n useMessageScrollerVisibility,\n} from \"@shadcn/react/message-scroller\";\nexport type {\n MessageScrollerDefaultScrollPosition,\n MessageScrollerScrollAlign,\n MessageScrollerScrollable,\n MessageScrollerScrollOptions,\n MessageScrollerVisibilityState,\n} from \"@shadcn/react/message-scroller\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,8BAIO;AA6DH;AA3DJ,IAAM,KAAK,IAAI,WACb,OAAO,OAAO,OAAO,EAAE,KAAK,GAAG;AAG1B,SAAS,qBAAqB,UAAkE;AACrG,WAAS,QAAQ,SAAS,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG;AAC5D,QAAI,SAAS,KAAK,EAAE,SAAS,OAAQ,QAAO,SAAS,KAAK,EAAE;AAAA,EAC9D;AACA,SAAO;AACT;AAsBA,IAAM,oCACE,oBAA6D,IAAI;AAEzE,IAAM,gCAAgC,MAC9B,iBAAW,iCAAiC;AAEpD,SAAS,sBAAsB,EAAE,WAAW,GAAmC;AAC7E,QAAM,EAAE,YAAY,QAAI,4CAAmB;AAC3C,EAAM,sBAAgB,MAAM;AAC1B,QAAI,WAAY,aAAY,EAAE,UAAU,OAAO,CAAC;AAAA,EAClD,GAAG,CAAC,YAAY,WAAW,CAAC;AAC5B,SAAO;AACT;AAOO,SAAS,6BAA6B;AAAA,EAC3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,qBAAa,UAAU;AACvB,yBAAiB,IAAI;AAAA,MACvB;AACA,aAAO,UAAU,OAAO,sBAAsB,IAAI;AAAA,IACpD;AAEA,QAAI,OAAO,YAAY,MAAM;AAC3B,aAAO,UAAU,OAAO,sBAAsB,IAAI;AAAA,IACpD;AAEA,WAAO,MAAM;AACX,UAAI,OAAO,YAAY,MAAM;AAC3B,6BAAqB,OAAO,OAAO;AACnC,eAAO,UAAU;AAAA,MACnB;AACA,qBAAe,UAAU;AACzB,2BAAqB,UAAU;AAAA,IACjC;AAAA,EACF,GAAG,CAAC,cAAc,kBAAkB,gBAAgB,IAAI,aAAa,eAAe,CAAC;AAErF,QAAM,eACJ,OAAO,WAAW,eAClB,OAAO,OAAO,eAAe,cAC7B,OAAO,WAAW,kCAAkC,EAAE;AAExD,SAAO;AAAA,IACL,eAAe,CAAC,eAAe,eAAe,OAAO;AAAA,IACrD,aAAa;AAAA,IACb,MAAM,cAAc,cAAc;AAAA,IAClC,yBAAyB;AAAA,EAC3B;AACF;;;AChRA,IAAAC,2BAKO;","names":["content","reduceMotion","import_message_scroller"]}
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/latest-thread-scroller.tsx","../src/activity.ts","../src/mcp-oauth.ts","../src/streaming-text.ts","../src/viewport.ts"],"sourcesContent":["export * from \"./latest-thread-scroller\";\nexport * from \"./activity\";\nexport * from \"./mcp-oauth\";\nexport * from \"./streaming-text\";\nexport * from \"./types\";\nexport * from \"./viewport\";\n","import * as React from \"react\";\nimport {\n MessageScroller,\n useMessageScroller,\n useMessageScrollerVisibility,\n} from \"@shadcn/react/message-scroller\";\n\nconst cx = (...values: Array<string | false | null | undefined>) =>\n values.filter(Boolean).join(\" \");\n\n/** Anchor the current turn only; older user anchors can trigger a late jump. */\nexport function latestThreadAnchorId(messages: readonly { id: string; role: string }[]): string | null {\n for (let index = messages.length - 1; index >= 0; index -= 1) {\n if (messages[index].role === \"user\") return messages[index].id;\n }\n return null;\n}\n\ntype MessageScrollerProviderProps = React.ComponentProps<\n typeof MessageScroller.Provider\n>;\ntype MessageScrollerRootProps = React.ComponentProps<typeof MessageScroller.Root>;\ntype MessageScrollerViewportProps = React.ComponentProps<\n typeof MessageScroller.Viewport\n>;\ntype MessageScrollerContentProps = React.ComponentProps<\n typeof MessageScroller.Content\n>;\ntype MessageScrollerItemProps = React.ComponentProps<typeof MessageScroller.Item>;\ntype MessageScrollerButtonProps = React.ComponentProps<typeof MessageScroller.Button>;\n\ntype LatestThreadScrollerLayoutContextValue = {\n contentElement: HTMLElement | null;\n rootElement: HTMLElement | null;\n setContentElement: (node: HTMLElement | null) => void;\n setRootElement: (node: HTMLElement | null) => void;\n};\n\nconst LatestThreadScrollerLayoutContext =\n React.createContext<LatestThreadScrollerLayoutContextValue | null>(null);\n\nconst useLatestThreadScrollerLayout = () =>\n React.useContext(LatestThreadScrollerLayoutContext);\n\nfunction RestoreThreadPosition({ restoreKey }: { restoreKey?: string | null }) {\n const { scrollToEnd } = useMessageScroller();\n React.useLayoutEffect(() => {\n if (restoreKey) scrollToEnd({ behavior: \"auto\" });\n }, [restoreKey, scrollToEnd]);\n return null;\n}\n\nexport type LatestThreadScrollerProviderProps = MessageScrollerProviderProps & {\n /** Scroll to the latest turn when a different transcript is opened. */\n restoreKey?: string | null;\n};\n\nexport function LatestThreadScrollerProvider({\n autoScroll = true,\n children,\n defaultScrollPosition = \"last-anchor\",\n restoreKey,\n scrollPreviousItemPeek = 64,\n ...props\n}: LatestThreadScrollerProviderProps) {\n return (\n <MessageScroller.Provider\n autoScroll={autoScroll}\n defaultScrollPosition={defaultScrollPosition}\n scrollPreviousItemPeek={scrollPreviousItemPeek}\n {...props}\n >\n {children}\n <RestoreThreadPosition restoreKey={restoreKey} />\n </MessageScroller.Provider>\n );\n}\n\nexport type LatestThreadScrollerRootProps = MessageScrollerRootProps;\n\nexport function LatestThreadScrollerRoot({\n className,\n ref,\n ...props\n}: LatestThreadScrollerRootProps) {\n const [rootElement, setRootElement] = React.useState<HTMLElement | null>(null);\n const [contentElement, setContentElement] =\n React.useState<HTMLElement | null>(null);\n const layoutContext = React.useMemo<LatestThreadScrollerLayoutContextValue>(\n () => ({\n contentElement,\n rootElement,\n setContentElement,\n setRootElement,\n }),\n [contentElement, rootElement]\n );\n const setRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n setRootElement(node);\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n },\n [ref]\n );\n\n return (\n <LatestThreadScrollerLayoutContext.Provider value={layoutContext}>\n <MessageScroller.Root\n ref={setRef}\n className={cx(\n \"a24-scroller relative flex size-full min-h-0 flex-1 flex-col overflow-hidden\",\n className\n )}\n {...props}\n />\n </LatestThreadScrollerLayoutContext.Provider>\n );\n}\n\nexport type LatestThreadScrollerViewportProps =\n MessageScrollerViewportProps & {\n onViewportChange?: (node: HTMLElement | null) => void;\n };\n\nexport function LatestThreadScrollerViewport({\n className,\n onViewportChange,\n preserveScrollOnPrepend = true,\n ref,\n ...props\n}: LatestThreadScrollerViewportProps) {\n const setRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n onViewportChange?.(node);\n },\n [onViewportChange, ref]\n );\n\n return (\n <MessageScroller.Viewport\n ref={setRef}\n className={cx(\n \"a24-scroller__viewport size-full min-h-0 min-w-0 flex-1 overflow-y-auto overscroll-contain\",\n className\n )}\n preserveScrollOnPrepend={preserveScrollOnPrepend}\n {...props}\n />\n );\n}\n\nexport type LatestThreadScrollerContentProps = MessageScrollerContentProps;\n\nexport function LatestThreadScrollerContent({\n className,\n ref,\n ...props\n}: LatestThreadScrollerContentProps) {\n const layout = useLatestThreadScrollerLayout();\n const setRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n layout?.setContentElement(node);\n if (typeof ref === \"function\") {\n ref(node);\n } else if (ref) {\n ref.current = node;\n }\n },\n [layout, ref]\n );\n\n return (\n <MessageScroller.Content\n ref={setRef}\n data-agents24-latest-thread-content=\"\"\n className={cx(\"a24-scroller__content flex h-max min-h-full flex-col gap-3 p-4\", className)}\n {...props}\n />\n );\n}\n\nexport type LatestThreadScrollerItemProps = Omit<\n MessageScrollerItemProps,\n \"messageId\"\n> & {\n messageId: string;\n};\n\nexport function LatestThreadScrollerItem({\n className,\n messageId,\n ...props\n}: LatestThreadScrollerItemProps) {\n return (\n <MessageScroller.Item\n className={cx(\n \"a24-scroller__item min-w-0 shrink-0 overflow-visible\",\n className\n )}\n messageId={messageId}\n {...props}\n />\n );\n}\n\nexport type LatestThreadScrollerButtonProps = Omit<\n MessageScrollerButtonProps,\n \"render\"\n> & {\n className?: string;\n render?: MessageScrollerButtonProps[\"render\"];\n};\n\nexport function LatestThreadScrollerButton({\n children,\n className,\n direction = \"end\",\n render,\n ...props\n}: LatestThreadScrollerButtonProps) {\n if (render) {\n return (\n <MessageScroller.Button\n direction={direction}\n render={render}\n {...props}\n />\n );\n }\n\n return (\n <MessageScroller.Button\n direction={direction}\n render={(buttonProps) => (\n <button\n {...(buttonProps as Record<string, unknown>)}\n aria-label={\n direction === \"end\"\n ? \"Scroll to latest message\"\n : \"Scroll to first message\"\n }\n className={cx(\n \"a24-scroller__button absolute bottom-4 left-1/2 z-50 flex size-9 -translate-x-1/2 items-center justify-center rounded-full border border-border bg-background text-foreground shadow-md transition-[background-color,border-color,color,opacity,transform] duration-200 data-[active=false]:pointer-events-none data-[active=false]:translate-y-2 data-[active=false]:opacity-0 data-[active=true]:translate-y-0 data-[active=true]:opacity-100\",\n className\n )}\n type=\"button\"\n >\n {children ?? (direction === \"end\" ? \"↓\" : \"↑\")}\n </button>\n )}\n {...props}\n />\n );\n}\n\nexport type LatestThreadScrollerOutlineItem = {\n id: string;\n label: string;\n messageIds?: string[];\n responsePreview?: string;\n};\n\nexport type LatestThreadScrollerOutlineProps = {\n cardClassName?: string;\n className?: string;\n contentMaxWidth?: number;\n dir?: \"ltr\" | \"rtl\";\n items: LatestThreadScrollerOutlineItem[];\n minContainerWidthForRail?: number;\n minSideGutterForRail?: number;\n side?: \"left\" | \"right\";\n verticalOffset?: string;\n};\n\nexport function LatestThreadScrollerOutline({\n cardClassName,\n className,\n contentMaxWidth = 768,\n dir = \"ltr\",\n items,\n minContainerWidthForRail = 0,\n minSideGutterForRail = 48,\n side,\n verticalOffset = \"3.5rem\",\n}: LatestThreadScrollerOutlineProps) {\n const navRef = React.useRef<HTMLElement | null>(null);\n const layout = useLatestThreadScrollerLayout();\n const [hasSideRoom, setHasSideRoom] = React.useState(false);\n const [hoveredIndex, setHoveredIndex] = React.useState<number | null>(null);\n const { scrollToMessage } = useMessageScroller();\n const { currentAnchorId, visibleMessageIds } = useMessageScrollerVisibility();\n const visibleMessageIdSet = React.useMemo(\n () => new Set(visibleMessageIds),\n [visibleMessageIds]\n );\n const focusIndex = hoveredIndex ?? -1;\n const railSide = side ?? (dir === \"rtl\" ? \"right\" : \"left\");\n\n React.useEffect(() => {\n const root = layout?.rootElement ?? navRef.current?.parentElement;\n if (!root) return;\n\n const updateSideRoom = () => {\n const rootRect = root.getBoundingClientRect();\n const rootWidth = rootRect.width;\n const content = layout?.contentElement;\n const sideGutter = content\n ? Math.max(\n 0,\n railSide === \"left\"\n ? content.getBoundingClientRect().left - rootRect.left\n : rootRect.right - content.getBoundingClientRect().right\n )\n : Math.max(0, (rootWidth - contentMaxWidth) / 2);\n const nextHasSideRoom =\n rootWidth >= minContainerWidthForRail &&\n sideGutter >= minSideGutterForRail;\n setHasSideRoom((current) =>\n current === nextHasSideRoom ? current : nextHasSideRoom\n );\n };\n\n updateSideRoom();\n if (typeof ResizeObserver === \"undefined\") return;\n const resizeObserver = new ResizeObserver(updateSideRoom);\n resizeObserver.observe(root);\n const content = layout?.contentElement;\n if (content) {\n resizeObserver.observe(content);\n }\n return () => resizeObserver.disconnect();\n }, [\n contentMaxWidth,\n layout?.contentElement,\n layout?.rootElement,\n minContainerWidthForRail,\n minSideGutterForRail,\n railSide,\n ]);\n\n if (items.length < 2) {\n return null;\n }\n\n return (\n <nav\n ref={navRef}\n aria-label=\"Transcript outline\"\n data-side={railSide}\n data-visible={hasSideRoom ? \"\" : undefined}\n className={cx(\n \"a24-outline pointer-events-none absolute z-10 max-h-[min(18rem,calc(100%-10rem))] w-16 overflow-visible\",\n hasSideRoom ? \"hidden md:block\" : \"hidden\",\n railSide === \"left\" ? \"left-1\" : \"right-1\",\n className\n )}\n dir={dir}\n style={{\n top: \"50%\",\n transform: `translateY(calc(-50% - ${verticalOffset}))`,\n }}\n >\n <div className=\"a24-outline__rail pointer-events-auto flex flex-col gap-0 py-1\">\n {items.map((item, index) => {\n const itemMessageIds =\n item.messageIds && item.messageIds.length > 0\n ? item.messageIds\n : [item.id];\n const active = itemMessageIds.some(\n (messageId) =>\n visibleMessageIdSet.has(messageId) || messageId === currentAnchorId\n );\n const distance =\n focusIndex >= 0 ? Math.abs(index - focusIndex) : Number.POSITIVE_INFINITY;\n const isFocused = distance === 0;\n const isNear = distance === 1;\n const isNextNear = distance === 2;\n const barWidth = isFocused\n ? 50\n : isNear\n ? 36\n : isNextNear\n ? 23\n : 10;\n const barTone = focusIndex < 0\n ? active ? 80 : 18\n : isFocused ? 80 : isNear ? 32 : isNextNear ? 24 : 16;\n const fallbackLabel = `Turn ${index + 1}`;\n const previewLabel =\n item.label && item.label !== fallbackLabel ? item.label : \"\";\n const responsePreview = (item.responsePreview || \"\").trim();\n\n return (\n <button\n key={item.id}\n type=\"button\"\n data-active={active}\n data-side={railSide}\n dir=\"ltr\"\n className={cx(\n \"a24-outline__button group relative flex h-2 w-16 items-center rounded-sm outline-none\",\n railSide === \"left\" ? \"justify-start\" : \"justify-end\"\n )}\n aria-label={`Jump to ${item.label || fallbackLabel}`}\n onBlur={() => setHoveredIndex(null)}\n onFocus={() => setHoveredIndex(index)}\n onMouseEnter={() => setHoveredIndex(index)}\n onMouseLeave={() => setHoveredIndex(null)}\n onClick={() =>\n scrollToMessage(item.id, {\n align: \"start\",\n behavior: \"smooth\",\n })\n }\n >\n <span\n className=\"a24-outline__bar h-0.5 rounded-full transition-[width,background-color] duration-150 ease-out\"\n style={{\n backgroundColor: `color-mix(in oklch, var(--a24-text) ${barTone}%, transparent)`,\n width: barWidth,\n }}\n />\n {previewLabel ? (\n <span\n dir={dir}\n className={cx(\n \"a24-outline__preview pointer-events-none absolute top-1/2 z-20 max-h-32 w-64 -translate-y-1/2 overflow-hidden rounded-lg border border-border/80 bg-background p-3 text-start opacity-0 shadow-lg transition-[opacity,transform] duration-200 group-hover:pointer-events-auto group-hover:opacity-100 group-focus-visible:pointer-events-auto group-focus-visible:opacity-100\",\n railSide === \"left\"\n ? \"left-full ml-2 -translate-x-1 group-hover:translate-x-0 group-focus-visible:translate-x-0\"\n : \"right-full mr-2 translate-x-1 group-hover:translate-x-0 group-focus-visible:translate-x-0\",\n cardClassName\n )}\n >\n <span\n className=\"block overflow-hidden text-sm leading-5 text-foreground\"\n style={{\n display: \"-webkit-box\",\n WebkitBoxOrient: \"vertical\",\n WebkitLineClamp: responsePreview ? 2 : 4,\n }}\n >\n {previewLabel}\n </span>\n {responsePreview ? (\n <span\n className=\"mt-1 block overflow-hidden text-sm leading-5 text-muted-foreground\"\n style={{\n display: \"-webkit-box\",\n WebkitBoxOrient: \"vertical\",\n WebkitLineClamp: 2,\n }}\n >\n {responsePreview}\n </span>\n ) : null}\n </span>\n ) : null}\n </button>\n );\n })}\n </div>\n </nav>\n );\n}\n\nexport const LatestThreadScroller = {\n Provider: LatestThreadScrollerProvider,\n Root: LatestThreadScrollerRoot,\n Viewport: LatestThreadScrollerViewport,\n Content: LatestThreadScrollerContent,\n Item: LatestThreadScrollerItem,\n Button: LatestThreadScrollerButton,\n Outline: LatestThreadScrollerOutline,\n};\n","import type { ChatMessage, ChatPart } from \"./types\";\n\nexport type AgentChatActivity = \"thinking\" | \"capacity\" | \"waiting\" | \"interrupted\" | \"cancelling\";\n\n/** Activity is independent of token streaming. Waiting never animates old text. */\nexport function getAgentChatActivity(\n message: ChatMessage,\n parts: readonly ChatPart[] = message.parts,\n isLoading = false,\n): AgentChatActivity | null {\n if (message.role !== \"assistant\" || message.isFinal || message.responseCompletion\n || parts.some(part => part.kind === \"hitl\" && part.status === \"pending\")) return null;\n const status = message.activity?.status;\n if (status === \"waiting\") return message.activity?.capacityWait ? \"capacity\" : \"waiting\";\n if (status === \"interrupted\" || status === \"cancelling\") return status;\n if (!isLoading && status !== \"running\") return null;\n // The generic placeholder owns the empty turn. Once content is visible,\n // canonical tool, model, and node activity own their respective rows.\n return parts.length === 0 && !message.content.trim() ? \"thinking\" : null;\n}\n","import type { McpCallbackResult } from \"@agents24/client\";\nimport type { ChatMcpOauthCompletion, WaitForMcpOauthCompleteInput } from \"./types\";\n\nconst UUID_PATTERN = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i;\n\ntype CryptoLike = {\n getRandomValues<T extends Uint8Array>(array: T): T;\n randomUUID(): string;\n subtle: { digest(algorithm: string, data: Uint8Array): Promise<ArrayBuffer> };\n};\n\nexport function browserChatCrypto(): CryptoLike {\n const value = (globalThis as unknown as { crypto?: CryptoLike }).crypto;\n if (!value?.subtle || !value.randomUUID) {\n throw new Error(\"Secure browser crypto is required for MCP authorization.\");\n }\n return value;\n}\n\nfunction base64Url(bytes: Uint8Array): string {\n let binary = \"\";\n bytes.forEach((byte) => { binary += String.fromCharCode(byte); });\n return btoa(binary).replace(/\\+/g, \"-\").replace(/\\//g, \"_\").replace(/=+$/g, \"\");\n}\n\nexport async function createMcpPkceProof(): Promise<{ challenge: string; verifier: string }> {\n const crypto = browserChatCrypto();\n const verifier = base64Url(crypto.getRandomValues(new Uint8Array(32)));\n const digest = await crypto.subtle.digest(\"SHA-256\", new TextEncoder().encode(verifier));\n return { challenge: base64Url(new Uint8Array(digest)), verifier };\n}\n\nfunction isLoopback(hostname: string): boolean {\n return hostname === \"localhost\" || hostname === \"127.0.0.1\" || hostname === \"[::1]\";\n}\n\nfunction normalizedOrigin(value: string): string {\n try {\n const url = new URL(value);\n if (url.protocol !== \"https:\" && !(url.protocol === \"http:\" && isLoopback(url.hostname))) {\n throw new Error(\"unsafe callback origin\");\n }\n if (url.origin === \"null\") throw new Error(\"opaque callback origin\");\n return url.origin;\n } catch {\n throw new Error(\"MCP authorization returned an invalid callback origin.\");\n }\n}\n\nexport function validateMcpCallbackResult(\n result: McpCallbackResult,\n expectedServerId: string,\n): McpCallbackResult {\n const serverId = String(result.server_id || \"\").trim();\n const connectionId = String(result.connection_id || \"\").trim();\n if (!serverId || serverId !== expectedServerId) {\n throw new Error(\"MCP authorization completed for an unexpected server.\");\n }\n if (!UUID_PATTERN.test(connectionId)) {\n throw new Error(\"MCP authorization returned an invalid connection identity.\");\n }\n return result;\n}\n\nexport function waitForMcpOauthComplete({\n popup,\n callbackOrigin,\n popupNonce,\n requireConnectionId = false,\n serverId,\n runId,\n interruptId,\n signal,\n timeoutMs = 120_000,\n}: WaitForMcpOauthCompleteInput): Promise<ChatMcpOauthCompletion> {\n if (!popup) return Promise.reject(new Error(\"Could not open the MCP authorization popup.\"));\n const expectedOrigin = normalizedOrigin(callbackOrigin);\n const expectedServerId = String(serverId || \"\").trim();\n const expectedPopupNonce = String(popupNonce || \"\").trim();\n if (!expectedServerId) return Promise.reject(new Error(\"MCP authorization is missing its server identity.\"));\n if (!expectedPopupNonce) return Promise.reject(new Error(\"MCP authorization is missing its popup binding.\"));\n const aborted = () => new DOMException(\"MCP authorization detached.\", \"AbortError\");\n if (signal?.aborted) return Promise.reject(aborted());\n const returnFocusTo = typeof document !== \"undefined\"\n ? document.activeElement as { focus?: () => void } | null\n : null;\n\n return new Promise((resolve, reject) => {\n let settled = false;\n const finish = (result: ChatMcpOauthCompletion | Error) => {\n if (settled) return;\n settled = true;\n window.clearTimeout(timeout);\n window.clearInterval(closeTimer);\n window.removeEventListener(\"message\", onMessage);\n signal?.removeEventListener(\"abort\", onAbort);\n if (!signal?.aborted) returnFocusTo?.focus?.();\n if (result instanceof Error) reject(result);\n else resolve(result);\n };\n const onAbort = () => finish(aborted());\n const onMessage = (event: MessageEvent) => {\n if (event.source !== popup || event.origin !== expectedOrigin) return;\n const data = event.data as {\n type?: string;\n code?: string;\n connection_id?: string;\n popup_nonce?: string;\n server_id?: string;\n run_id?: string;\n interrupt_id?: string;\n success?: boolean;\n } | null;\n if (\n data?.type !== \"agents24.mcp.callback\" ||\n data.server_id !== expectedServerId ||\n data.popup_nonce !== expectedPopupNonce ||\n (runId !== undefined && data.run_id !== runId) ||\n (interruptId !== undefined && data.interrupt_id !== interruptId)\n ) return;\n if (data.success === false) {\n finish(new Error(\"MCP authorization could not be completed.\"));\n return;\n }\n const code = String(data.code || \"\").trim();\n if (!code || code.length > 2048) return;\n const connectionId = String(data.connection_id || \"\").trim();\n if ((requireConnectionId || connectionId) && !UUID_PATTERN.test(connectionId)) return;\n finish({\n code,\n ...(connectionId ? { connectionId } : {}),\n popupNonce: expectedPopupNonce,\n serverId: expectedServerId,\n });\n };\n const timeout = window.setTimeout(\n () => finish(new Error(\"MCP authorization timed out.\")),\n Math.max(1, timeoutMs),\n );\n const closeTimer = window.setInterval(() => {\n if (popup.closed) finish(new Error(\"MCP authorization window was closed before connecting.\"));\n }, 500);\n window.addEventListener(\"message\", onMessage);\n signal?.addEventListener(\"abort\", onAbort, { once: true });\n });\n}\n","import { useEffect, useRef, useState } from \"react\";\n\nimport type { ChatMessage, ChatPart } from \"./types\";\n\nexport type StreamingTextMode = \"streaming\" | \"static\";\n\nexport type StreamingTextCache = {\n get: (id: string) => string | undefined;\n set: (id: string, text: string) => void;\n};\n\nexport type UseStreamingTextOptions = {\n id: string;\n isStreaming: boolean;\n text: string;\n cache?: StreamingTextCache | false;\n charsPerSecond?: number;\n catchupThreshold?: number;\n maxCatchupChars?: number;\n};\n\nexport type UseStreamingTextResult = {\n displayedText: string;\n isAnimating: boolean;\n mode: StreamingTextMode;\n parseIncompleteMarkdown: boolean;\n};\n\nconst DEFAULT_COMPLETED_TEXT_CACHE_SIZE = 200;\nconst STREAM_RUNWAY_MS = 80;\nconst STREAM_IDLE_RELEASE_MS = 120;\nconst defaultCompletedTextCache = new Map<string, string>();\n\nconst defaultStreamingTextCache: StreamingTextCache = {\n get: (id) => defaultCompletedTextCache.get(id),\n set: (id, text) => {\n defaultCompletedTextCache.set(id, text);\n if (defaultCompletedTextCache.size > DEFAULT_COMPLETED_TEXT_CACHE_SIZE) {\n const firstKey = defaultCompletedTextCache.keys().next().value;\n if (firstKey) defaultCompletedTextCache.delete(firstKey);\n }\n },\n};\n\nexport const getActiveStreamingTextPartId = (\n message: ChatMessage,\n streamingMessageId: string | null\n) => {\n if (message.role !== \"assistant\" || message.responseCompletion || streamingMessageId !== message.id) return null;\n const trailingPart = message.parts[message.parts.length - 1];\n return trailingPart?.kind === \"text\" ? trailingPart.id : null;\n};\n\nexport const isActiveStreamingTextPart = (\n message: ChatMessage,\n part: ChatPart,\n streamingMessageId: string | null\n) => part.kind === \"text\" && part.id === getActiveStreamingTextPartId(message, streamingMessageId);\n\nconst graphemeEndOffsets = (value: string): number[] => {\n if (!value) return [];\n\n if (typeof Intl !== \"undefined\" && \"Segmenter\" in Intl) {\n const segmenter = new Intl.Segmenter(undefined, { granularity: \"grapheme\" });\n return Array.from(segmenter.segment(value), ({ index, segment }) => index + segment.length);\n }\n\n const characters = Array.from(value);\n const offsets: number[] = [];\n let offset = 0;\n let regionalIndicators = 0;\n characters.forEach((character, index) => {\n const previous = characters[index - 1];\n const codePoint = character.codePointAt(0) ?? 0;\n const isRegionalIndicator = codePoint >= 0x1f1e6 && codePoint <= 0x1f1ff;\n const continuesCluster =\n index > 0 &&\n (/^\\p{Mark}$/u.test(character) ||\n (codePoint >= 0xfe00 && codePoint <= 0xfe0f) ||\n (codePoint >= 0x1f3fb && codePoint <= 0x1f3ff) ||\n character === \"\\u200d\" ||\n previous === \"\\u200d\" ||\n (isRegionalIndicator && regionalIndicators % 2 === 1));\n if (!continuesCluster) {\n if (offset > 0) offsets.push(offset);\n regionalIndicators = 0;\n }\n offset += character.length;\n regionalIndicators = isRegionalIndicator ? regionalIndicators + 1 : 0;\n });\n offsets.push(offset);\n return offsets;\n};\n\nexport function useStreamingText({\n id,\n isStreaming,\n text,\n cache = defaultStreamingTextCache,\n charsPerSecond = 72,\n catchupThreshold = 40,\n maxCatchupChars = 20,\n}: UseStreamingTextOptions): UseStreamingTextResult {\n const cacheAdapter = cache === false ? null : cache;\n const [displayedText, setDisplayedText] = useState(() => {\n const cachedText = cacheAdapter?.get(id);\n return cachedText && text.startsWith(cachedText) ? cachedText : text;\n });\n const targetRef = useRef(text);\n const displayedRef = useRef(displayedText);\n const rafRef = useRef<number | null>(null);\n const lastFrameAtRef = useRef<number | null>(null);\n const targetUpdatedAtRef = useRef<number | null>(null);\n const progressRemainderRef = useRef(0);\n const idRef = useRef(id);\n const streamingRef = useRef(isStreaming);\n const reduceMotionRef = useRef(false);\n\n useEffect(() => {\n if (isStreaming || !text) return;\n cacheAdapter?.set(id, text);\n }, [cacheAdapter, id, isStreaming, text]);\n\n useEffect(() => {\n targetRef.current = text;\n targetUpdatedAtRef.current =\n typeof performance === \"undefined\" ? null : performance.now();\n\n if (\n !isStreaming ||\n reduceMotionRef.current ||\n !text.startsWith(displayedRef.current)\n ) {\n displayedRef.current = text;\n setDisplayedText(text);\n progressRemainderRef.current = 0;\n }\n }, [isStreaming, text]);\n\n useEffect(() => {\n if (idRef.current === id) return;\n\n idRef.current = id;\n const cachedText = cacheAdapter?.get(id);\n const initial = cachedText && text.startsWith(cachedText) ? cachedText : text;\n displayedRef.current = initial;\n setDisplayedText(initial);\n lastFrameAtRef.current = null;\n targetUpdatedAtRef.current =\n typeof performance === \"undefined\" ? null : performance.now();\n progressRemainderRef.current = 0;\n }, [cacheAdapter, id, isStreaming, text]);\n\n useEffect(() => {\n streamingRef.current = isStreaming;\n\n if (typeof window === \"undefined\") {\n displayedRef.current = text;\n setDisplayedText(text);\n return;\n }\n\n const reduceMotion =\n typeof window.matchMedia === \"function\" &&\n window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n reduceMotionRef.current = reduceMotion;\n\n if (reduceMotion || !isStreaming) {\n displayedRef.current = text;\n setDisplayedText(text);\n return;\n }\n\n const cachedText = cacheAdapter?.get(id);\n if (cachedText === text) {\n displayedRef.current = text;\n setDisplayedText(text);\n return;\n }\n\n if (!text.startsWith(displayedRef.current)) {\n displayedRef.current = text;\n setDisplayedText(text);\n }\n\n const tick = (timestamp: number) => {\n const previousTimestamp = lastFrameAtRef.current ?? timestamp;\n lastFrameAtRef.current = timestamp;\n\n const target = targetRef.current;\n const current = displayedRef.current;\n\n if (!streamingRef.current || reduceMotionRef.current) {\n displayedRef.current = target;\n setDisplayedText(target);\n rafRef.current = null;\n return;\n }\n\n if (!target.startsWith(current)) {\n displayedRef.current = target;\n setDisplayedText(target);\n progressRemainderRef.current = 0;\n rafRef.current = window.requestAnimationFrame(tick);\n return;\n }\n\n const pending = target.slice(current.length);\n const pendingOffsets = graphemeEndOffsets(pending);\n if (pendingOffsets.length === 0) {\n rafRef.current = window.requestAnimationFrame(tick);\n return;\n }\n\n const elapsedMs = Math.max(0, timestamp - previousTimestamp);\n const targetIdleMs =\n targetUpdatedAtRef.current === null\n ? STREAM_IDLE_RELEASE_MS\n : Math.max(0, timestamp - targetUpdatedAtRef.current);\n const runway =\n targetIdleMs >= STREAM_IDLE_RELEASE_MS\n ? 0\n : Math.min(\n pendingOffsets.length - 1,\n Math.max(1, Math.ceil((charsPerSecond * STREAM_RUNWAY_MS) / 1000))\n );\n const eligibleGraphemes = pendingOffsets.length - runway;\n\n progressRemainderRef.current += (elapsedMs / 1000) * charsPerSecond;\n let step = Math.floor(progressRemainderRef.current);\n if (current.length === 0 && eligibleGraphemes > 0) step = Math.max(1, step);\n\n const catchupStep =\n pendingOffsets.length > catchupThreshold\n ? Math.min(maxCatchupChars, Math.ceil(pendingOffsets.length / 10))\n : 0;\n step = Math.min(eligibleGraphemes, Math.max(step, catchupStep));\n\n if (step > 0) {\n progressRemainderRef.current = Math.max(0, progressRemainderRef.current - step);\n const next = current + pending.slice(0, pendingOffsets[step - 1]);\n displayedRef.current = next;\n setDisplayedText(next);\n }\n rafRef.current = window.requestAnimationFrame(tick);\n };\n\n if (rafRef.current === null) {\n rafRef.current = window.requestAnimationFrame(tick);\n }\n\n return () => {\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current);\n rafRef.current = null;\n }\n lastFrameAtRef.current = null;\n progressRemainderRef.current = 0;\n };\n }, [cacheAdapter, catchupThreshold, charsPerSecond, id, isStreaming, maxCatchupChars]);\n\n const reduceMotion =\n typeof window !== \"undefined\" &&\n typeof window.matchMedia === \"function\" &&\n window.matchMedia(\"(prefers-reduced-motion: reduce)\").matches;\n\n return {\n displayedText: !isStreaming || reduceMotion ? text : displayedText,\n isAnimating: isStreaming,\n mode: isStreaming ? \"streaming\" : \"static\",\n parseIncompleteMarkdown: isStreaming,\n };\n}\n","export {\n MessageScroller,\n useMessageScroller,\n useMessageScrollerScrollable,\n useMessageScrollerVisibility,\n} from \"@shadcn/react/message-scroller\";\nexport type {\n MessageScrollerDefaultScrollPosition,\n MessageScrollerScrollAlign,\n MessageScrollerScrollable,\n MessageScrollerScrollOptions,\n MessageScrollerVisibilityState,\n} from \"@shadcn/react/message-scroller\";\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,YAAuB;AACvB,8BAIO;AA6DH;AA3DJ,IAAM,KAAK,IAAI,WACb,OAAO,OAAO,OAAO,EAAE,KAAK,GAAG;AAG1B,SAAS,qBAAqB,UAAkE;AACrG,WAAS,QAAQ,SAAS,SAAS,GAAG,SAAS,GAAG,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