@surf-kit/agent 0.1.1 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (74) hide show
  1. package/README.md +19 -1
  2. package/dist/agent-BNSmiexZ.d.cts +44 -0
  3. package/dist/agent-BNSmiexZ.d.ts +44 -0
  4. package/dist/agent-identity/index.cjs +157 -0
  5. package/dist/agent-identity/index.cjs.map +1 -0
  6. package/dist/agent-identity/index.d.cts +35 -0
  7. package/dist/agent-identity/index.d.ts +35 -0
  8. package/dist/agent-identity/index.js +127 -0
  9. package/dist/agent-identity/index.js.map +1 -0
  10. package/dist/chat/index.cjs +1281 -0
  11. package/dist/chat/index.cjs.map +1 -0
  12. package/dist/chat/index.d.cts +72 -0
  13. package/dist/chat/index.d.ts +72 -0
  14. package/dist/chat/index.js +1239 -0
  15. package/dist/chat/index.js.map +1 -0
  16. package/dist/chat--OifhIRe.d.ts +24 -0
  17. package/dist/chat-ChYl2XjV.d.cts +24 -0
  18. package/dist/confidence/index.cjs +253 -0
  19. package/dist/confidence/index.cjs.map +1 -0
  20. package/dist/confidence/index.d.cts +40 -0
  21. package/dist/confidence/index.d.ts +40 -0
  22. package/dist/confidence/index.js +222 -0
  23. package/dist/confidence/index.js.map +1 -0
  24. package/dist/feedback/index.cjs +186 -0
  25. package/dist/feedback/index.cjs.map +1 -0
  26. package/dist/feedback/index.d.cts +27 -0
  27. package/dist/feedback/index.d.ts +27 -0
  28. package/dist/feedback/index.js +157 -0
  29. package/dist/feedback/index.js.map +1 -0
  30. package/dist/{hooks-B8CSeOsn.d.cts → hooks-BGs8-4GK.d.ts} +4 -99
  31. package/dist/{hooks-B8CSeOsn.d.ts → hooks-DLfF18IU.d.cts} +4 -99
  32. package/dist/hooks.d.cts +4 -1
  33. package/dist/hooks.d.ts +4 -1
  34. package/dist/index-BazLnae1.d.cts +67 -0
  35. package/dist/index-BazLnae1.d.ts +67 -0
  36. package/dist/index.cjs +889 -144
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.cts +15 -321
  39. package/dist/index.d.ts +15 -321
  40. package/dist/index.js +879 -142
  41. package/dist/index.js.map +1 -1
  42. package/dist/layouts/index.cjs +1588 -0
  43. package/dist/layouts/index.cjs.map +1 -0
  44. package/dist/layouts/index.d.cts +46 -0
  45. package/dist/layouts/index.d.ts +46 -0
  46. package/dist/layouts/index.js +1548 -0
  47. package/dist/layouts/index.js.map +1 -0
  48. package/dist/mcp/index.cjs +522 -0
  49. package/dist/mcp/index.cjs.map +1 -0
  50. package/dist/mcp/index.d.cts +2 -0
  51. package/dist/mcp/index.d.ts +2 -0
  52. package/dist/mcp/index.js +492 -0
  53. package/dist/mcp/index.js.map +1 -0
  54. package/dist/response/index.cjs +519 -0
  55. package/dist/response/index.cjs.map +1 -0
  56. package/dist/response/index.d.cts +44 -0
  57. package/dist/response/index.d.ts +44 -0
  58. package/dist/response/index.js +478 -0
  59. package/dist/response/index.js.map +1 -0
  60. package/dist/sources/index.cjs +243 -0
  61. package/dist/sources/index.cjs.map +1 -0
  62. package/dist/sources/index.d.cts +44 -0
  63. package/dist/sources/index.d.ts +44 -0
  64. package/dist/sources/index.js +212 -0
  65. package/dist/sources/index.js.map +1 -0
  66. package/dist/streaming/index.cjs +531 -0
  67. package/dist/streaming/index.cjs.map +1 -0
  68. package/dist/streaming/index.d.cts +81 -0
  69. package/dist/streaming/index.d.ts +81 -0
  70. package/dist/streaming/index.js +495 -0
  71. package/dist/streaming/index.js.map +1 -0
  72. package/dist/streaming-DbQxScpi.d.ts +39 -0
  73. package/dist/streaming-DfT22A0z.d.cts +39 -0
  74. package/package.json +62 -17
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/streaming/StreamingMessage/StreamingMessage.tsx","../../src/hooks/useCharacterDrain.ts","../../src/streaming/ThinkingIndicator/ThinkingIndicator.tsx","../../src/streaming/ToolExecution/ToolExecution.tsx","../../src/streaming/RetrievalProgress/RetrievalProgress.tsx","../../src/streaming/VerificationProgress/VerificationProgress.tsx","../../src/streaming/TypewriterText/TypewriterText.tsx","../../src/streaming/TypingIndicator/TypingIndicator.tsx","../../src/streaming/TextGlimmer/TextGlimmer.tsx","../../src/streaming/StreamingList/StreamingList.tsx","../../src/streaming/StreamingStructure/StreamingStructure.tsx"],"sourcesContent":["import React, { useEffect, useRef } from 'react'\nimport { Spinner } from '@surf-kit/core'\nimport type { StreamState } from '../../types/streaming'\nimport { useCharacterDrain } from '../../hooks/useCharacterDrain'\n\ntype StreamingMessageProps = {\n stream: StreamState\n onComplete?: () => void\n showPhases?: boolean\n className?: string\n}\n\nconst phaseLabels: Record<StreamState['phase'], string> = {\n idle: '',\n waiting: 'Waiting...',\n thinking: 'Thinking...',\n retrieving: 'Searching...',\n generating: 'Writing...',\n verifying: 'Verifying...',\n}\n\nfunction StreamingMessage({\n stream,\n onComplete,\n showPhases = true,\n className,\n}: StreamingMessageProps) {\n const onCompleteRef = useRef(onComplete)\n onCompleteRef.current = onComplete\n const wasActiveRef = useRef(stream.active)\n\n useEffect(() => {\n if (wasActiveRef.current && !stream.active) {\n onCompleteRef.current?.()\n }\n wasActiveRef.current = stream.active\n }, [stream.active])\n\n const phaseLabel = phaseLabels[stream.phase]\n const { displayed: displayedContent } = useCharacterDrain(stream.content)\n\n return (\n <div className={className} data-testid=\"streaming-message\">\n {/* Screen reader announcements */}\n <div aria-live=\"assertive\" className=\"sr-only\">\n {stream.active && stream.phase !== 'idle' && 'Response started'}\n {!stream.active && stream.content && 'Response complete'}\n </div>\n\n <div className=\"max-w-[88%] px-4 py-3 rounded-[18px] rounded-tl-[4px] bg-surface border border-border motion-safe:animate-springFromLeft\">\n {showPhases && stream.active && stream.phase !== 'idle' && (\n <div\n className=\"flex items-center gap-2 mb-2 text-sm text-text-secondary\"\n data-testid=\"phase-indicator\"\n >\n <span aria-hidden=\"true\">\n <Spinner size=\"sm\" />\n </span>\n <span>{phaseLabel}</span>\n </div>\n )}\n\n <div className=\"text-sm leading-relaxed text-text-primary whitespace-pre-wrap\">\n {displayedContent}\n {stream.active && (\n <span\n className=\"inline-block w-0.5 h-4 bg-accent align-text-bottom animate-pulse ml-0.5\"\n aria-hidden=\"true\"\n data-testid=\"streaming-cursor\"\n />\n )}\n </div>\n </div>\n </div>\n )\n}\n\nexport { StreamingMessage }\nexport type { StreamingMessageProps }\n","import { useState, useRef, useEffect } from 'react'\n\nexport interface CharacterDrainResult {\n displayed: string\n isDraining: boolean\n}\n\n/**\n * Smoothly drains a growing `target` string character-by-character using\n * `requestAnimationFrame`, decoupling visual rendering from network packet\n * timing so text appears to type out instead of arriving in chunks.\n *\n * When `target` resets to empty (e.g. stream finished), the hook continues\n * draining the previous content to completion before resetting, so the\n * typing animation isn't cut short.\n *\n * Design: the RAF loop is long-lived — it does NOT restart on every delta.\n * The tick function is stored in a ref (updated each render) so the loop\n * always reads the latest drainTarget without being cancelled/restarted.\n * A separate kick-start effect re-fires the loop when it was idle and new\n * content arrives.\n */\nexport function useCharacterDrain(target: string, msPerChar = 15): CharacterDrainResult {\n const [displayed, setDisplayed] = useState('')\n const indexRef = useRef(0)\n const lastTimeRef = useRef(0)\n const rafRef = useRef<number | null>(null)\n // Holds the last non-empty target so we can finish draining after source resets\n const drainTargetRef = useRef('')\n const msPerCharRef = useRef(msPerChar)\n\n msPerCharRef.current = msPerChar\n\n // Update drain target when new content arrives; preserve old value on reset\n if (target !== '') {\n drainTargetRef.current = target\n }\n\n const drainTarget = drainTargetRef.current\n const isDraining = displayed.length < drainTarget.length\n\n // Tick function stored in ref so the long-lived RAF loop always reads the\n // latest drainTarget and msPerChar without being cancelled/recreated.\n // eslint-disable-next-line @typescript-eslint/no-empty-function\n const tickRef = useRef<(now: number) => void>(() => {})\n tickRef.current = (now: number) => {\n const currentTarget = drainTargetRef.current\n if (currentTarget === '') {\n rafRef.current = null\n return\n }\n\n if (lastTimeRef.current === 0) lastTimeRef.current = now\n const elapsed = now - lastTimeRef.current\n const charsToAdvance = Math.floor(elapsed / msPerCharRef.current)\n\n if (charsToAdvance > 0 && indexRef.current < currentTarget.length) {\n const nextIndex = Math.min(indexRef.current + charsToAdvance, currentTarget.length)\n indexRef.current = nextIndex\n lastTimeRef.current = now\n setDisplayed(currentTarget.slice(0, nextIndex))\n }\n\n if (indexRef.current < currentTarget.length) {\n rafRef.current = requestAnimationFrame((t) => tickRef.current(t))\n } else {\n rafRef.current = null\n }\n }\n\n // Kick-start the RAF loop when new content arrives and the loop is idle.\n // No cleanup here — we intentionally do NOT cancel the running loop when\n // drainTarget grows; the long-lived tick will pick up new chars automatically.\n useEffect(() => {\n if (\n drainTargetRef.current !== '' &&\n indexRef.current < drainTargetRef.current.length &&\n rafRef.current === null\n ) {\n rafRef.current = requestAnimationFrame((t) => tickRef.current(t))\n }\n }, [drainTarget]) // drainTarget change = new content; check if loop needs kicking\n\n // Once drain completes and source stream is already done, reset all state\n useEffect(() => {\n if (target === '' && !isDraining && displayed !== '') {\n indexRef.current = 0\n lastTimeRef.current = 0\n drainTargetRef.current = ''\n setDisplayed('')\n }\n }, [target, isDraining, displayed])\n\n // Cancel any pending RAF on unmount\n useEffect(() => {\n return () => {\n if (rafRef.current !== null) {\n cancelAnimationFrame(rafRef.current)\n rafRef.current = null\n }\n }\n }, [])\n\n return { displayed, isDraining }\n}\n","import React from 'react'\nimport { useReducedMotion } from '@surf-kit/hooks'\n\ntype ThinkingIndicatorProps = {\n label?: string\n className?: string\n}\n\nfunction ThinkingIndicator({ label = 'Thinking...', className }: ThinkingIndicatorProps) {\n const reducedMotion = useReducedMotion()\n\n return (\n <span\n role=\"status\"\n className={`inline-flex items-center gap-2 text-sm motion-safe:animate-fadeSlideUpSm ${className ?? ''}`}\n data-testid=\"thinking-indicator\"\n >\n <span className=\"text-text-secondary\">{label}</span>\n {!reducedMotion && (\n <span className=\"flex gap-1\" aria-hidden=\"true\" data-testid=\"animated-dots\">\n <span className=\"w-1.5 h-1.5 rounded-full bg-current animate-bounce [animation-delay:0ms]\" />\n <span className=\"w-1.5 h-1.5 rounded-full bg-current animate-bounce [animation-delay:150ms]\" />\n <span className=\"w-1.5 h-1.5 rounded-full bg-current animate-bounce [animation-delay:300ms]\" />\n </span>\n )}\n </span>\n )\n}\n\nexport { ThinkingIndicator }\nexport type { ThinkingIndicatorProps }\n","import React from 'react'\nimport { Spinner } from '@surf-kit/core'\n\ntype ToolExecutionProps = {\n tool: string\n label?: string\n className?: string\n}\n\nconst defaultLabels: Record<string, string> = {\n search: 'Searching knowledge base...',\n retrieve: 'Retrieving documents...',\n calculate: 'Calculating...',\n}\n\nfunction ToolExecution({ tool, label, className }: ToolExecutionProps) {\n const displayLabel = label ?? defaultLabels[tool] ?? `Running ${tool}...`\n\n return (\n <div\n className={`flex items-center gap-2 text-sm text-text-secondary ${className ?? ''}`}\n role=\"status\"\n data-testid=\"tool-execution\"\n >\n <span aria-hidden=\"true\">\n <Spinner size=\"sm\" />\n </span>\n <span>{displayLabel}</span>\n </div>\n )\n}\n\nexport { ToolExecution }\nexport type { ToolExecutionProps }\n","import React from 'react'\nimport { Spinner } from '@surf-kit/core'\nimport type { Source } from '../../types/agent'\n\ntype RetrievalProgressProps = {\n sources: Source[]\n isActive: boolean\n className?: string\n}\n\nfunction RetrievalProgress({ sources, isActive, className }: RetrievalProgressProps) {\n return (\n <div\n className={`space-y-2 ${className ?? ''}`}\n role=\"status\"\n aria-label={\n isActive\n ? `Retrieving sources, ${sources.length} found so far`\n : `${sources.length} sources found`\n }\n data-testid=\"retrieval-progress\"\n >\n {isActive && (\n <div className=\"flex items-center gap-2 text-sm text-text-secondary\">\n <span aria-hidden=\"true\">\n <Spinner size=\"sm\" />\n </span>\n <span>Retrieving sources...</span>\n </div>\n )}\n\n {sources.length > 0 && (\n <ul className=\"space-y-1\" data-testid=\"source-list\">\n {sources.map((source, index) => (\n <li\n key={source.document_id}\n className=\"text-sm text-text-secondary flex items-center gap-2 animate-in fade-in slide-in-from-left-2\"\n style={{ animationDelay: `${index * 100}ms`, animationFillMode: 'both' }}\n data-testid=\"retrieval-source-item\"\n >\n <span className=\"w-1.5 h-1.5 rounded-full bg-accent flex-shrink-0\" aria-hidden=\"true\" />\n <span className=\"truncate\">{source.title}</span>\n </li>\n ))}\n </ul>\n )}\n </div>\n )\n}\n\nexport { RetrievalProgress }\nexport type { RetrievalProgressProps }\n","import React from 'react'\n\ntype VerificationProgressProps = {\n isActive: boolean\n label?: string\n className?: string\n}\n\nfunction VerificationProgress({\n isActive,\n label = 'Checking accuracy...',\n className,\n}: VerificationProgressProps) {\n if (!isActive) return null\n\n return (\n <div\n className={`flex items-center gap-2 text-sm ${className ?? ''}`}\n role=\"status\"\n data-testid=\"verification-progress\"\n >\n <svg\n className=\"w-4 h-4 animate-spin text-accent\"\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n >\n <circle className=\"opacity-25\" cx=\"12\" cy=\"12\" r=\"10\" stroke=\"currentColor\" strokeWidth=\"4\" />\n <path className=\"opacity-75\" fill=\"currentColor\" d=\"M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4z\" />\n </svg>\n <span className=\"text-accent animate-pulse\">{label}</span>\n </div>\n )\n}\n\nexport { VerificationProgress }\nexport type { VerificationProgressProps }\n","import React, { useEffect, useState } from 'react'\n\nexport type TypewriterTextProps = {\n text: string\n speed?: number // ms per char, default 30\n delay?: number // ms to wait before starting, default 0\n onComplete?: () => void\n className?: string\n showCursor?: boolean // default true\n}\n\nexport function TypewriterText({\n text,\n speed = 30,\n delay = 0,\n onComplete,\n className = '',\n showCursor = true,\n}: TypewriterTextProps) {\n const [displayedText, setDisplayedText] = useState('')\n const [isComplete, setIsComplete] = useState(false)\n\n useEffect(() => {\n setDisplayedText('')\n setIsComplete(false)\n let index = 0\n let interval: ReturnType<typeof setInterval>\n const timeout = setTimeout(() => {\n interval = setInterval(() => {\n if (index < text.length) {\n setDisplayedText(text.slice(0, index + 1))\n index++\n } else {\n clearInterval(interval)\n setIsComplete(true)\n onComplete?.()\n }\n }, speed)\n }, delay)\n return () => {\n clearTimeout(timeout)\n clearInterval(interval)\n }\n }, [text, speed, delay, onComplete])\n\n return (\n <span className={className}>\n {displayedText}\n {showCursor && !isComplete && (\n <span className=\"typewriter-cursor\" aria-hidden=\"true\" />\n )}\n </span>\n )\n}\n","import React from 'react'\nimport { twMerge } from 'tailwind-merge'\nimport { useReducedMotion } from '@surf-kit/hooks'\n\ntype TypingIndicatorProps = {\n label?: string\n dotCount?: number\n className?: string\n}\n\nconst bounceKeyframes = `\n@keyframes typing-bounce {\n 0%, 80%, 100% { transform: translateY(0); }\n 40% { transform: translateY(-6px); }\n}\n`\n\nfunction TypingIndicator({\n label,\n dotCount = 3,\n className,\n}: TypingIndicatorProps) {\n const reducedMotion = useReducedMotion()\n\n return (\n <span\n role=\"status\"\n aria-label={label ?? 'typing'}\n className={twMerge('inline-flex items-center gap-2', className)}\n data-testid=\"typing-indicator\"\n >\n {!reducedMotion && <style>{bounceKeyframes}</style>}\n {label && (\n <span className=\"text-sm text-text-secondary\">{label}</span>\n )}\n <span className=\"flex gap-1\" data-testid=\"typing-dots\">\n {Array.from({ length: dotCount }, (_, i) => (\n <span\n key={i}\n className=\"w-2 h-2 rounded-full bg-text-secondary\"\n style={\n reducedMotion\n ? undefined\n : {\n animation: 'typing-bounce 1.4s infinite ease-in-out',\n animationDelay: `${i * 160}ms`,\n }\n }\n />\n ))}\n </span>\n </span>\n )\n}\n\nexport { TypingIndicator }\nexport type { TypingIndicatorProps }\n","import React from 'react'\nimport { twMerge } from 'tailwind-merge'\nimport { useReducedMotion } from '@surf-kit/hooks'\n\ntype TextGlimmerProps = {\n lines?: number\n className?: string\n}\n\nconst shimmerKeyframes = `\n@keyframes text-shimmer {\n 0% { background-position: 200% 0; }\n 100% { background-position: -200% 0; }\n}\n`\n\nconst widthPattern = ['100%', '90%', '60%']\n\nfunction TextGlimmer({ lines = 3, className }: TextGlimmerProps) {\n const reducedMotion = useReducedMotion()\n\n return (\n <div\n role=\"status\"\n aria-label=\"Loading\"\n className={twMerge('flex flex-col gap-2', className)}\n data-testid=\"text-glimmer\"\n >\n {!reducedMotion && <style>{shimmerKeyframes}</style>}\n {Array.from({ length: lines }, (_, i) => (\n <div\n key={i}\n className=\"h-3 rounded bg-surface-raised\"\n style={{\n width: widthPattern[i % widthPattern.length],\n ...(reducedMotion\n ? undefined\n : {\n backgroundImage:\n 'linear-gradient(90deg, transparent, rgba(255,255,255,0.3), transparent)',\n backgroundSize: '200% 100%',\n animation: 'text-shimmer 1.5s infinite ease-in-out',\n }),\n }}\n data-testid=\"glimmer-line\"\n />\n ))}\n </div>\n )\n}\n\nexport { TextGlimmer }\nexport type { TextGlimmerProps }\n","import React from 'react'\nimport { twMerge } from 'tailwind-merge'\nimport { useReducedMotion } from '@surf-kit/hooks'\nimport { TypingIndicator } from '../TypingIndicator'\n\ntype StreamingListProps<T> = {\n items: T[]\n renderItem: (item: T, index: number) => React.ReactNode\n isStreaming?: boolean\n className?: string\n emptyMessage?: string\n}\n\nconst fadeSlideInKeyframes = `\n@keyframes fadeSlideIn {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n}\n`\n\nfunction StreamingList<T>({\n items,\n renderItem,\n isStreaming = false,\n className,\n emptyMessage,\n}: StreamingListProps<T>) {\n const reducedMotion = useReducedMotion()\n\n if (items.length === 0 && !isStreaming) {\n return emptyMessage ? (\n <p className={twMerge('text-sm text-text-secondary', className)} data-testid=\"streaming-list-empty\">\n {emptyMessage}\n </p>\n ) : null\n }\n\n return (\n <ul\n aria-live=\"polite\"\n className={twMerge('list-none p-0 m-0', className)}\n data-testid=\"streaming-list\"\n >\n {!reducedMotion && <style>{fadeSlideInKeyframes}</style>}\n {items.map((item, index) => (\n <li\n key={index}\n style={\n reducedMotion\n ? undefined\n : { animation: 'fadeSlideIn 0.3s ease-out' }\n }\n data-testid=\"streaming-list-item\"\n >\n {renderItem(item, index)}\n </li>\n ))}\n {isStreaming && (\n <li data-testid=\"streaming-list-loading\">\n <TypingIndicator />\n </li>\n )}\n </ul>\n )\n}\n\nexport { StreamingList }\nexport type { StreamingListProps }\n","import React from 'react'\nimport { twMerge } from 'tailwind-merge'\nimport { useReducedMotion } from '@surf-kit/hooks'\nimport { TextGlimmer } from '../TextGlimmer'\n\ntype StreamingStructureProps = {\n data: Record<string, unknown>\n isStreaming?: boolean\n className?: string\n}\n\nconst fadeSlideInKeyframes = `\n@keyframes fadeSlideIn {\n from { opacity: 0; transform: translateY(8px); }\n to { opacity: 1; transform: translateY(0); }\n}\n`\n\nfunction renderValue(value: unknown, reducedMotion: boolean): React.ReactNode {\n if (value === null) {\n return <span className=\"italic text-text-secondary\">null</span>\n }\n if (value === undefined) {\n return <span className=\"italic text-text-secondary\">undefined</span>\n }\n if (Array.isArray(value)) {\n return (\n <ol className=\"list-decimal pl-4 m-0\">\n {value.map((item, i) => (\n <li key={i} className=\"text-text-secondary text-sm\">\n {renderValue(item, reducedMotion)}\n </li>\n ))}\n </ol>\n )\n }\n if (typeof value === 'object') {\n return renderNestedDl(value as Record<string, unknown>, reducedMotion)\n }\n return String(value)\n}\n\nfunction renderNestedDl(\n data: Record<string, unknown>,\n reducedMotion: boolean,\n): React.ReactNode {\n const entries = Object.entries(data)\n return (\n <dl className=\"pl-4 m-0\" data-testid=\"streaming-structure-nested\">\n {entries.map(([key, value]) => (\n <div\n key={key}\n style={\n reducedMotion\n ? undefined\n : { animation: 'fadeSlideIn 0.3s ease-out' }\n }\n >\n <dt className=\"font-medium text-text-primary text-sm\">{key}</dt>\n <dd className=\"text-text-secondary text-sm ml-0 mb-3\">\n {renderValue(value, reducedMotion)}\n </dd>\n </div>\n ))}\n </dl>\n )\n}\n\nfunction StreamingStructure({\n data,\n isStreaming = false,\n className,\n}: StreamingStructureProps) {\n const reducedMotion = useReducedMotion()\n const entries = Object.entries(data)\n\n return (\n <dl\n aria-live=\"polite\"\n className={twMerge('m-0', className)}\n data-testid=\"streaming-structure\"\n >\n {!reducedMotion && <style>{fadeSlideInKeyframes}</style>}\n {entries.map(([key, value]) => (\n <div\n key={key}\n style={\n reducedMotion\n ? undefined\n : { animation: 'fadeSlideIn 0.3s ease-out' }\n }\n data-testid=\"streaming-structure-entry\"\n >\n <dt className=\"font-medium text-text-primary text-sm\">{key}</dt>\n <dd className=\"text-text-secondary text-sm ml-0 mb-3\">\n {renderValue(value, reducedMotion)}\n </dd>\n </div>\n ))}\n {isStreaming && (\n <div data-testid=\"streaming-structure-loading\">\n <TextGlimmer lines={1} />\n </div>\n )}\n </dl>\n )\n}\n\nexport { StreamingStructure }\nexport type { StreamingStructureProps }\n"],"mappings":";AAAA,SAAgB,aAAAA,YAAW,UAAAC,eAAc;AACzC,SAAS,eAAe;;;ACDxB,SAAS,UAAU,QAAQ,iBAAiB;AAsBrC,SAAS,kBAAkB,QAAgB,YAAY,IAA0B;AACtF,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,EAAE;AAC7C,QAAM,WAAW,OAAO,CAAC;AACzB,QAAM,cAAc,OAAO,CAAC;AAC5B,QAAM,SAAS,OAAsB,IAAI;AAEzC,QAAM,iBAAiB,OAAO,EAAE;AAChC,QAAM,eAAe,OAAO,SAAS;AAErC,eAAa,UAAU;AAGvB,MAAI,WAAW,IAAI;AACjB,mBAAe,UAAU;AAAA,EAC3B;AAEA,QAAM,cAAc,eAAe;AACnC,QAAM,aAAa,UAAU,SAAS,YAAY;AAKlD,QAAM,UAAU,OAA8B,MAAM;AAAA,EAAC,CAAC;AACtD,UAAQ,UAAU,CAAC,QAAgB;AACjC,UAAM,gBAAgB,eAAe;AACrC,QAAI,kBAAkB,IAAI;AACxB,aAAO,UAAU;AACjB;AAAA,IACF;AAEA,QAAI,YAAY,YAAY,EAAG,aAAY,UAAU;AACrD,UAAM,UAAU,MAAM,YAAY;AAClC,UAAM,iBAAiB,KAAK,MAAM,UAAU,aAAa,OAAO;AAEhE,QAAI,iBAAiB,KAAK,SAAS,UAAU,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IAAI,CAAC,CAAC,KAAK,KAAK,MACvB,gBAAAD;AAAA,UAAC;AAAA;AAAA,YAEC,OACE,gBACI,SACA,EAAE,WAAW,4BAA4B;AAAA,YAE/C,eAAY;AAAA,YAEZ;AAAA,8BAAAD,MAAC,QAAG,WAAU,yCAAyC,eAAI;AAAA,cAC3D,gBAAAA,MAAC,QAAG,WAAU,yCACX,sBAAY,OAAO,aAAa,GACnC;AAAA;AAAA;AAAA,UAXK;AAAA,QAYP,CACD;AAAA,QACA,eACC,gBAAAA,MAAC,SAAI,eAAY,+BACf,0BAAAA,MAAC,eAAY,OAAO,GAAG,GACzB;AAAA;AAAA;AAAA,EAEJ;AAEJ;","names":["useEffect","useRef","useRef","useEffect","jsx","jsxs","Spinner","jsx","jsxs","Spinner","jsx","jsxs","jsx","jsxs","useEffect","useState","jsx","jsxs","useReducedMotion","jsx","jsxs","twMerge","useReducedMotion","jsx","jsxs","twMerge","useReducedMotion","jsx","jsxs","useReducedMotion","twMerge","twMerge","useReducedMotion","jsx","jsxs","fadeSlideInKeyframes","useReducedMotion","twMerge"]}
@@ -0,0 +1,39 @@
1
+ import { S as Source, V as VerificationResult, C as ConfidenceBreakdown, a as AgentResponse } from './agent-BNSmiexZ.js';
2
+ import { C as ChatError } from './chat--OifhIRe.js';
3
+
4
+ type StreamEvent = {
5
+ type: 'phase';
6
+ phase: 'thinking' | 'retrieving' | 'generating' | 'verifying' | 'waiting';
7
+ } | {
8
+ type: 'delta';
9
+ content: string;
10
+ } | {
11
+ type: 'source';
12
+ source: Source;
13
+ } | {
14
+ type: 'agent';
15
+ agent: string;
16
+ } | {
17
+ type: 'verification';
18
+ result: VerificationResult;
19
+ } | {
20
+ type: 'confidence';
21
+ breakdown: ConfidenceBreakdown;
22
+ } | {
23
+ type: 'done';
24
+ response: AgentResponse;
25
+ conversation_id?: string;
26
+ } | {
27
+ type: 'error';
28
+ error: ChatError;
29
+ };
30
+ interface StreamState {
31
+ active: boolean;
32
+ phase: 'idle' | 'thinking' | 'retrieving' | 'generating' | 'verifying' | 'waiting';
33
+ content: string;
34
+ sources: Source[];
35
+ agent: string | null;
36
+ agentLabel: string | null;
37
+ }
38
+
39
+ export type { StreamEvent as S, StreamState as a };
@@ -0,0 +1,39 @@
1
+ import { S as Source, V as VerificationResult, C as ConfidenceBreakdown, a as AgentResponse } from './agent-BNSmiexZ.cjs';
2
+ import { C as ChatError } from './chat-ChYl2XjV.cjs';
3
+
4
+ type StreamEvent = {
5
+ type: 'phase';
6
+ phase: 'thinking' | 'retrieving' | 'generating' | 'verifying' | 'waiting';
7
+ } | {
8
+ type: 'delta';
9
+ content: string;
10
+ } | {
11
+ type: 'source';
12
+ source: Source;
13
+ } | {
14
+ type: 'agent';
15
+ agent: string;
16
+ } | {
17
+ type: 'verification';
18
+ result: VerificationResult;
19
+ } | {
20
+ type: 'confidence';
21
+ breakdown: ConfidenceBreakdown;
22
+ } | {
23
+ type: 'done';
24
+ response: AgentResponse;
25
+ conversation_id?: string;
26
+ } | {
27
+ type: 'error';
28
+ error: ChatError;
29
+ };
30
+ interface StreamState {
31
+ active: boolean;
32
+ phase: 'idle' | 'thinking' | 'retrieving' | 'generating' | 'verifying' | 'waiting';
33
+ content: string;
34
+ sources: Source[];
35
+ agent: string | null;
36
+ agentLabel: string | null;
37
+ }
38
+
39
+ export type { StreamEvent as S, StreamState as a };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surf-kit/agent",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "AI agent interface components — chat, streaming, confidence, source attribution",
5
5
  "keywords": [
6
6
  "react",
@@ -40,38 +40,83 @@
40
40
  "types": "./dist/hooks.d.ts",
41
41
  "import": "./dist/hooks.js",
42
42
  "require": "./dist/hooks.cjs"
43
+ },
44
+ "./chat": {
45
+ "types": "./dist/chat/index.d.ts",
46
+ "import": "./dist/chat/index.js",
47
+ "require": "./dist/chat/index.cjs"
48
+ },
49
+ "./response": {
50
+ "types": "./dist/response/index.d.ts",
51
+ "import": "./dist/response/index.js",
52
+ "require": "./dist/response/index.cjs"
53
+ },
54
+ "./sources": {
55
+ "types": "./dist/sources/index.d.ts",
56
+ "import": "./dist/sources/index.js",
57
+ "require": "./dist/sources/index.cjs"
58
+ },
59
+ "./confidence": {
60
+ "types": "./dist/confidence/index.d.ts",
61
+ "import": "./dist/confidence/index.js",
62
+ "require": "./dist/confidence/index.cjs"
63
+ },
64
+ "./agent-identity": {
65
+ "types": "./dist/agent-identity/index.d.ts",
66
+ "import": "./dist/agent-identity/index.js",
67
+ "require": "./dist/agent-identity/index.cjs"
68
+ },
69
+ "./streaming": {
70
+ "types": "./dist/streaming/index.d.ts",
71
+ "import": "./dist/streaming/index.js",
72
+ "require": "./dist/streaming/index.cjs"
73
+ },
74
+ "./layouts": {
75
+ "types": "./dist/layouts/index.d.ts",
76
+ "import": "./dist/layouts/index.js",
77
+ "require": "./dist/layouts/index.cjs"
78
+ },
79
+ "./feedback": {
80
+ "types": "./dist/feedback/index.d.ts",
81
+ "import": "./dist/feedback/index.js",
82
+ "require": "./dist/feedback/index.cjs"
83
+ },
84
+ "./mcp": {
85
+ "types": "./dist/mcp/index.d.ts",
86
+ "import": "./dist/mcp/index.js",
87
+ "require": "./dist/mcp/index.cjs"
43
88
  }
