@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,243 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/sources/index.ts
21
+ var sources_exports = {};
22
+ __export(sources_exports, {
23
+ SourceBadge: () => SourceBadge,
24
+ SourceCard: () => SourceCard,
25
+ SourceDrawer: () => SourceDrawer,
26
+ SourceInline: () => SourceInline,
27
+ SourceList: () => SourceList
28
+ });
29
+ module.exports = __toCommonJS(sources_exports);
30
+
31
+ // src/sources/SourceCard/SourceCard.tsx
32
+ var import_core = require("@surf-kit/core");
33
+ var import_tailwind_merge = require("tailwind-merge");
34
+ var import_jsx_runtime = require("react/jsx-runtime");
35
+ function getConfidenceIntent(confidence) {
36
+ if (confidence >= 0.8) return "success";
37
+ if (confidence >= 0.5) return "warning";
38
+ return "error";
39
+ }
40
+ function getConfidenceLabel(confidence) {
41
+ if (confidence >= 0.8) return "High";
42
+ if (confidence >= 0.5) return "Medium";
43
+ return "Low";
44
+ }
45
+ function SourceCard({ source, variant = "compact", onNavigate, className }) {
46
+ const handleClick = () => {
47
+ if (onNavigate) {
48
+ onNavigate(source);
49
+ }
50
+ };
51
+ const isCompact = variant === "compact";
52
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
53
+ "div",
54
+ {
55
+ className: (0, import_tailwind_merge.twMerge)(
56
+ "rounded-xl border transition-all duration-200",
57
+ "bg-surface border-border",
58
+ onNavigate && "cursor-pointer hover:border-border-strong",
59
+ className
60
+ ),
61
+ "data-document-id": source.document_id,
62
+ "data-testid": "source-card",
63
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
64
+ "div",
65
+ {
66
+ className: isCompact ? "px-4 py-3" : "px-6 py-4",
67
+ onClick: handleClick,
68
+ role: onNavigate ? "button" : void 0,
69
+ tabIndex: onNavigate ? 0 : void 0,
70
+ onKeyDown: onNavigate ? (e) => {
71
+ if (e.key === "Enter" || e.key === " ") {
72
+ e.preventDefault();
73
+ handleClick();
74
+ }
75
+ } : void 0,
76
+ children: [
77
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-start justify-between gap-2", children: [
78
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex-1 min-w-0", children: [
79
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm font-medium text-text-primary truncate", children: source.title }),
80
+ source.section && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-[11px] font-semibold uppercase tracking-wider text-text-secondary truncate mt-0.5", children: source.section })
81
+ ] }),
82
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
83
+ import_core.Badge,
84
+ {
85
+ intent: getConfidenceIntent(source.confidence),
86
+ size: "sm",
87
+ children: getConfidenceLabel(source.confidence)
88
+ }
89
+ )
90
+ ] }),
91
+ !isCompact && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-text-secondary mt-2 line-clamp-3 leading-relaxed", children: source.snippet })
92
+ ]
93
+ }
94
+ )
95
+ }
96
+ );
97
+ }
98
+
99
+ // src/sources/SourceList/SourceList.tsx
100
+ var import_react = require("react");
101
+ var import_jsx_runtime2 = require("react/jsx-runtime");
102
+ function SourceList({
103
+ sources,
104
+ variant = "compact",
105
+ collapsible = false,
106
+ defaultExpanded = true,
107
+ onNavigate,
108
+ className
109
+ }) {
110
+ const [isExpanded, setIsExpanded] = (0, import_react.useState)(defaultExpanded);
111
+ if (sources.length === 0) return null;
112
+ const content = /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className: "flex flex-col gap-1.5", "data-testid": "source-list-items", children: sources.map((source) => /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
113
+ SourceCard,
114
+ {
115
+ source,
116
+ variant,
117
+ onNavigate
118
+ },
119
+ source.document_id
120
+ )) });
121
+ if (!collapsible) {
122
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("div", { className, "data-testid": "source-list", children: content });
123
+ }
124
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)("div", { className, "data-testid": "source-list", children: [
125
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
126
+ "button",
127
+ {
128
+ type: "button",
129
+ onClick: () => setIsExpanded((prev) => !prev),
130
+ "aria-expanded": isExpanded,
131
+ className: "flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-text-secondary hover:text-accent mb-2 transition-colors duration-200",
132
+ children: [
133
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
134
+ "svg",
135
+ {
136
+ className: `w-4 h-4 transition-transform ${isExpanded ? "rotate-180" : ""}`,
137
+ fill: "none",
138
+ viewBox: "0 0 24 24",
139
+ stroke: "currentColor",
140
+ strokeWidth: 2,
141
+ children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
142
+ }
143
+ ),
144
+ "Sources (",
145
+ sources.length,
146
+ ")"
147
+ ]
148
+ }
149
+ ),
150
+ isExpanded && content
151
+ ] });
152
+ }
153
+
154
+ // src/sources/SourceInline/SourceInline.tsx
155
+ var import_core2 = require("@surf-kit/core");
156
+ var import_jsx_runtime3 = require("react/jsx-runtime");
157
+ function SourceInline({ source, index, className }) {
158
+ const tooltipContent = `${source.title}${source.section ? ` - ${source.section}` : ""}: ${source.snippet.slice(0, 120)}${source.snippet.length > 120 ? "..." : ""}`;
159
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core2.Tooltip, { content: tooltipContent, placement: "top", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
160
+ "span",
161
+ {
162
+ className: `inline-flex items-center justify-center text-xs text-accent font-medium cursor-help ${className ?? ""}`,
163
+ "data-testid": "source-inline",
164
+ "data-document-id": source.document_id,
165
+ "aria-label": `Source ${index}: ${source.title}`,
166
+ children: [
167
+ "[",
168
+ index,
169
+ "]"
170
+ ]
171
+ }
172
+ ) });
173
+ }
174
+
175
+ // src/sources/SourceDrawer/SourceDrawer.tsx
176
+ var import_core3 = require("@surf-kit/core");
177
+ var import_jsx_runtime4 = require("react/jsx-runtime");
178
+ function getConfidenceIntent2(confidence) {
179
+ if (confidence >= 0.8) return "success";
180
+ if (confidence >= 0.5) return "warning";
181
+ return "error";
182
+ }
183
+ function SourceDrawer({ source, isOpen, onClose, className }) {
184
+ if (!source) return null;
185
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
186
+ import_core3.Sheet,
187
+ {
188
+ isOpen,
189
+ onClose,
190
+ title: source.title,
191
+ size: "md",
192
+ className,
193
+ children: /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { "data-testid": "source-drawer", "data-document-id": source.document_id, children: [
194
+ source.section && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-sm text-text-secondary mb-4", children: source.section }),
195
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex items-center gap-2 mb-4", children: [
196
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "text-sm text-text-secondary", children: "Confidence:" }),
197
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_core3.Badge, { intent: getConfidenceIntent2(source.confidence), size: "sm", children: [
198
+ Math.round(source.confidence * 100),
199
+ "%"
200
+ ] })
201
+ ] }),
202
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "mb-4", children: [
203
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { className: "text-sm font-medium text-text-primary mb-2", children: "Snippet" }),
204
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "text-sm text-text-secondary bg-surface-raised p-4 rounded-lg", children: source.snippet })
205
+ ] }),
206
+ source.url && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { children: [
207
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("h3", { className: "text-sm font-medium text-text-primary mb-2", children: "Source URL" }),
208
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
209
+ "a",
210
+ {
211
+ href: source.url,
212
+ target: "_blank",
213
+ rel: "noopener noreferrer",
214
+ className: "text-sm text-accent hover:underline break-all",
215
+ children: source.url
216
+ }
217
+ )
218
+ ] })
219
+ ] })
220
+ }
221
+ );
222
+ }
223
+
224
+ // src/sources/SourceBadge/SourceBadge.tsx
225
+ var import_core4 = require("@surf-kit/core");
226
+ var import_jsx_runtime5 = require("react/jsx-runtime");
227
+ function SourceBadge({ count, className }) {
228
+ if (count === 0) return null;
229
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_core4.Badge, { intent: "info", size: "sm", className, "data-testid": "source-badge", children: [
230
+ count,
231
+ " ",
232
+ count === 1 ? "source" : "sources"
233
+ ] });
234
+ }
235
+ // Annotate the CommonJS export names for ESM import in node:
236
+ 0 && (module.exports = {
237
+ SourceBadge,
238
+ SourceCard,
239
+ SourceDrawer,
240
+ SourceInline,
241
+ SourceList
242
+ });
243
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/sources/index.ts","../../src/sources/SourceCard/SourceCard.tsx","../../src/sources/SourceList/SourceList.tsx","../../src/sources/SourceInline/SourceInline.tsx","../../src/sources/SourceDrawer/SourceDrawer.tsx","../../src/sources/SourceBadge/SourceBadge.tsx"],"sourcesContent":["export { SourceCard } from './SourceCard'\nexport type { SourceCardProps } from './SourceCard'\n\nexport { SourceList } from './SourceList'\nexport type { SourceListProps } from './SourceList'\n\nexport { SourceInline } from './SourceInline'\nexport type { SourceInlineProps } from './SourceInline'\n\nexport { SourceDrawer } from './SourceDrawer'\nexport type { SourceDrawerProps } from './SourceDrawer'\n\nexport { SourceBadge } from './SourceBadge'\nexport type { SourceBadgeProps } from './SourceBadge'\n","import React from 'react'\nimport { Badge } from '@surf-kit/core'\nimport { twMerge } from 'tailwind-merge'\nimport type { Source } from '../../types/agent'\n\ntype SourceCardProps = {\n source: Source\n variant?: 'compact' | 'expanded'\n onNavigate?: (source: Source) => void\n className?: string\n}\n\nfunction getConfidenceIntent(confidence: number) {\n if (confidence >= 0.8) return 'success' as const\n if (confidence >= 0.5) return 'warning' as const\n return 'error' as const\n}\n\nfunction getConfidenceLabel(confidence: number) {\n if (confidence >= 0.8) return 'High'\n if (confidence >= 0.5) return 'Medium'\n return 'Low'\n}\n\nfunction SourceCard({ source, variant = 'compact', onNavigate, className }: SourceCardProps) {\n const handleClick = () => {\n if (onNavigate) {\n onNavigate(source)\n }\n }\n\n const isCompact = variant === 'compact'\n\n return (\n <div\n className={twMerge(\n 'rounded-xl border transition-all duration-200',\n 'bg-surface border-border',\n onNavigate && 'cursor-pointer hover:border-border-strong',\n className,\n )}\n data-document-id={source.document_id}\n data-testid=\"source-card\"\n >\n <div\n className={isCompact ? 'px-4 py-3' : 'px-6 py-4'}\n onClick={handleClick}\n role={onNavigate ? 'button' : undefined}\n tabIndex={onNavigate ? 0 : undefined}\n onKeyDown={\n onNavigate\n ? (e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n handleClick()\n }\n }\n : undefined\n }\n >\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"flex-1 min-w-0\">\n <p className=\"text-sm font-medium text-text-primary truncate\">\n {source.title}\n </p>\n {source.section && (\n <p className=\"text-[11px] font-semibold uppercase tracking-wider text-text-secondary truncate mt-0.5\">\n {source.section}\n </p>\n )}\n </div>\n <Badge\n intent={getConfidenceIntent(source.confidence)}\n size=\"sm\"\n >\n {getConfidenceLabel(source.confidence)}\n </Badge>\n </div>\n {!isCompact && (\n <p className=\"text-xs text-text-secondary mt-2 line-clamp-3 leading-relaxed\">\n {source.snippet}\n </p>\n )}\n </div>\n </div>\n )\n}\n\nexport { SourceCard }\nexport type { SourceCardProps }\n","import React, { useState } from 'react'\nimport type { Source } from '../../types/agent'\nimport { SourceCard } from '../SourceCard'\n\ntype SourceListProps = {\n sources: Source[]\n variant?: 'compact' | 'expanded'\n collapsible?: boolean\n defaultExpanded?: boolean\n onNavigate?: (source: Source) => void\n className?: string\n}\n\nfunction SourceList({\n sources,\n variant = 'compact',\n collapsible = false,\n defaultExpanded = true,\n onNavigate,\n className,\n}: SourceListProps) {\n const [isExpanded, setIsExpanded] = useState(defaultExpanded)\n\n if (sources.length === 0) return null\n\n const content = (\n <div className=\"flex flex-col gap-1.5\" data-testid=\"source-list-items\">\n {sources.map((source) => (\n <SourceCard\n key={source.document_id}\n source={source}\n variant={variant}\n onNavigate={onNavigate}\n />\n ))}\n </div>\n )\n\n if (!collapsible) {\n return (\n <div className={className} data-testid=\"source-list\">\n {content}\n </div>\n )\n }\n\n return (\n <div className={className} data-testid=\"source-list\">\n <button\n type=\"button\"\n onClick={() => setIsExpanded(prev => !prev)}\n aria-expanded={isExpanded}\n className=\"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-text-secondary hover:text-accent mb-2 transition-colors duration-200\"\n >\n <svg\n className={`w-4 h-4 transition-transform ${isExpanded ? 'rotate-180' : ''}`}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M19 9l-7 7-7-7\" />\n </svg>\n Sources ({sources.length})\n </button>\n {isExpanded && content}\n </div>\n )\n}\n\nexport { SourceList }\nexport type { SourceListProps }\n","import React from 'react'\nimport { Tooltip } from '@surf-kit/core'\n\nimport type { Source } from '../../types/agent'\n\ntype SourceInlineProps = {\n source: Source\n index: number\n className?: string\n}\n\nfunction SourceInline({ source, index, className }: SourceInlineProps) {\n const tooltipContent = `${source.title}${source.section ? ` - ${source.section}` : ''}: ${source.snippet.slice(0, 120)}${source.snippet.length > 120 ? '...' : ''}`\n\n return (\n <Tooltip content={tooltipContent} placement=\"top\">\n <span\n className={`inline-flex items-center justify-center text-xs text-accent font-medium cursor-help ${className ?? ''}`}\n data-testid=\"source-inline\"\n data-document-id={source.document_id}\n aria-label={`Source ${index}: ${source.title}`}\n >\n [{index}]\n </span>\n </Tooltip>\n )\n}\n\nexport { SourceInline }\nexport type { SourceInlineProps }\n","import React from 'react'\nimport { Sheet, Badge } from '@surf-kit/core'\nimport type { Source } from '../../types/agent'\n\ntype SourceDrawerProps = {\n source: Source | null\n isOpen: boolean\n onClose: () => void\n className?: string\n}\n\nfunction getConfidenceIntent(confidence: number) {\n if (confidence >= 0.8) return 'success' as const\n if (confidence >= 0.5) return 'warning' as const\n return 'error' as const\n}\n\nfunction SourceDrawer({ source, isOpen, onClose, className }: SourceDrawerProps) {\n if (!source) return null\n\n return (\n <Sheet\n isOpen={isOpen}\n onClose={onClose}\n title={source.title}\n size=\"md\"\n className={className}\n >\n <div data-testid=\"source-drawer\" data-document-id={source.document_id}>\n {source.section && (\n <p className=\"text-sm text-text-secondary mb-4\">{source.section}</p>\n )}\n\n <div className=\"flex items-center gap-2 mb-4\">\n <span className=\"text-sm text-text-secondary\">Confidence:</span>\n <Badge intent={getConfidenceIntent(source.confidence)} size=\"sm\">\n {Math.round(source.confidence * 100)}%\n </Badge>\n </div>\n\n <div className=\"mb-4\">\n <h3 className=\"text-sm font-medium text-text-primary mb-2\">Snippet</h3>\n <p className=\"text-sm text-text-secondary bg-surface-raised p-4 rounded-lg\">\n {source.snippet}\n </p>\n </div>\n\n {source.url && (\n <div>\n <h3 className=\"text-sm font-medium text-text-primary mb-2\">Source URL</h3>\n <a\n href={source.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"text-sm text-accent hover:underline break-all\"\n >\n {source.url}\n </a>\n </div>\n )}\n </div>\n </Sheet>\n )\n}\n\nexport { SourceDrawer }\nexport type { SourceDrawerProps }\n","import React from 'react'\nimport { Badge } from '@surf-kit/core'\n\ntype SourceBadgeProps = {\n count: number\n className?: string\n}\n\nfunction SourceBadge({ count, className }: SourceBadgeProps) {\n if (count === 0) return null\n\n return (\n <Badge intent=\"info\" size=\"sm\" className={className} data-testid=\"source-badge\">\n {count} {count === 1 ? 'source' : 'sources'}\n </Badge>\n )\n}\n\nexport { SourceBadge }\nexport type { SourceBadgeProps }\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,kBAAsB;AACtB,4BAAwB;AA2Dd;AAjDV,SAAS,oBAAoB,YAAoB;AAC/C,MAAI,cAAc,IAAK,QAAO;AAC9B,MAAI,cAAc,IAAK,QAAO;AAC9B,SAAO;AACT;AAEA,SAAS,mBAAmB,YAAoB;AAC9C,MAAI,cAAc,IAAK,QAAO;AAC9B,MAAI,cAAc,IAAK,QAAO;AAC9B,SAAO;AACT;AAEA,SAAS,WAAW,EAAE,QAAQ,UAAU,WAAW,YAAY,UAAU,GAAoB;AAC3F,QAAM,cAAc,MAAM;AACxB,QAAI,YAAY;AACd,iBAAW,MAAM;AAAA,IACnB;AAAA,EACF;AAEA,QAAM,YAAY,YAAY;AAE9B,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA,cAAc;AAAA,QACd;AAAA,MACF;AAAA,MACA,oBAAkB,OAAO;AAAA,MACzB,eAAY;AAAA,MAEZ;AAAA,QAAC;AAAA;AAAA,UACC,WAAW,YAAY,cAAc;AAAA,UACrC,SAAS;AAAA,UACT,MAAM,aAAa,WAAW;AAAA,UAC9B,UAAU,aAAa,IAAI;AAAA,UAC3B,WACE,aACI,CAAC,MAA2B;AAC1B,gBAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,KAAK;AACtC,gBAAE,eAAe;AACjB,0BAAY;AAAA,YACd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AAO,WACN,6CAAC,OAAE,WAAU,oCAAoC,iBAAO,SAAQ;AAAA,QAGlE,8CAAC,SAAI,WAAU,gCACb;AAAA,uDAAC,UAAK,WAAU,+BAA8B,yBAAW;AAAA,UACzD,8CAAC,sBAAM,QAAQA,qBAAoB,OAAO,UAAU,GAAG,MAAK,MACzD;AAAA,iBAAK,MAAM,OAAO,aAAa,GAAG;AAAA,YAAE;AAAA,aACvC;AAAA,WACF;AAAA,QAEA,8CAAC,SAAI,WAAU,QACb;AAAA,uDAAC,QAAG,WAAU,8CAA6C,qBAAO;AAAA,UAClE,6CAAC,OAAE,WAAU,gEACV,iBAAO,SACV;AAAA,WACF;AAAA,QAEC,OAAO,OACN,8CAAC,SACC;AAAA,uDAAC,QAAG,WAAU,8CAA6C,wBAAU;AAAA,UACrE;AAAA,YAAC;AAAA;AAAA,cACC,MAAM,OAAO;AAAA,cACb,QAAO;AAAA,cACP,KAAI;AAAA,cACJ,WAAU;AAAA,cAET,iBAAO;AAAA;AAAA,UACV;AAAA,WACF;AAAA,SAEJ;AAAA;AAAA,EACF;AAEJ;;;AC9DA,IAAAC,eAAsB;AAWlB,IAAAC,sBAAA;AAJJ,SAAS,YAAY,EAAE,OAAO,UAAU,GAAqB;AAC3D,MAAI,UAAU,EAAG,QAAO;AAExB,SACE,8CAAC,sBAAM,QAAO,QAAO,MAAK,MAAK,WAAsB,eAAY,gBAC9D;AAAA;AAAA,IAAM;AAAA,IAAE,UAAU,IAAI,WAAW;AAAA,KACpC;AAEJ;","names":["import_jsx_runtime","import_core","import_jsx_runtime","import_core","import_jsx_runtime","getConfidenceIntent","import_core","import_jsx_runtime"]}
@@ -0,0 +1,44 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { S as Source } from '../agent-BNSmiexZ.cjs';
3
+ import 'react';
4
+
5
+ type SourceCardProps = {
6
+ source: Source;
7
+ variant?: 'compact' | 'expanded';
8
+ onNavigate?: (source: Source) => void;
9
+ className?: string;
10
+ };
11
+ declare function SourceCard({ source, variant, onNavigate, className }: SourceCardProps): react_jsx_runtime.JSX.Element;
12
+
13
+ type SourceListProps = {
14
+ sources: Source[];
15
+ variant?: 'compact' | 'expanded';
16
+ collapsible?: boolean;
17
+ defaultExpanded?: boolean;
18
+ onNavigate?: (source: Source) => void;
19
+ className?: string;
20
+ };
21
+ declare function SourceList({ sources, variant, collapsible, defaultExpanded, onNavigate, className, }: SourceListProps): react_jsx_runtime.JSX.Element | null;
22
+
23
+ type SourceInlineProps = {
24
+ source: Source;
25
+ index: number;
26
+ className?: string;
27
+ };
28
+ declare function SourceInline({ source, index, className }: SourceInlineProps): react_jsx_runtime.JSX.Element;
29
+
30
+ type SourceDrawerProps = {
31
+ source: Source | null;
32
+ isOpen: boolean;
33
+ onClose: () => void;
34
+ className?: string;
35
+ };
36
+ declare function SourceDrawer({ source, isOpen, onClose, className }: SourceDrawerProps): react_jsx_runtime.JSX.Element | null;
37
+
38
+ type SourceBadgeProps = {
39
+ count: number;
40
+ className?: string;
41
+ };
42
+ declare function SourceBadge({ count, className }: SourceBadgeProps): react_jsx_runtime.JSX.Element | null;
43
+
44
+ export { SourceBadge, type SourceBadgeProps, SourceCard, type SourceCardProps, SourceDrawer, type SourceDrawerProps, SourceInline, type SourceInlineProps, SourceList, type SourceListProps };
@@ -0,0 +1,44 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { S as Source } from '../agent-BNSmiexZ.js';
3
+ import 'react';
4
+
5
+ type SourceCardProps = {
6
+ source: Source;
7
+ variant?: 'compact' | 'expanded';
8
+ onNavigate?: (source: Source) => void;
9
+ className?: string;
10
+ };
11
+ declare function SourceCard({ source, variant, onNavigate, className }: SourceCardProps): react_jsx_runtime.JSX.Element;
12
+
13
+ type SourceListProps = {
14
+ sources: Source[];
15
+ variant?: 'compact' | 'expanded';
16
+ collapsible?: boolean;
17
+ defaultExpanded?: boolean;
18
+ onNavigate?: (source: Source) => void;
19
+ className?: string;
20
+ };
21
+ declare function SourceList({ sources, variant, collapsible, defaultExpanded, onNavigate, className, }: SourceListProps): react_jsx_runtime.JSX.Element | null;
22
+
23
+ type SourceInlineProps = {
24
+ source: Source;
25
+ index: number;
26
+ className?: string;
27
+ };
28
+ declare function SourceInline({ source, index, className }: SourceInlineProps): react_jsx_runtime.JSX.Element;
29
+
30
+ type SourceDrawerProps = {
31
+ source: Source | null;
32
+ isOpen: boolean;
33
+ onClose: () => void;
34
+ className?: string;
35
+ };
36
+ declare function SourceDrawer({ source, isOpen, onClose, className }: SourceDrawerProps): react_jsx_runtime.JSX.Element | null;
37
+
38
+ type SourceBadgeProps = {
39
+ count: number;
40
+ className?: string;
41
+ };
42
+ declare function SourceBadge({ count, className }: SourceBadgeProps): react_jsx_runtime.JSX.Element | null;
43
+
44
+ export { SourceBadge, type SourceBadgeProps, SourceCard, type SourceCardProps, SourceDrawer, type SourceDrawerProps, SourceInline, type SourceInlineProps, SourceList, type SourceListProps };
@@ -0,0 +1,212 @@
1
+ // src/sources/SourceCard/SourceCard.tsx
2
+ import { Badge } from "@surf-kit/core";
3
+ import { twMerge } from "tailwind-merge";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ function getConfidenceIntent(confidence) {
6
+ if (confidence >= 0.8) return "success";
7
+ if (confidence >= 0.5) return "warning";
8
+ return "error";
9
+ }
10
+ function getConfidenceLabel(confidence) {
11
+ if (confidence >= 0.8) return "High";
12
+ if (confidence >= 0.5) return "Medium";
13
+ return "Low";
14
+ }
15
+ function SourceCard({ source, variant = "compact", onNavigate, className }) {
16
+ const handleClick = () => {
17
+ if (onNavigate) {
18
+ onNavigate(source);
19
+ }
20
+ };
21
+ const isCompact = variant === "compact";
22
+ return /* @__PURE__ */ jsx(
23
+ "div",
24
+ {
25
+ className: twMerge(
26
+ "rounded-xl border transition-all duration-200",
27
+ "bg-surface border-border",
28
+ onNavigate && "cursor-pointer hover:border-border-strong",
29
+ className
30
+ ),
31
+ "data-document-id": source.document_id,
32
+ "data-testid": "source-card",
33
+ children: /* @__PURE__ */ jsxs(
34
+ "div",
35
+ {
36
+ className: isCompact ? "px-4 py-3" : "px-6 py-4",
37
+ onClick: handleClick,
38
+ role: onNavigate ? "button" : void 0,
39
+ tabIndex: onNavigate ? 0 : void 0,
40
+ onKeyDown: onNavigate ? (e) => {
41
+ if (e.key === "Enter" || e.key === " ") {
42
+ e.preventDefault();
43
+ handleClick();
44
+ }
45
+ } : void 0,
46
+ children: [
47
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-2", children: [
48
+ /* @__PURE__ */ jsxs("div", { className: "flex-1 min-w-0", children: [
49
+ /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-text-primary truncate", children: source.title }),
50
+ source.section && /* @__PURE__ */ jsx("p", { className: "text-[11px] font-semibold uppercase tracking-wider text-text-secondary truncate mt-0.5", children: source.section })
51
+ ] }),
52
+ /* @__PURE__ */ jsx(
53
+ Badge,
54
+ {
55
+ intent: getConfidenceIntent(source.confidence),
56
+ size: "sm",
57
+ children: getConfidenceLabel(source.confidence)
58
+ }
59
+ )
60
+ ] }),
61
+ !isCompact && /* @__PURE__ */ jsx("p", { className: "text-xs text-text-secondary mt-2 line-clamp-3 leading-relaxed", children: source.snippet })
62
+ ]
63
+ }
64
+ )
65
+ }
66
+ );
67
+ }
68
+
69
+ // src/sources/SourceList/SourceList.tsx
70
+ import { useState } from "react";
71
+ import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
72
+ function SourceList({
73
+ sources,
74
+ variant = "compact",
75
+ collapsible = false,
76
+ defaultExpanded = true,
77
+ onNavigate,
78
+ className
79
+ }) {
80
+ const [isExpanded, setIsExpanded] = useState(defaultExpanded);
81
+ if (sources.length === 0) return null;
82
+ const content = /* @__PURE__ */ jsx2("div", { className: "flex flex-col gap-1.5", "data-testid": "source-list-items", children: sources.map((source) => /* @__PURE__ */ jsx2(
83
+ SourceCard,
84
+ {
85
+ source,
86
+ variant,
87
+ onNavigate
88
+ },
89
+ source.document_id
90
+ )) });
91
+ if (!collapsible) {
92
+ return /* @__PURE__ */ jsx2("div", { className, "data-testid": "source-list", children: content });
93
+ }
94
+ return /* @__PURE__ */ jsxs2("div", { className, "data-testid": "source-list", children: [
95
+ /* @__PURE__ */ jsxs2(
96
+ "button",
97
+ {
98
+ type: "button",
99
+ onClick: () => setIsExpanded((prev) => !prev),
100
+ "aria-expanded": isExpanded,
101
+ className: "flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-text-secondary hover:text-accent mb-2 transition-colors duration-200",
102
+ children: [
103
+ /* @__PURE__ */ jsx2(
104
+ "svg",
105
+ {
106
+ className: `w-4 h-4 transition-transform ${isExpanded ? "rotate-180" : ""}`,
107
+ fill: "none",
108
+ viewBox: "0 0 24 24",
109
+ stroke: "currentColor",
110
+ strokeWidth: 2,
111
+ children: /* @__PURE__ */ jsx2("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19 9l-7 7-7-7" })
112
+ }
113
+ ),
114
+ "Sources (",
115
+ sources.length,
116
+ ")"
117
+ ]
118
+ }
119
+ ),
120
+ isExpanded && content
121
+ ] });
122
+ }
123
+
124
+ // src/sources/SourceInline/SourceInline.tsx
125
+ import { Tooltip } from "@surf-kit/core";
126
+ import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
127
+ function SourceInline({ source, index, className }) {
128
+ const tooltipContent = `${source.title}${source.section ? ` - ${source.section}` : ""}: ${source.snippet.slice(0, 120)}${source.snippet.length > 120 ? "..." : ""}`;
129
+ return /* @__PURE__ */ jsx3(Tooltip, { content: tooltipContent, placement: "top", children: /* @__PURE__ */ jsxs3(
130
+ "span",
131
+ {
132
+ className: `inline-flex items-center justify-center text-xs text-accent font-medium cursor-help ${className ?? ""}`,
133
+ "data-testid": "source-inline",
134
+ "data-document-id": source.document_id,
135
+ "aria-label": `Source ${index}: ${source.title}`,
136
+ children: [
137
+ "[",
138
+ index,
139
+ "]"
140
+ ]
141
+ }
142
+ ) });
143
+ }
144
+
145
+ // src/sources/SourceDrawer/SourceDrawer.tsx
146
+ import { Sheet, Badge as Badge2 } from "@surf-kit/core";
147
+ import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
148
+ function getConfidenceIntent2(confidence) {
149
+ if (confidence >= 0.8) return "success";
150
+ if (confidence >= 0.5) return "warning";
151
+ return "error";
152
+ }
153
+ function SourceDrawer({ source, isOpen, onClose, className }) {
154
+ if (!source) return null;
155
+ return /* @__PURE__ */ jsx4(
156
+ Sheet,
157
+ {
158
+ isOpen,
159
+ onClose,
160
+ title: source.title,
161
+ size: "md",
162
+ className,
163
+ children: /* @__PURE__ */ jsxs4("div", { "data-testid": "source-drawer", "data-document-id": source.document_id, children: [
164
+ source.section && /* @__PURE__ */ jsx4("p", { className: "text-sm text-text-secondary mb-4", children: source.section }),
165
+ /* @__PURE__ */ jsxs4("div", { className: "flex items-center gap-2 mb-4", children: [
166
+ /* @__PURE__ */ jsx4("span", { className: "text-sm text-text-secondary", children: "Confidence:" }),
167
+ /* @__PURE__ */ jsxs4(Badge2, { intent: getConfidenceIntent2(source.confidence), size: "sm", children: [
168
+ Math.round(source.confidence * 100),
169
+ "%"
170
+ ] })
171
+ ] }),
172
+ /* @__PURE__ */ jsxs4("div", { className: "mb-4", children: [
173
+ /* @__PURE__ */ jsx4("h3", { className: "text-sm font-medium text-text-primary mb-2", children: "Snippet" }),
174
+ /* @__PURE__ */ jsx4("p", { className: "text-sm text-text-secondary bg-surface-raised p-4 rounded-lg", children: source.snippet })
175
+ ] }),
176
+ source.url && /* @__PURE__ */ jsxs4("div", { children: [
177
+ /* @__PURE__ */ jsx4("h3", { className: "text-sm font-medium text-text-primary mb-2", children: "Source URL" }),
178
+ /* @__PURE__ */ jsx4(
179
+ "a",
180
+ {
181
+ href: source.url,
182
+ target: "_blank",
183
+ rel: "noopener noreferrer",
184
+ className: "text-sm text-accent hover:underline break-all",
185
+ children: source.url
186
+ }
187
+ )
188
+ ] })
189
+ ] })
190
+ }
191
+ );
192
+ }
193
+
194
+ // src/sources/SourceBadge/SourceBadge.tsx
195
+ import { Badge as Badge3 } from "@surf-kit/core";
196
+ import { jsxs as jsxs5 } from "react/jsx-runtime";
197
+ function SourceBadge({ count, className }) {
198
+ if (count === 0) return null;
199
+ return /* @__PURE__ */ jsxs5(Badge3, { intent: "info", size: "sm", className, "data-testid": "source-badge", children: [
200
+ count,
201
+ " ",
202
+ count === 1 ? "source" : "sources"
203
+ ] });
204
+ }
205
+ export {
206
+ SourceBadge,
207
+ SourceCard,
208
+ SourceDrawer,
209
+ SourceInline,
210
+ SourceList
211
+ };
212
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/sources/SourceCard/SourceCard.tsx","../../src/sources/SourceList/SourceList.tsx","../../src/sources/SourceInline/SourceInline.tsx","../../src/sources/SourceDrawer/SourceDrawer.tsx","../../src/sources/SourceBadge/SourceBadge.tsx"],"sourcesContent":["import React from 'react'\nimport { Badge } from '@surf-kit/core'\nimport { twMerge } from 'tailwind-merge'\nimport type { Source } from '../../types/agent'\n\ntype SourceCardProps = {\n source: Source\n variant?: 'compact' | 'expanded'\n onNavigate?: (source: Source) => void\n className?: string\n}\n\nfunction getConfidenceIntent(confidence: number) {\n if (confidence >= 0.8) return 'success' as const\n if (confidence >= 0.5) return 'warning' as const\n return 'error' as const\n}\n\nfunction getConfidenceLabel(confidence: number) {\n if (confidence >= 0.8) return 'High'\n if (confidence >= 0.5) return 'Medium'\n return 'Low'\n}\n\nfunction SourceCard({ source, variant = 'compact', onNavigate, className }: SourceCardProps) {\n const handleClick = () => {\n if (onNavigate) {\n onNavigate(source)\n }\n }\n\n const isCompact = variant === 'compact'\n\n return (\n <div\n className={twMerge(\n 'rounded-xl border transition-all duration-200',\n 'bg-surface border-border',\n onNavigate && 'cursor-pointer hover:border-border-strong',\n className,\n )}\n data-document-id={source.document_id}\n data-testid=\"source-card\"\n >\n <div\n className={isCompact ? 'px-4 py-3' : 'px-6 py-4'}\n onClick={handleClick}\n role={onNavigate ? 'button' : undefined}\n tabIndex={onNavigate ? 0 : undefined}\n onKeyDown={\n onNavigate\n ? (e: React.KeyboardEvent) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n handleClick()\n }\n }\n : undefined\n }\n >\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"flex-1 min-w-0\">\n <p className=\"text-sm font-medium text-text-primary truncate\">\n {source.title}\n </p>\n {source.section && (\n <p className=\"text-[11px] font-semibold uppercase tracking-wider text-text-secondary truncate mt-0.5\">\n {source.section}\n </p>\n )}\n </div>\n <Badge\n intent={getConfidenceIntent(source.confidence)}\n size=\"sm\"\n >\n {getConfidenceLabel(source.confidence)}\n </Badge>\n </div>\n {!isCompact && (\n <p className=\"text-xs text-text-secondary mt-2 line-clamp-3 leading-relaxed\">\n {source.snippet}\n </p>\n )}\n </div>\n </div>\n )\n}\n\nexport { SourceCard }\nexport type { SourceCardProps }\n","import React, { useState } from 'react'\nimport type { Source } from '../../types/agent'\nimport { SourceCard } from '../SourceCard'\n\ntype SourceListProps = {\n sources: Source[]\n variant?: 'compact' | 'expanded'\n collapsible?: boolean\n defaultExpanded?: boolean\n onNavigate?: (source: Source) => void\n className?: string\n}\n\nfunction SourceList({\n sources,\n variant = 'compact',\n collapsible = false,\n defaultExpanded = true,\n onNavigate,\n className,\n}: SourceListProps) {\n const [isExpanded, setIsExpanded] = useState(defaultExpanded)\n\n if (sources.length === 0) return null\n\n const content = (\n <div className=\"flex flex-col gap-1.5\" data-testid=\"source-list-items\">\n {sources.map((source) => (\n <SourceCard\n key={source.document_id}\n source={source}\n variant={variant}\n onNavigate={onNavigate}\n />\n ))}\n </div>\n )\n\n if (!collapsible) {\n return (\n <div className={className} data-testid=\"source-list\">\n {content}\n </div>\n )\n }\n\n return (\n <div className={className} data-testid=\"source-list\">\n <button\n type=\"button\"\n onClick={() => setIsExpanded(prev => !prev)}\n aria-expanded={isExpanded}\n className=\"flex items-center gap-1.5 text-xs font-semibold uppercase tracking-wider text-text-secondary hover:text-accent mb-2 transition-colors duration-200\"\n >\n <svg\n className={`w-4 h-4 transition-transform ${isExpanded ? 'rotate-180' : ''}`}\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n stroke=\"currentColor\"\n strokeWidth={2}\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" d=\"M19 9l-7 7-7-7\" />\n </svg>\n Sources ({sources.length})\n </button>\n {isExpanded && content}\n </div>\n )\n}\n\nexport { SourceList }\nexport type { SourceListProps }\n","import React from 'react'\nimport { Tooltip } from '@surf-kit/core'\n\nimport type { Source } from '../../types/agent'\n\ntype SourceInlineProps = {\n source: Source\n index: number\n className?: string\n}\n\nfunction SourceInline({ source, index, className }: SourceInlineProps) {\n const tooltipContent = `${source.title}${source.section ? ` - ${source.section}` : ''}: ${source.snippet.slice(0, 120)}${source.snippet.length > 120 ? '...' : ''}`\n\n return (\n <Tooltip content={tooltipContent} placement=\"top\">\n <span\n className={`inline-flex items-center justify-center text-xs text-accent font-medium cursor-help ${className ?? ''}`}\n data-testid=\"source-inline\"\n data-document-id={source.document_id}\n aria-label={`Source ${index}: ${source.title}`}\n >\n [{index}]\n </span>\n </Tooltip>\n )\n}\n\nexport { SourceInline }\nexport type { SourceInlineProps }\n","import React from 'react'\nimport { Sheet, Badge } from '@surf-kit/core'\nimport type { Source } from '../../types/agent'\n\ntype SourceDrawerProps = {\n source: Source | null\n isOpen: boolean\n onClose: () => void\n className?: string\n}\n\nfunction getConfidenceIntent(confidence: number) {\n if (confidence >= 0.8) return 'success' as const\n if (confidence >= 0.5) return 'warning' as const\n return 'error' as const\n}\n\nfunction SourceDrawer({ source, isOpen, onClose, className }: SourceDrawerProps) {\n if (!source) return null\n\n return (\n <Sheet\n isOpen={isOpen}\n onClose={onClose}\n title={source.title}\n size=\"md\"\n className={className}\n >\n <div data-testid=\"source-drawer\" data-document-id={source.document_id}>\n {source.section && (\n <p className=\"text-sm text-text-secondary mb-4\">{source.section}</p>\n )}\n\n <div className=\"flex items-center gap-2 mb-4\">\n <span className=\"text-sm text-text-secondary\">Confidence:</span>\n <Badge intent={getConfidenceIntent(source.confidence)} size=\"sm\">\n {Math.round(source.confidence * 100)}%\n </Badge>\n </div>\n\n <div className=\"mb-4\">\n <h3 className=\"text-sm font-medium text-text-primary mb-2\">Snippet</h3>\n <p className=\"text-sm text-text-secondary bg-surface-raised p-4 rounded-lg\">\n {source.snippet}\n </p>\n </div>\n\n {source.url && (\n <div>\n <h3 className=\"text-sm font-medium text-text-primary mb-2\">Source URL</h3>\n <a\n href={source.url}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"text-sm text-accent hover:underline break-all\"\n >\n {source.url}\n </a>\n </div>\n )}\n </div>\n </Sheet>\n )\n}\n\nexport { SourceDrawer }\nexport type { SourceDrawerProps }\n","import React from 'react'\nimport { Badge } from '@surf-kit/core'\n\ntype SourceBadgeProps = {\n count: number\n className?: string\n}\n\nfunction SourceBadge({ count, className }: SourceBadgeProps) {\n if (count === 0) return null\n\n return (\n <Badge intent=\"info\" size=\"sm\" className={className} data-testid=\"source-badge\">\n {count} {count === 1 ? 'source' : 'sources'}\n </Badge>\n )\n}\n\nexport { SourceBadge }\nexport type { SourceBadgeProps }\n"],"mappings":";AACA,SAAS,aAAa;AACtB,SAAS,eAAe;AA2Dd,SACE,KADF;AAjDV,SAAS,oBAAoB,YAAoB;AAC/C,MAAI,cAAc,IAAK,QAAO;AAC9B,MAAI,cAAc,IAAK,QAAO;AAC9B,SAAO;AACT;AAEA,SAAS,mBAAmB,YAAoB;AAC9C,MAAI,cAAc,IAAK,QAAO;AAC9B,MAAI,cAAc,IAAK,QAAO;AAC9B,SAAO;AACT;AAEA,SAAS,WAAW,EAAE,QAAQ,UAAU,WAAW,YAAY,UAAU,GAAoB;AAC3F,QAAM,cAAc,MAAM;AACxB,QAAI,YAAY;AACd,iBAAW,MAAM;AAAA,IACnB;AAAA,EACF;AAEA,QAAM,YAAY,YAAY;AAE9B,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