44
89
  },
45
90
  "dependencies": {
46
91
  "class-variance-authority": "^0.7.0",
47
92
  "react-markdown": "^10.1.0",
48
93
  "rehype-sanitize": "^6.0.0",
94
+ "react-aria": "^3.46.0",
49
95
  "tailwind-merge": "^2.0.0",
50
- "@surf-kit/core": "0.1.1",
96
+ "@surf-kit/core": "0.1.2",
51
97
  "@surf-kit/hooks": "0.1.1",
52
98
  "@surf-kit/icons": "0.1.1",
53
- "@surf-kit/theme": "0.1.1"
99
+ "@surf-kit/theme": "0.1.2"
54
100
  },
55
101
  "devDependencies": {
56
- "@testing-library/jest-dom": "^6.0.0",
57
- "@testing-library/react": "^16.0.0",
58
- "@testing-library/user-event": "^14.0.0",
59
- "@types/react": "^18.3.0",
60
- "@types/react-dom": "^18.3.0",
61
- "jsdom": "^25.0.0",
62
- "react": "^18.3.0",
63
- "react-aria": "^3.35.0",
64
- "react-dom": "^18.3.0",
102
+ "@testing-library/jest-dom": "^6.9.0",
103
+ "@testing-library/react": "^16.3.0",
104
+ "@testing-library/user-event": "^14.6.0",
105
+ "@types/react": "^19.2.0",
106
+ "@types/react-dom": "^19.2.0",
107
+ "jsdom": "^28.1.0",
108
+ "react": "^19.2.0",
109
+ "react-dom": "^19.2.0",
65
110
  "tsup": "^8.0.0",
66
- "typescript": "^5.5.0",
67
- "vitest": "^2.0.0",
111
+ "typescript": "^5.9.0",
112
+ "vitest": "^4.0.0",
68
113
  "vitest-axe": "^0.1.0",
69
- "@surf-kit/test-utils": "0.1.1",
114
+ "@surf-kit/test-utils": "0.1.2",
70
115
  "@surf-kit/tsconfig": "0.1.0"
71
116
  },
72
117
  "peerDependencies": {
73
- "react": ">=18",
74
- "react-dom": ">=18"
118
+ "react": ">=19",
119
+ "react-dom": ">=19"
75
120
  },
76
121
  "publishConfig": {
77
122
  "access": "public"