@webless/agent 0.7.4 → 0.8.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.
@@ -229,6 +229,72 @@ function hasOnlyKeys(value, allowed) {
229
229
  return Object.keys(value).every((key) => allowedKeys.has(key));
230
230
  }
231
231
 
232
+ // src/runtime/search-discovery.ts
233
+ function record(value) {
234
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : null;
235
+ }
236
+ function text(value, max = 500) {
237
+ return typeof value === "string" && value.trim().length > 0 && value.trim().length <= max;
238
+ }
239
+ function safeSearchUrl(value) {
240
+ if (typeof value !== "string") return void 0;
241
+ try {
242
+ const url = new URL(value);
243
+ return (url.protocol === "https:" || url.protocol === "http:") && !url.username && !url.password ? url.href : void 0;
244
+ } catch {
245
+ return void 0;
246
+ }
247
+ }
248
+ function parseAgentSearchReferences(value) {
249
+ const data = record(value);
250
+ if (!data || !Array.isArray(data.sources) || data.sources.length > 20)
251
+ return null;
252
+ const sources = [];
253
+ for (const value2 of data.sources) {
254
+ const source = record(value2);
255
+ if (!source || Object.keys(source).some(
256
+ (key) => !["id", "title", "url"].includes(key)
257
+ ) || !text(source.id, Infinity) || !text(source.title) || source.url !== void 0 && typeof source.url !== "string")
258
+ return null;
259
+ const url = safeSearchUrl(source.url);
260
+ sources.push({
261
+ id: source.id.trim(),
262
+ title: source.title.trim(),
263
+ ...url ? { url } : {}
264
+ });
265
+ }
266
+ let cta;
267
+ if (data.cta !== void 0) {
268
+ const action = record(data.cta);
269
+ if (!action || Object.keys(action).some((key) => !["label", "url"].includes(key)) || !text(action.label) || action.url !== void 0 && typeof action.url !== "string")
270
+ return null;
271
+ const url = safeSearchUrl(action.url);
272
+ cta = { label: action.label.trim(), ...url ? { url } : {} };
273
+ }
274
+ return { sources, ...cta ? { cta } : {} };
275
+ }
276
+ function parseAgentSearchDiscoveryOutput(value) {
277
+ let decoded = value;
278
+ if (typeof value === "string") {
279
+ try {
280
+ decoded = JSON.parse(value);
281
+ } catch {
282
+ return null;
283
+ }
284
+ }
285
+ const data = record(decoded);
286
+ if (!data || Object.keys(data).some(
287
+ (key) => !["answer", "sources", "cta", "suggestions"].includes(key)
288
+ ) || !text(data.answer, 5e4) || !Array.isArray(data.suggestions) || data.suggestions.length > 8 || !data.suggestions.every((item) => text(item)))
289
+ return null;
290
+ const references = parseAgentSearchReferences(data);
291
+ return references ? {
292
+ ...references,
293
+ answer: data.answer.trim(),
294
+ suggestions: data.suggestions.map((item) => item.trim())
295
+ } : null;
296
+ }
297
+
232
298
  // src/runtime/tool-result-envelope.ts
233
299
  var ENVELOPE_KEYS = /* @__PURE__ */ new Set([
234
300
  "schemaVersion",
@@ -352,19 +418,19 @@ function parseVisitorFormFields(value) {
352
418
  const fields = [];
353
419
  const seen = /* @__PURE__ */ new Set();
354
420
  for (const item of value) {
355
- const record = asRecord(item);
356
- const id = asString(record?.id).toLowerCase().replace(/[^a-z0-9_-]/g, "");
357
- const kind = asString(record?.kind);
358
- if (!record || !id || seen.has(id) || !isFieldKind2(kind)) continue;
421
+ const record2 = asRecord(item);
422
+ const id = asString(record2?.id).toLowerCase().replace(/[^a-z0-9_-]/g, "");
423
+ const kind = asString(record2?.kind);
424
+ if (!record2 || !id || seen.has(id) || !isFieldKind2(kind)) continue;
359
425
  seen.add(id);
360
- const label = asString(record.label) || id;
426
+ const label = asString(record2.label) || id;
361
427
  fields.push({
362
428
  id,
363
429
  kind,
364
430
  label,
365
- placeholder: asString(record.placeholder) || label,
366
- required: record.required !== false,
367
- ...asString(record.autocomplete) ? { autocomplete: asString(record.autocomplete) } : {}
431
+ placeholder: asString(record2.placeholder) || label,
432
+ required: record2.required !== false,
433
+ ...asString(record2.autocomplete) ? { autocomplete: asString(record2.autocomplete) } : {}
368
434
  });
369
435
  if (fields.length >= MAX_FORM_FIELDS) break;
370
436
  }
@@ -395,52 +461,52 @@ function formatComposerFormMessage(form, values) {
395
461
  return value ? `${field.label}: ${value}` : "";
396
462
  }).filter(Boolean).join("\n");
397
463
  }
398
- function looksLikeFieldCollection(text) {
464
+ function looksLikeFieldCollection(text2) {
399
465
  return /\b(please|need|send|share|enter|provide|add|collect|what|which|use)\b/i.test(
400
- text
401
- ) || /:\s*$/m.test(text) || /^[-*•]\s+/m.test(text);
466
+ text2
467
+ ) || /:\s*$/m.test(text2) || /^[-*•]\s+/m.test(text2);
402
468
  }
403
- function looksLikeBookingCopy(text) {
469
+ function looksLikeBookingCopy(text2) {
404
470
  return /book(ing)? (card|a demo|this time)|pick a (date|time)|available (times|slots)|calendly/i.test(
405
- text
471
+ text2
406
472
  );
407
473
  }
408
- function echoedLabeledFieldIds(text) {
474
+ function echoedLabeledFieldIds(text2) {
409
475
  const ids = /* @__PURE__ */ new Set();
410
- if (/\bname\s*:\s+\S+/i.test(text)) ids.add("name");
411
- if (/\be-?mail\s*:\s+\S+/i.test(text)) ids.add("email");
412
- if (/\bphone\s*:\s+\S+/i.test(text)) ids.add("phone");
413
- if (/\bcompany\s*:\s+\S+/i.test(text)) ids.add("company");
476
+ if (/\bname\s*:\s+\S+/i.test(text2)) ids.add("name");
477
+ if (/\be-?mail\s*:\s+\S+/i.test(text2)) ids.add("email");
478
+ if (/\bphone\s*:\s+\S+/i.test(text2)) ids.add("phone");
479
+ if (/\bcompany\s*:\s+\S+/i.test(text2)) ids.add("company");
414
480
  return ids;
415
481
  }
416
- function matchLibraryFields(text) {
482
+ function matchLibraryFields(text2) {
417
483
  return FIELD_LIBRARY.flatMap((field) => {
418
- if (field.exclude?.test(text)) {
419
- const leftover = text.replace(field.exclude, " ");
484
+ if (field.exclude?.test(text2)) {
485
+ const leftover = text2.replace(field.exclude, " ");
420
486
  if (!field.patterns.some((pattern) => pattern.test(leftover))) return [];
421
- } else if (!field.patterns.some((pattern) => pattern.test(text))) {
487
+ } else if (!field.patterns.some((pattern) => pattern.test(text2))) {
422
488
  return [];
423
489
  }
424
490
  const { patterns: _patterns, exclude: _exclude, ...next } = field;
425
491
  return [next];
426
492
  }).slice(0, MAX_FORM_FIELDS);
427
493
  }
428
- function looksLikeCompletedActionRecap(text) {
429
- const confirmingCreate = /\bshould i create this\b/i.test(text);
430
- const echoingFilledFields = /\b(?:name|email|phone|company)\s*:\s+\S+/i.test(text) && /[^\s@]+@[^\s@]+\.[^\s@]+/i.test(text);
494
+ function looksLikeCompletedActionRecap(text2) {
495
+ const confirmingCreate = /\bshould i create this\b/i.test(text2);
496
+ const echoingFilledFields = /\b(?:name|email|phone|company)\s*:\s+\S+/i.test(text2) && /[^\s@]+@[^\s@]+\.[^\s@]+/i.test(text2);
431
497
  if (echoingFilledFields) {
432
- if (looksLikeFieldCollection(text)) {
433
- const echoed = echoedLabeledFieldIds(text);
434
- if (matchLibraryFields(text).some((field) => !echoed.has(field.id))) {
498
+ if (looksLikeFieldCollection(text2)) {
499
+ const echoed = echoedLabeledFieldIds(text2);
500
+ if (matchLibraryFields(text2).some((field) => !echoed.has(field.id))) {
435
501
  return false;
436
502
  }
437
503
  }
438
504
  return true;
439
505
  }
440
- return confirmingCreate && !looksLikeFieldCollection(text);
506
+ return confirmingCreate && !looksLikeFieldCollection(text2);
441
507
  }
442
- function inferComposerForm(text) {
443
- const cleaned = text.trim();
508
+ function inferComposerForm(text2) {
509
+ const cleaned = text2.trim();
444
510
  if (!cleaned || looksLikeBookingCopy(cleaned) || looksLikeCompletedActionRecap(cleaned) || !looksLikeFieldCollection(cleaned)) {
445
511
  return null;
446
512
  }
@@ -455,8 +521,8 @@ function resolveComposerForm(input) {
455
521
  if (input.enabled === false || input.hasBookingOffer || input.hasPendingConfirmation) {
456
522
  return null;
457
523
  }
458
- const text = input.agentText.trim();
459
- if (!text) return null;
524
+ const text2 = input.agentText.trim();
525
+ if (!text2) return null;
460
526
  const card = input.cards?.find((item) => item.type === "visitor_form");
461
527
  if (card?.fields && card.fields.length >= MIN_FORM_FIELDS) {
462
528
  return {
@@ -464,7 +530,7 @@ function resolveComposerForm(input) {
464
530
  fields: card.fields.slice(0, MAX_FORM_FIELDS)
465
531
  };
466
532
  }
467
- return inferComposerForm(text);
533
+ return inferComposerForm(text2);
468
534
  }
469
535
 
470
536
  // src/react/lib/tool-card.ts
@@ -478,9 +544,9 @@ function preferBookingOffer(current, next) {
478
544
  }
479
545
  return next;
480
546
  }
481
- function looksLikeBookingReady(text) {
547
+ function looksLikeBookingReady(text2) {
482
548
  return /demo option|options are ready|pick a (date|time)|available (times|slots)|book(ing)? (card|the demo)|\bschedule\b/i.test(
483
- text
549
+ text2
484
550
  );
485
551
  }
486
552
  function bookingOfferIdentityKey(offer) {
@@ -504,19 +570,19 @@ function isEventTypeUri(value) {
504
570
  return /^https:\/\/api\.calendly\.com\/event_types\/[^/]+$/i.test(value);
505
571
  }
506
572
  function parseToolCard(value) {
507
- const record = asRecord2(value);
508
- if (!record) return null;
509
- if (record.booking_offer && asString2(record.type) !== "booking_offer") {
510
- const nested = parseToolCard(record.booking_offer);
573
+ const record2 = asRecord2(value);
574
+ if (!record2) return null;
575
+ if (record2.booking_offer && asString2(record2.type) !== "booking_offer") {
576
+ const nested = parseToolCard(record2.booking_offer);
511
577
  if (nested) return nested;
512
578
  }
513
- if (record.visitor_booking && asString2(record.type) !== "booking_confirmed") {
514
- const nested = parseToolCard(record.visitor_booking);
579
+ if (record2.visitor_booking && asString2(record2.type) !== "booking_confirmed") {
580
+ const nested = parseToolCard(record2.visitor_booking);
515
581
  if (nested) return nested;
516
582
  }
517
- const type = asString2(record.type);
583
+ const type = asString2(record2.type);
518
584
  if (type === "booking_offer") {
519
- const eventTypes = Array.isArray(record.eventTypes) ? record.eventTypes.flatMap((item) => {
585
+ const eventTypes = Array.isArray(record2.eventTypes) ? record2.eventTypes.flatMap((item) => {
520
586
  const entry = asRecord2(item);
521
587
  const uri = asString2(entry?.uri);
522
588
  if (!entry || !uri) return [];
@@ -533,7 +599,7 @@ function parseToolCard(value) {
533
599
  }
534
600
  ];
535
601
  }) : [];
536
- const slots = Array.isArray(record.slots) ? record.slots.flatMap((item) => {
602
+ const slots = Array.isArray(record2.slots) ? record2.slots.flatMap((item) => {
537
603
  const entry = asRecord2(item);
538
604
  const startTime = asString2(entry?.startTime);
539
605
  if (!entry || !startTime) return [];
@@ -549,11 +615,11 @@ function parseToolCard(value) {
549
615
  return { type: "booking_offer", eventTypes, slots };
550
616
  }
551
617
  if (type === "booking_confirmed") {
552
- const eventUri = asString2(record.eventUri);
618
+ const eventUri = asString2(record2.eventUri);
553
619
  if (!isEventUri(eventUri)) return null;
554
- const inviteeUri = asString2(record.inviteeUri);
555
- const inviteeEmail = asString2(record.inviteeEmail);
556
- const startTime = asString2(record.startTime);
620
+ const inviteeUri = asString2(record2.inviteeUri);
621
+ const inviteeEmail = asString2(record2.inviteeEmail);
622
+ const startTime = asString2(record2.startTime);
557
623
  return {
558
624
  type: "booking_confirmed",
559
625
  eventUri,
@@ -563,12 +629,12 @@ function parseToolCard(value) {
563
629
  };
564
630
  }
565
631
  if (type === "booking_canceled") {
566
- const eventUri = asString2(record.eventUri);
632
+ const eventUri = asString2(record2.eventUri);
567
633
  if (!isEventUri(eventUri)) return null;
568
634
  return { type: "booking_canceled", eventUri };
569
635
  }
570
636
  if (type === "visitor_form") {
571
- const fields = parseVisitorFormFields(record.fields);
637
+ const fields = parseVisitorFormFields(record2.fields);
572
638
  if (fields.length < 2) return null;
573
639
  return { type: "visitor_form", fields };
574
640
  }
@@ -586,33 +652,33 @@ function formatBookingOfferFence(offer) {
586
652
  ].join("\n");
587
653
  }
588
654
  function bookingCardFromActionOutput(output) {
589
- const record = asRecord2(output);
590
- const data = asRecord2(record?.output) ?? asRecord2(record?.data) ?? record;
655
+ const record2 = asRecord2(output);
656
+ const data = asRecord2(record2?.output) ?? asRecord2(record2?.data) ?? record2;
591
657
  return parseToolCard(data);
592
658
  }
593
- function ensureBookingOfferText(text, offer) {
594
- if (!offer) return text;
595
- if (extractToolCards(text).some((card) => card.type === "booking_offer")) {
596
- return text;
659
+ function ensureBookingOfferText(text2, offer) {
660
+ if (!offer) return text2;
661
+ if (extractToolCards(text2).some((card) => card.type === "booking_offer")) {
662
+ return text2;
597
663
  }
598
- const visible = stripToolCards(text).trim() || text.trim();
664
+ const visible = stripToolCards(text2).trim() || text2.trim();
599
665
  return `${visible}
600
666
 
601
667
  ${formatBookingOfferFence(offer)}`;
602
668
  }
603
- function hideToolCardFences(text) {
604
- return text.replace(/```(?:webless-tool-card|json)\s*[\s\S]*?```/gi, "").replace(/```(?:webless-tool-card|json)[\s\S]*$/i, "").replace(/\n{3,}/g, "\n\n").trim();
669
+ function hideToolCardFences(text2) {
670
+ return text2.replace(/```(?:webless-tool-card|json)\s*[\s\S]*?```/gi, "").replace(/```(?:webless-tool-card|json)[\s\S]*$/i, "").replace(/\n{3,}/g, "\n\n").trim();
605
671
  }
606
672
  var BOOKING_CARD_FALLBACK = "Pick a date and time that works for you.";
607
- function looksLikeBookingAvailabilityDump(text) {
608
- const cleaned = text.trim();
673
+ function looksLikeBookingAvailabilityDump(text2) {
674
+ const cleaned = text2.trim();
609
675
  if (!cleaned) return false;
610
676
  const isoCount = (cleaned.match(/\d{4}-\d{2}-\d{2}[ T]\d{2}:\d{2}/g) ?? []).length;
611
677
  const utcCount = (cleaned.match(/\bUTC\b/g) ?? []).length;
612
678
  return isoCount >= 2 || utcCount >= 2 || /api\.calendly\.com|calendly\.com\//i.test(cleaned) || /webless-tool-card/i.test(cleaned);
613
679
  }
614
- function sanitizeBookingOfferCopy(text) {
615
- const cleaned = hideToolCardFences(text);
680
+ function sanitizeBookingOfferCopy(text2) {
681
+ const cleaned = hideToolCardFences(text2);
616
682
  if (!cleaned || looksLikeBookingAvailabilityDump(cleaned)) {
617
683
  return BOOKING_CARD_FALLBACK;
618
684
  }
@@ -625,9 +691,9 @@ function visitorTimeZone() {
625
691
  return "UTC";
626
692
  }
627
693
  }
628
- function extractToolCards(text) {
694
+ function extractToolCards(text2) {
629
695
  const cards = [];
630
- for (const match of text.matchAll(FENCE_PATTERN)) {
696
+ for (const match of text2.matchAll(FENCE_PATTERN)) {
631
697
  try {
632
698
  const card = parseToolCard(JSON.parse(match[1] ?? ""));
633
699
  if (card) cards.push(card);
@@ -636,8 +702,8 @@ function extractToolCards(text) {
636
702
  }
637
703
  return cards;
638
704
  }
639
- function stripToolCards(text) {
640
- return text.replace(FENCE_PATTERN, "").replace(/\n{3,}/g, "\n\n").trim();
705
+ function stripToolCards(text2) {
706
+ return text2.replace(FENCE_PATTERN, "").replace(/\n{3,}/g, "\n\n").trim();
641
707
  }
642
708
  function localDateKey(date) {
643
709
  if (Number.isNaN(date.getTime())) return "";
@@ -757,10 +823,10 @@ function safeText(value) {
757
823
  return value.trim().slice(0, MAX_TEXT_LENGTH);
758
824
  }
759
825
  function safeHref(value) {
760
- const text = safeText(value);
761
- if (!text) return "";
826
+ const text2 = safeText(value);
827
+ if (!text2) return "";
762
828
  try {
763
- const url = new URL(text);
829
+ const url = new URL(text2);
764
830
  return url.protocol === "https:" ? url.toString() : "";
765
831
  } catch {
766
832
  return "";
@@ -980,6 +1046,22 @@ function finalizeSummaryPresentation(result, proposed) {
980
1046
  };
981
1047
  }
982
1048
  function presentVisitorToolResult(result, registry = []) {
1049
+ if (result.toolName === "search_discovery" && result.status === "completed") {
1050
+ const envelope2 = parseAgentToolResultEnvelope(result.output);
1051
+ const search = parseAgentSearchDiscoveryOutput(
1052
+ envelope2?.output ?? result.output
1053
+ );
1054
+ if (search) {
1055
+ return {
1056
+ id: result.callId,
1057
+ toolName: "search_discovery",
1058
+ status: "completed",
1059
+ kind: "search",
1060
+ sources: search.sources,
1061
+ ...search.cta ? { cta: search.cta } : {}
1062
+ };
1063
+ }
1064
+ }
983
1065
  const envelope = parseAgentToolResultEnvelope(result.output) ?? providerErrorEnvelope(result.output) ?? legacyBookingEnvelope(result.output);
984
1066
  const proposed = envelope ? resolvePresenterOutput(result, envelope, registry) : null;
985
1067
  if (proposed?.kind === "booking") {
@@ -1044,8 +1126,8 @@ function presentVisitorToolResult(result, registry = []) {
1044
1126
  return finalizeSummaryPresentation(result, proposed);
1045
1127
  }
1046
1128
  function providerErrorEnvelope(output) {
1047
- const record = asRecord3(output);
1048
- const providerError = asRecord3(record?.providerError);
1129
+ const record2 = asRecord3(output);
1130
+ const providerError = asRecord3(record2?.providerError);
1049
1131
  const message = safeText(providerError?.message);
1050
1132
  const action = safeText(providerError?.action);
1051
1133
  if (!message || !action) return null;
@@ -2073,10 +2155,10 @@ var AgentSession = class {
2073
2155
  }
2074
2156
  this.session = session;
2075
2157
  const inputResponses = responses.map(
2076
- ({ requestId, optionId, text }) => ({
2158
+ ({ requestId, optionId, text: text2 }) => ({
2077
2159
  requestId,
2078
2160
  ...optionId ? { optionId } : {},
2079
- ...text ? { text } : {}
2161
+ ...text2 ? { text: text2 } : {}
2080
2162
  })
2081
2163
  );
2082
2164
  const response = await withCapabilityRefresh(
@@ -2245,82 +2327,87 @@ function conversationKey(storageKeyPrefix, visitorSessionId) {
2245
2327
  }
2246
2328
  function parseMessage(value) {
2247
2329
  if (typeof value !== "object" || value === null) return null;
2248
- const record = value;
2249
- if (typeof record.id !== "string" || record.role !== "agent" && record.role !== "visitor" || typeof record.text !== "string" || typeof record.createdAt !== "number" || !Number.isFinite(record.createdAt)) {
2330
+ const record2 = value;
2331
+ if (typeof record2.id !== "string" || record2.role !== "agent" && record2.role !== "visitor" || typeof record2.text !== "string" || typeof record2.createdAt !== "number" || !Number.isFinite(record2.createdAt)) {
2250
2332
  return null;
2251
2333
  }
2252
- if (record.role === "visitor") {
2334
+ if (record2.role === "visitor") {
2253
2335
  return {
2254
- id: record.id,
2336
+ id: record2.id,
2255
2337
  role: "visitor",
2256
- text: record.text,
2257
- createdAt: record.createdAt,
2258
- ...typeof record.runtimeText === "string" && record.runtimeText ? { runtimeText: record.runtimeText } : {}
2338
+ text: record2.text,
2339
+ createdAt: record2.createdAt,
2340
+ ...typeof record2.runtimeText === "string" && record2.runtimeText ? { runtimeText: record2.runtimeText } : {}
2259
2341
  };
2260
2342
  }
2343
+ const searchResults = Array.isArray(record2.searchResults) ? record2.searchResults.flatMap((value2) => {
2344
+ const result = parseToolResult(value2);
2345
+ return result?.kind === "search" ? [result] : [];
2346
+ }) : [];
2261
2347
  return {
2262
- id: record.id,
2348
+ id: record2.id,
2263
2349
  role: "agent",
2264
- text: record.text,
2265
- createdAt: record.createdAt
2350
+ ...searchResults.length ? { searchResults } : {},
2351
+ text: record2.text,
2352
+ createdAt: record2.createdAt
2266
2353
  };
2267
2354
  }
2268
2355
  function parseToolStep(value) {
2269
2356
  if (typeof value !== "object" || value === null) return null;
2270
- const record = value;
2271
- if (typeof record.id !== "string" || record.kind !== "planning" && record.kind !== "search" && record.kind !== "specialist" || typeof record.label !== "string" || record.state !== "completed" && record.state !== "active" && record.state !== "pending" && record.state !== "error") {
2357
+ const record2 = value;
2358
+ if (typeof record2.id !== "string" || record2.kind !== "planning" && record2.kind !== "search" && record2.kind !== "specialist" || typeof record2.label !== "string" || record2.state !== "completed" && record2.state !== "active" && record2.state !== "pending" && record2.state !== "error") {
2272
2359
  return null;
2273
2360
  }
2274
2361
  return {
2275
- id: record.id,
2276
- kind: record.kind,
2277
- label: record.label,
2278
- state: record.state,
2279
- ...typeof record.detail === "string" && record.detail ? { detail: record.detail } : {}
2362
+ id: record2.id,
2363
+ kind: record2.kind,
2364
+ label: record2.label,
2365
+ state: record2.state,
2366
+ ...typeof record2.detail === "string" && record2.detail ? { detail: record2.detail } : {}
2280
2367
  };
2281
2368
  }
2282
2369
  function parseInputOption(value) {
2283
2370
  if (typeof value !== "object" || value === null) return null;
2284
- const record = value;
2285
- if (typeof record.id !== "string" || typeof record.label !== "string") {
2371
+ const record2 = value;
2372
+ if (typeof record2.id !== "string" || typeof record2.label !== "string") {
2286
2373
  return null;
2287
2374
  }
2288
2375
  return {
2289
- id: record.id,
2290
- label: record.label,
2291
- ...typeof record.description === "string" ? { description: record.description } : {},
2292
- ...record.style === "default" || record.style === "primary" || record.style === "danger" ? { style: record.style } : {}
2376
+ id: record2.id,
2377
+ label: record2.label,
2378
+ ...typeof record2.description === "string" ? { description: record2.description } : {},
2379
+ ...record2.style === "default" || record2.style === "primary" || record2.style === "danger" ? { style: record2.style } : {}
2293
2380
  };
2294
2381
  }
2295
2382
  function parseInputRequest(value) {
2296
2383
  if (typeof value !== "object" || value === null) return null;
2297
- const record = value;
2298
- if (typeof record.requestId !== "string" || record.kind !== "question" && record.kind !== "session-limit" && record.kind !== "tool-approval" || typeof record.prompt !== "string") {
2384
+ const record2 = value;
2385
+ if (typeof record2.requestId !== "string" || record2.kind !== "question" && record2.kind !== "session-limit" && record2.kind !== "tool-approval" || typeof record2.prompt !== "string") {
2299
2386
  return null;
2300
2387
  }
2301
- const action = record.action;
2388
+ const action = record2.action;
2302
2389
  if (typeof action !== "object" || action === null) return null;
2303
2390
  const actionRecord = action;
2304
2391
  if (typeof actionRecord.callId !== "string" || actionRecord.kind !== "tool-call" || typeof actionRecord.toolName !== "string") {
2305
2392
  return null;
2306
2393
  }
2307
- const options = Array.isArray(record.options) ? record.options.map(parseInputOption) : void 0;
2308
- if (Array.isArray(record.options) && options?.some((option) => option === null)) {
2394
+ const options = Array.isArray(record2.options) ? record2.options.map(parseInputOption) : void 0;
2395
+ if (Array.isArray(record2.options) && options?.some((option) => option === null)) {
2309
2396
  return null;
2310
2397
  }
2311
- const ui = record.ui ? parseAgentToolUiSurface(record.ui) : void 0;
2312
- if (record.ui && !ui) return null;
2398
+ const ui = record2.ui ? parseAgentToolUiSurface(record2.ui) : void 0;
2399
+ if (record2.ui && !ui) return null;
2313
2400
  return {
2314
- requestId: record.requestId,
2315
- kind: record.kind,
2316
- prompt: record.prompt,
2401
+ requestId: record2.requestId,
2402
+ kind: record2.kind,
2403
+ prompt: record2.prompt,
2317
2404
  action: {
2318
2405
  callId: actionRecord.callId,
2319
2406
  kind: "tool-call",
2320
2407
  toolName: actionRecord.toolName
2321
2408
  },
2322
- ...record.display === "confirmation" || record.display === "select" || record.display === "text" ? { display: record.display } : {},
2323
- ...record.allowFreeform === true ? { allowFreeform: true } : {},
2409
+ ...record2.display === "confirmation" || record2.display === "select" || record2.display === "text" ? { display: record2.display } : {},
2410
+ ...record2.allowFreeform === true ? { allowFreeform: true } : {},
2324
2411
  ...options && options.length > 0 ? {
2325
2412
  options: options.filter(
2326
2413
  (option) => option !== null
@@ -2331,40 +2418,50 @@ function parseInputRequest(value) {
2331
2418
  }
2332
2419
  function parseToolResult(value) {
2333
2420
  if (typeof value !== "object" || value === null) return null;
2334
- const record = value;
2335
- if (typeof record.id !== "string" || typeof record.toolName !== "string" || record.status !== "completed" && record.status !== "failed" && record.status !== "rejected") {
2421
+ const record2 = value;
2422
+ if (typeof record2.id !== "string" || typeof record2.toolName !== "string" || record2.status !== "completed" && record2.status !== "failed" && record2.status !== "rejected") {
2336
2423
  return null;
2337
2424
  }
2338
- if (record.kind === "input") {
2425
+ if (record2.kind === "search" && record2.toolName === "search_discovery" && record2.status === "completed") {
2426
+ const references = parseAgentSearchReferences(record2);
2427
+ return references ? {
2428
+ id: record2.id,
2429
+ toolName: "search_discovery",
2430
+ status: "completed",
2431
+ kind: "search",
2432
+ ...references
2433
+ } : null;
2434
+ }
2435
+ if (record2.kind === "input") {
2339
2436
  const surface = parseAgentToolUiSurface(
2340
- record.surface
2437
+ record2.surface
2341
2438
  );
2342
2439
  return surface ? {
2343
- id: record.id,
2344
- toolName: record.toolName,
2345
- status: record.status,
2440
+ id: record2.id,
2441
+ toolName: record2.toolName,
2442
+ status: record2.status,
2346
2443
  kind: "input",
2347
2444
  surface
2348
2445
  } : null;
2349
2446
  }
2350
- if (record.kind === "entity" && typeof record.title === "string") {
2447
+ if (record2.kind === "entity" && typeof record2.title === "string") {
2351
2448
  return {
2352
- id: record.id,
2353
- toolName: record.toolName,
2354
- status: record.status,
2449
+ id: record2.id,
2450
+ toolName: record2.toolName,
2451
+ status: record2.status,
2355
2452
  kind: "entity",
2356
- title: record.title,
2357
- ...typeof record.description === "string" ? { description: record.description } : {}
2453
+ title: record2.title,
2454
+ ...typeof record2.description === "string" ? { description: record2.description } : {}
2358
2455
  };
2359
2456
  }
2360
- if (record.kind === "collection" && typeof record.title === "string" && Array.isArray(record.items)) {
2457
+ if (record2.kind === "collection" && typeof record2.title === "string" && Array.isArray(record2.items)) {
2361
2458
  return {
2362
- id: record.id,
2363
- toolName: record.toolName,
2364
- status: record.status,
2459
+ id: record2.id,
2460
+ toolName: record2.toolName,
2461
+ status: record2.status,
2365
2462
  kind: "collection",
2366
- title: record.title,
2367
- items: record.items.flatMap((item) => {
2463
+ title: record2.title,
2464
+ items: record2.items.flatMap((item) => {
2368
2465
  if (typeof item !== "object" || item === null) return [];
2369
2466
  const entry = item;
2370
2467
  if (typeof entry.title !== "string") return [];
@@ -2378,26 +2475,26 @@ function parseToolResult(value) {
2378
2475
  })
2379
2476
  };
2380
2477
  }
2381
- if (record.kind === "signature" && typeof record.title === "string") {
2478
+ if (record2.kind === "signature" && typeof record2.title === "string") {
2382
2479
  return {
2383
- id: record.id,
2384
- toolName: record.toolName,
2385
- status: record.status,
2480
+ id: record2.id,
2481
+ toolName: record2.toolName,
2482
+ status: record2.status,
2386
2483
  kind: "signature",
2387
- title: record.title,
2388
- ...typeof record.description === "string" ? { description: record.description } : {},
2389
- ...typeof record.statusLabel === "string" ? { statusLabel: record.statusLabel } : {}
2484
+ title: record2.title,
2485
+ ...typeof record2.description === "string" ? { description: record2.description } : {},
2486
+ ...typeof record2.statusLabel === "string" ? { statusLabel: record2.statusLabel } : {}
2390
2487
  };
2391
2488
  }
2392
- if (record.kind !== "summary" || typeof record.title !== "string")
2489
+ if (record2.kind !== "summary" || typeof record2.title !== "string")
2393
2490
  return null;
2394
2491
  return {
2395
- id: record.id,
2396
- toolName: record.toolName,
2397
- status: record.status,
2492
+ id: record2.id,
2493
+ toolName: record2.toolName,
2494
+ status: record2.status,
2398
2495
  kind: "summary",
2399
- title: record.title,
2400
- ...typeof record.description === "string" ? { description: record.description } : {}
2496
+ title: record2.title,
2497
+ ...typeof record2.description === "string" ? { description: record2.description } : {}
2401
2498
  };
2402
2499
  }
2403
2500
  function visitorTurnText(message) {
@@ -2412,29 +2509,29 @@ function loadPersistedAgentConversation(storageKeyPrefix, visitorSessionId) {
2412
2509
  try {
2413
2510
  const value = JSON.parse(raw);
2414
2511
  if (typeof value !== "object" || value === null) return null;
2415
- const record = value;
2416
- if (record.version !== 1 && record.version !== 2 && record.version !== CONVERSATION_VERSION || !Array.isArray(record.messages) || typeof record.pending !== "boolean" || typeof record.streamingText !== "string" || record.version === CONVERSATION_VERSION && !Array.isArray(record.toolSteps)) {
2512
+ const record2 = value;
2513
+ if (record2.version !== 1 && record2.version !== 2 && record2.version !== CONVERSATION_VERSION || !Array.isArray(record2.messages) || typeof record2.pending !== "boolean" || typeof record2.streamingText !== "string" || record2.version === CONVERSATION_VERSION && !Array.isArray(record2.toolSteps)) {
2417
2514
  return null;
2418
2515
  }
2419
- const messages = record.messages.map(parseMessage);
2516
+ const messages = record2.messages.map(parseMessage);
2420
2517
  if (messages.some((message) => message === null)) return null;
2421
- const storedToolSteps = (record.version === 2 || record.version === CONVERSATION_VERSION) && Array.isArray(record.toolSteps) ? record.toolSteps : [];
2518
+ const storedToolSteps = (record2.version === 2 || record2.version === CONVERSATION_VERSION) && Array.isArray(record2.toolSteps) ? record2.toolSteps : [];
2422
2519
  const toolSteps = storedToolSteps.map(parseToolStep);
2423
2520
  if (toolSteps.some((step) => step === null)) return null;
2424
- const storedToolResults = record.version === CONVERSATION_VERSION && Array.isArray(record.toolResults) ? record.toolResults : [];
2521
+ const storedToolResults = record2.version === CONVERSATION_VERSION && Array.isArray(record2.toolResults) ? record2.toolResults : [];
2425
2522
  const toolResults = storedToolResults.map(parseToolResult);
2426
2523
  if (toolResults.some((result) => result === null)) return null;
2427
- const storedPendingInputs = Array.isArray(record.pendingInputs) ? record.pendingInputs : [];
2524
+ const storedPendingInputs = Array.isArray(record2.pendingInputs) ? record2.pendingInputs : [];
2428
2525
  const pendingInputs = storedPendingInputs.map(parseInputRequest);
2429
2526
  if (pendingInputs.some((request) => request === null)) return null;
2430
2527
  return {
2431
2528
  messages: messages.filter(
2432
2529
  (message) => message !== null
2433
2530
  ),
2434
- pending: record.pending,
2435
- streamingText: record.streamingText,
2531
+ pending: record2.pending,
2532
+ streamingText: record2.streamingText,
2436
2533
  toolSteps: toolSteps.filter((step) => step !== null),
2437
- ...Array.isArray(record.toolResults) ? {
2534
+ ...Array.isArray(record2.toolResults) ? {
2438
2535
  toolResults: toolResults.filter(
2439
2536
  (result) => result !== null
2440
2537
  )
@@ -2475,13 +2572,13 @@ function loadPendingWidgetBooking(storageKeyPrefix, visitorSessionId) {
2475
2572
  try {
2476
2573
  const value = JSON.parse(raw);
2477
2574
  if (typeof value !== "object" || value === null) return null;
2478
- const record = value;
2479
- if (typeof record.eventUri !== "string" || !record.eventUri) return null;
2575
+ const record2 = value;
2576
+ if (typeof record2.eventUri !== "string" || !record2.eventUri) return null;
2480
2577
  return {
2481
- eventUri: record.eventUri,
2482
- ...typeof record.inviteeUri === "string" && record.inviteeUri ? { inviteeUri: record.inviteeUri } : {},
2483
- ...typeof record.inviteeEmail === "string" && record.inviteeEmail ? { inviteeEmail: record.inviteeEmail } : {},
2484
- ...typeof record.startTime === "string" && record.startTime ? { startTime: record.startTime } : {}
2578
+ eventUri: record2.eventUri,
2579
+ ...typeof record2.inviteeUri === "string" && record2.inviteeUri ? { inviteeUri: record2.inviteeUri } : {},
2580
+ ...typeof record2.inviteeEmail === "string" && record2.inviteeEmail ? { inviteeEmail: record2.inviteeEmail } : {},
2581
+ ...typeof record2.startTime === "string" && record2.startTime ? { startTime: record2.startTime } : {}
2485
2582
  };
2486
2583
  } catch {
2487
2584
  return null;
@@ -2531,15 +2628,15 @@ function appendChatCollectiblePrompts(messages, requests) {
2531
2628
  }
2532
2629
  return next;
2533
2630
  }
2534
- function chatInputResponseForText(requests, text) {
2535
- const trimmed = text.trim();
2631
+ function chatInputResponseForText(requests, text2) {
2632
+ const trimmed = text2.trim();
2536
2633
  if (!trimmed) return null;
2537
2634
  const pending = requests.find(isChatCollectibleInputRequest);
2538
2635
  if (!pending) return null;
2539
2636
  return { requestId: pending.requestId, text: trimmed };
2540
2637
  }
2541
- function normalizeAssistantDedupeKey(text) {
2542
- return text.trim().replace(/\s+/g, " ").toLowerCase();
2638
+ function normalizeAssistantDedupeKey(text2) {
2639
+ return text2.trim().replace(/\s+/g, " ").toLowerCase();
2543
2640
  }
2544
2641
  function isNearDuplicateAssistantText(left, right) {
2545
2642
  const a = normalizeAssistantDedupeKey(left);
@@ -2553,13 +2650,14 @@ function isNearDuplicateAssistantText(left, right) {
2553
2650
  shorter.slice(0, Math.floor(shorter.length * 0.85))
2554
2651
  );
2555
2652
  }
2556
- function appendAgentTurnMessage(messages, displayText) {
2653
+ function appendAgentTurnMessage(messages, displayText, searchResults = []) {
2557
2654
  const trimmed = displayText.trim();
2558
- if (!trimmed) return [...messages];
2655
+ if (!trimmed && searchResults.length === 0) return [...messages];
2559
2656
  const agentMessage = {
2560
2657
  id: `agent-${Date.now()}`,
2561
2658
  role: "agent",
2562
2659
  text: trimmed,
2660
+ ...searchResults.length ? { searchResults } : {},
2563
2661
  createdAt: Date.now()
2564
2662
  };
2565
2663
  const last = messages.at(-1);
@@ -2938,7 +3036,14 @@ function useAgentChat({
2938
3036
  setState((prev) => ({
2939
3037
  ...prev,
2940
3038
  phase: (prev.pendingInputs ?? []).some(shouldRenderVisitorInputCard) ? "waiting-input" : "complete",
2941
- messages: appendAgentTurnMessage(prev.messages, displayText),
3039
+ messages: appendAgentTurnMessage(
3040
+ prev.messages,
3041
+ displayText,
3042
+ (prev.toolResults ?? []).filter((result) => result.kind === "search")
3043
+ ),
3044
+ toolResults: (prev.toolResults ?? []).filter(
3045
+ (result) => result.kind !== "search"
3046
+ ),
2942
3047
  toolSteps: completeActivePlanning(prev.toolSteps),
2943
3048
  streamingText: "",
2944
3049
  pendingOffer: bookingConfirmed ? null : capturedOffers.at(-1) ?? prev.pendingOffer,
@@ -3350,8 +3455,8 @@ import { useEffect as useEffect2, useLayoutEffect, useRef as useRef2, useState a
3350
3455
  import { createPortal } from "react-dom";
3351
3456
 
3352
3457
  // src/react/lib/speech.ts
3353
- function toSpeechText(text) {
3354
- let out = hideToolCardFences(text);
3458
+ function toSpeechText(text2) {
3459
+ let out = hideToolCardFences(text2);
3355
3460
  out = out.replace(/```[\s\S]*?```/g, " ");
3356
3461
  out = out.replace(/!\[([^\]]*)\]\([^)]*\)/g, "$1");
3357
3462
  out = out.replace(/\[([^\]]+)\]\([^)]*\)/g, "$1");
@@ -3696,12 +3801,12 @@ function StopIcon() {
3696
3801
  }
3697
3802
  ) });
3698
3803
  }
3699
- async function writeToClipboard(text) {
3804
+ async function writeToClipboard(text2) {
3700
3805
  try {
3701
- await navigator.clipboard.writeText(text);
3806
+ await navigator.clipboard.writeText(text2);
3702
3807
  } catch {
3703
3808
  const textarea = document.createElement("textarea");
3704
- textarea.value = text;
3809
+ textarea.value = text2;
3705
3810
  textarea.style.position = "fixed";
3706
3811
  textarea.style.opacity = "0";
3707
3812
  document.body.appendChild(textarea);
@@ -3969,6 +4074,48 @@ function MessageActions({
3969
4074
  // src/react/components/AgentRail/AgentRail.tsx
3970
4075
  import { useEffect as useEffect6, useRef as useRef6, useState as useState9 } from "react";
3971
4076
 
4077
+ // src/react/lib/agent-theme.ts
4078
+ function agentThemeStyle(theme, resolvedColorScheme) {
4079
+ const brandedTheme = { ...defaultAgentRailTheme, ...theme };
4080
+ const resolvedTheme = resolvedColorScheme === "dark" ? {
4081
+ ...brandedTheme,
4082
+ brand: theme?.brand ?? defaultDarkAgentRailTheme.brand,
4083
+ brandDeep: theme?.brandDeep ?? defaultDarkAgentRailTheme.brandDeep,
4084
+ brandSoft: theme?.brandSoft ?? `color-mix(in srgb, ${theme?.brand ?? defaultDarkAgentRailTheme.brand} 18%, ${defaultDarkAgentRailTheme.surface})`,
4085
+ border: theme?.border ?? defaultDarkAgentRailTheme.border,
4086
+ danger: theme?.danger ?? defaultDarkAgentRailTheme.danger,
4087
+ onBrand: theme?.onBrand ?? defaultDarkAgentRailTheme.onBrand,
4088
+ success: theme?.success ?? defaultDarkAgentRailTheme.success,
4089
+ surface: theme?.surface ?? defaultDarkAgentRailTheme.surface,
4090
+ surfaceMuted: theme?.surfaceMuted ?? defaultDarkAgentRailTheme.surfaceMuted,
4091
+ text: theme?.text ?? defaultDarkAgentRailTheme.text,
4092
+ textMuted: theme?.textMuted ?? defaultDarkAgentRailTheme.textMuted,
4093
+ textSubtle: theme?.textSubtle ?? defaultDarkAgentRailTheme.textSubtle,
4094
+ visitorBubble: theme?.visitorBubble ?? theme?.brand ?? defaultDarkAgentRailTheme.visitorBubble
4095
+ } : brandedTheme;
4096
+ return {
4097
+ "--rail-width": resolvedTheme.railMaxWidth,
4098
+ "--as-rail-max-width": resolvedTheme.railMaxWidth,
4099
+ "--as-brand": resolvedTheme.brand,
4100
+ "--as-brand-soft": resolvedTheme.brandSoft,
4101
+ "--as-brand-deep": resolvedTheme.brandDeep,
4102
+ "--as-surface": resolvedTheme.surface,
4103
+ "--as-surface-muted": resolvedTheme.surfaceMuted,
4104
+ "--as-text": resolvedTheme.text,
4105
+ "--as-text-muted": resolvedTheme.textMuted,
4106
+ "--as-text-subtle": resolvedTheme.textSubtle,
4107
+ "--as-border": resolvedTheme.border,
4108
+ "--as-visitor-bubble": resolvedTheme.visitorBubble,
4109
+ "--as-visitor-text": resolvedTheme.visitorText,
4110
+ "--as-on-brand": resolvedTheme.onBrand,
4111
+ "--as-success": resolvedTheme.success,
4112
+ "--as-danger": resolvedTheme.danger,
4113
+ "--as-font-body": resolvedTheme.fontBody,
4114
+ "--as-font-display": resolvedTheme.fontDisplay,
4115
+ colorScheme: resolvedColorScheme
4116
+ };
4117
+ }
4118
+
3972
4119
  // src/react/hooks/useAgentColorScheme.ts
3973
4120
  import { useSyncExternalStore } from "react";
3974
4121
  var DARK_MODE_QUERY = "(prefers-color-scheme: dark)";
@@ -4572,6 +4719,108 @@ function FollowUpChips({
4572
4719
  // src/react/components/MessageBubble/MessageBubble.tsx
4573
4720
  import { useState as useState6 } from "react";
4574
4721
 
4722
+ // src/react/components/SearchReferences/SearchReferences.tsx
4723
+ import { Fragment as Fragment2, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
4724
+ function SiteIcon() {
4725
+ return /* @__PURE__ */ jsxs6(
4726
+ "svg",
4727
+ {
4728
+ viewBox: "0 0 24 24",
4729
+ width: "18",
4730
+ height: "18",
4731
+ fill: "none",
4732
+ stroke: "currentColor",
4733
+ strokeWidth: "1.5",
4734
+ "aria-hidden": "true",
4735
+ children: [
4736
+ /* @__PURE__ */ jsx6("circle", { cx: "12", cy: "12", r: "9" }),
4737
+ /* @__PURE__ */ jsx6("ellipse", { cx: "12", cy: "12", rx: "4", ry: "9" }),
4738
+ /* @__PURE__ */ jsx6("path", { d: "M3 12h18M5 6.5h14M5 17.5h14" })
4739
+ ]
4740
+ }
4741
+ );
4742
+ }
4743
+ function SearchReferences({
4744
+ results
4745
+ }) {
4746
+ const seenSources = /* @__PURE__ */ new Set();
4747
+ const sources = results.flatMap((result) => result.sources).flatMap((source) => {
4748
+ const url = safeSearchUrl(source.url);
4749
+ const key = url ?? source.id;
4750
+ if (seenSources.has(key)) return [];
4751
+ seenSources.add(key);
4752
+ return [{ ...source, url, key }];
4753
+ });
4754
+ const seenActions = /* @__PURE__ */ new Set();
4755
+ const actions = results.flatMap((result) => {
4756
+ const url = safeSearchUrl(result.cta?.url);
4757
+ if (!url || !result.cta || seenActions.has(url)) return [];
4758
+ seenActions.add(url);
4759
+ return [{ label: result.cta.label, url }];
4760
+ });
4761
+ if (!sources.length && !actions.length) return null;
4762
+ return /* @__PURE__ */ jsxs6("div", { className: "search-references", children: [
4763
+ sources.length > 0 ? /* @__PURE__ */ jsxs6("section", { "aria-label": "Sources", children: [
4764
+ /* @__PURE__ */ jsxs6("h3", { className: "search-references__heading", children: [
4765
+ "Sources",
4766
+ /* @__PURE__ */ jsx6("span", { title: "Pages used by Search & Discovery", children: /* @__PURE__ */ jsxs6(
4767
+ "svg",
4768
+ {
4769
+ viewBox: "0 0 24 24",
4770
+ width: "14",
4771
+ height: "14",
4772
+ fill: "none",
4773
+ stroke: "currentColor",
4774
+ strokeWidth: "1.75",
4775
+ "aria-hidden": "true",
4776
+ children: [
4777
+ /* @__PURE__ */ jsx6("circle", { cx: "12", cy: "12", r: "9" }),
4778
+ /* @__PURE__ */ jsx6("path", { d: "M12 11v6M12 7v1" })
4779
+ ]
4780
+ }
4781
+ ) })
4782
+ ] }),
4783
+ /* @__PURE__ */ jsx6("ul", { className: "search-references__list", children: sources.map((source) => {
4784
+ const content = /* @__PURE__ */ jsxs6(Fragment2, { children: [
4785
+ /* @__PURE__ */ jsx6("span", { className: "search-references__icon", children: /* @__PURE__ */ jsx6(SiteIcon, {}) }),
4786
+ /* @__PURE__ */ jsxs6("span", { className: "search-references__copy", children: [
4787
+ /* @__PURE__ */ jsx6(
4788
+ "span",
4789
+ {
4790
+ className: "search-references__title",
4791
+ title: source.title,
4792
+ children: source.title
4793
+ }
4794
+ ),
4795
+ source.url ? /* @__PURE__ */ jsx6("span", { className: "search-references__domain", children: new URL(source.url).hostname.replace(/^www\./u, "") }) : null
4796
+ ] })
4797
+ ] });
4798
+ return /* @__PURE__ */ jsx6("li", { children: source.url ? /* @__PURE__ */ jsx6(
4799
+ "a",
4800
+ {
4801
+ className: "search-references__source",
4802
+ href: source.url,
4803
+ target: "_blank",
4804
+ rel: "noopener noreferrer",
4805
+ children: content
4806
+ }
4807
+ ) : /* @__PURE__ */ jsx6("div", { className: "search-references__source", children: content }) }, source.key);
4808
+ }) })
4809
+ ] }) : null,
4810
+ actions.length > 0 ? /* @__PURE__ */ jsx6("div", { className: "search-references__actions", children: actions.map((action) => /* @__PURE__ */ jsx6(
4811
+ "a",
4812
+ {
4813
+ className: "search-references__cta",
4814
+ href: action.url,
4815
+ target: "_blank",
4816
+ rel: "noopener noreferrer",
4817
+ children: action.label
4818
+ },
4819
+ action.url
4820
+ )) }) : null
4821
+ ] });
4822
+ }
4823
+
4575
4824
  // src/react/components/BookingCard/BookingCard.tsx
4576
4825
  import {
4577
4826
  useEffect as useEffect5,
@@ -4580,7 +4829,7 @@ import {
4580
4829
  useRef as useRef5,
4581
4830
  useState as useState5
4582
4831
  } from "react";
4583
- import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
4832
+ import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
4584
4833
  var BOOKING_STEPS = [
4585
4834
  { id: "date", label: "Date" },
4586
4835
  { id: "time", label: "Time" },
@@ -4611,7 +4860,7 @@ function calendarCells(year, month) {
4611
4860
  return cells;
4612
4861
  }
4613
4862
  function BookingCardLoader() {
4614
- return /* @__PURE__ */ jsx6("section", { className: "booking-card", "aria-label": "Book a meeting", children: /* @__PURE__ */ jsx6("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) });
4863
+ return /* @__PURE__ */ jsx7("section", { className: "booking-card", "aria-label": "Book a meeting", children: /* @__PURE__ */ jsx7("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) });
4615
4864
  }
4616
4865
  function BookingCard({
4617
4866
  disabled = false,
@@ -4710,14 +4959,14 @@ function BookingCard({
4710
4959
  })
4711
4960
  });
4712
4961
  }
4713
- return /* @__PURE__ */ jsx6(
4962
+ return /* @__PURE__ */ jsx7(
4714
4963
  "section",
4715
4964
  {
4716
4965
  className: "booking-card",
4717
4966
  "aria-busy": disabled || void 0,
4718
4967
  "aria-label": "Book a meeting",
4719
- children: /* @__PURE__ */ jsxs6("form", { className: "booking-card__form", onSubmit: handleSubmit, children: [
4720
- /* @__PURE__ */ jsx6("ol", { className: "booking-card__steps", "aria-label": "Booking steps", children: BOOKING_STEPS.map((item, index) => /* @__PURE__ */ jsxs6(
4968
+ children: /* @__PURE__ */ jsxs7("form", { className: "booking-card__form", onSubmit: handleSubmit, children: [
4969
+ /* @__PURE__ */ jsx7("ol", { className: "booking-card__steps", "aria-label": "Booking steps", children: BOOKING_STEPS.map((item, index) => /* @__PURE__ */ jsxs7(
4721
4970
  "li",
4722
4971
  {
4723
4972
  className: [
@@ -4727,40 +4976,40 @@ function BookingCard({
4727
4976
  ].filter(Boolean).join(" "),
4728
4977
  "aria-current": index === stepIndex ? "step" : void 0,
4729
4978
  children: [
4730
- /* @__PURE__ */ jsx6("span", { "aria-hidden": "true", children: index + 1 }),
4731
- /* @__PURE__ */ jsx6("span", { children: item.label })
4979
+ /* @__PURE__ */ jsx7("span", { "aria-hidden": "true", children: index + 1 }),
4980
+ /* @__PURE__ */ jsx7("span", { children: item.label })
4732
4981
  ]
4733
4982
  },
4734
4983
  item.id
4735
4984
  )) }),
4736
- step === "date" ? /* @__PURE__ */ jsxs6("div", { className: "booking-card__step", ref: activeStepRef, children: [
4737
- /* @__PURE__ */ jsx6("p", { className: "booking-card__title", children: selectedType?.name || "Pick a date" }),
4738
- timeZone ? /* @__PURE__ */ jsxs6("p", { className: "booking-card__tz", children: [
4985
+ step === "date" ? /* @__PURE__ */ jsxs7("div", { className: "booking-card__step", ref: activeStepRef, children: [
4986
+ /* @__PURE__ */ jsx7("p", { className: "booking-card__title", children: selectedType?.name || "Pick a date" }),
4987
+ timeZone ? /* @__PURE__ */ jsxs7("p", { className: "booking-card__tz", children: [
4739
4988
  "Times in ",
4740
4989
  timeZone
4741
4990
  ] }) : null,
4742
- offer.eventTypes.length > 1 ? /* @__PURE__ */ jsxs6(
4991
+ offer.eventTypes.length > 1 ? /* @__PURE__ */ jsxs7(
4743
4992
  "label",
4744
4993
  {
4745
4994
  className: "booking-card__field",
4746
4995
  htmlFor: `${fieldId}-type`,
4747
4996
  children: [
4748
- /* @__PURE__ */ jsx6("span", { children: "Meeting" }),
4749
- /* @__PURE__ */ jsx6(
4997
+ /* @__PURE__ */ jsx7("span", { children: "Meeting" }),
4998
+ /* @__PURE__ */ jsx7(
4750
4999
  "select",
4751
5000
  {
4752
5001
  id: `${fieldId}-type`,
4753
5002
  value: eventTypeUri,
4754
5003
  disabled,
4755
5004
  onChange: (event) => selectEventType(event.target.value),
4756
- children: offer.eventTypes.map((item) => /* @__PURE__ */ jsx6("option", { value: item.uri, children: item.name }, item.uri))
5005
+ children: offer.eventTypes.map((item) => /* @__PURE__ */ jsx7("option", { value: item.uri, children: item.name }, item.uri))
4757
5006
  }
4758
5007
  )
4759
5008
  ]
4760
5009
  }
4761
5010
  ) : null,
4762
- /* @__PURE__ */ jsxs6("div", { className: "booking-card__month", children: [
4763
- /* @__PURE__ */ jsx6(
5011
+ /* @__PURE__ */ jsxs7("div", { className: "booking-card__month", children: [
5012
+ /* @__PURE__ */ jsx7(
4764
5013
  "button",
4765
5014
  {
4766
5015
  type: "button",
@@ -4771,8 +5020,8 @@ function BookingCard({
4771
5020
  children: "\u2039"
4772
5021
  }
4773
5022
  ),
4774
- /* @__PURE__ */ jsx6("p", { className: "booking-card__month-title", children: formatMonthTitle(visibleMonth.year, visibleMonth.month) }),
4775
- /* @__PURE__ */ jsx6(
5023
+ /* @__PURE__ */ jsx7("p", { className: "booking-card__month-title", children: formatMonthTitle(visibleMonth.year, visibleMonth.month) }),
5024
+ /* @__PURE__ */ jsx7(
4776
5025
  "button",
4777
5026
  {
4778
5027
  type: "button",
@@ -4784,9 +5033,9 @@ function BookingCard({
4784
5033
  }
4785
5034
  )
4786
5035
  ] }),
4787
- /* @__PURE__ */ jsx6("div", { className: "booking-card__weekdays", children: weekdays.map((label) => /* @__PURE__ */ jsx6("span", { children: label }, label)) }),
4788
- offer.slots.length === 0 ? /* @__PURE__ */ jsx6("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) : null,
4789
- /* @__PURE__ */ jsx6(
5036
+ /* @__PURE__ */ jsx7("div", { className: "booking-card__weekdays", children: weekdays.map((label) => /* @__PURE__ */ jsx7("span", { children: label }, label)) }),
5037
+ offer.slots.length === 0 ? /* @__PURE__ */ jsx7("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) : null,
5038
+ /* @__PURE__ */ jsx7(
4790
5039
  "div",
4791
5040
  {
4792
5041
  className: "booking-card__calendar",
@@ -4794,7 +5043,7 @@ function BookingCard({
4794
5043
  "aria-label": "Available dates",
4795
5044
  children: cells.map((cell, index) => {
4796
5045
  if (!cell) {
4797
- return /* @__PURE__ */ jsx6(
5046
+ return /* @__PURE__ */ jsx7(
4798
5047
  "span",
4799
5048
  {
4800
5049
  className: "booking-card__day"
@@ -4804,7 +5053,7 @@ function BookingCard({
4804
5053
  }
4805
5054
  const available = availableByDate.has(cell.key);
4806
5055
  const selected = cell.key === selectedDate;
4807
- return /* @__PURE__ */ jsx6(
5056
+ return /* @__PURE__ */ jsx7(
4808
5057
  "button",
4809
5058
  {
4810
5059
  type: "button",
@@ -4824,9 +5073,9 @@ function BookingCard({
4824
5073
  }
4825
5074
  )
4826
5075
  ] }, "date") : null,
4827
- step === "time" ? /* @__PURE__ */ jsxs6("div", { className: "booking-card__step", ref: activeStepRef, children: [
4828
- /* @__PURE__ */ jsxs6("div", { className: "booking-card__step-bar", children: [
4829
- /* @__PURE__ */ jsx6(
5076
+ step === "time" ? /* @__PURE__ */ jsxs7("div", { className: "booking-card__step", ref: activeStepRef, children: [
5077
+ /* @__PURE__ */ jsxs7("div", { className: "booking-card__step-bar", children: [
5078
+ /* @__PURE__ */ jsx7(
4830
5079
  "button",
4831
5080
  {
4832
5081
  type: "button",
@@ -4837,15 +5086,15 @@ function BookingCard({
4837
5086
  children: "\u2039"
4838
5087
  }
4839
5088
  ),
4840
- /* @__PURE__ */ jsxs6("div", { children: [
4841
- /* @__PURE__ */ jsx6("p", { className: "booking-card__title", children: selectedSample ? formatLongDate(selectedSample) : "Pick a time" }),
4842
- timeZone ? /* @__PURE__ */ jsxs6("p", { className: "booking-card__tz", children: [
5089
+ /* @__PURE__ */ jsxs7("div", { children: [
5090
+ /* @__PURE__ */ jsx7("p", { className: "booking-card__title", children: selectedSample ? formatLongDate(selectedSample) : "Pick a time" }),
5091
+ timeZone ? /* @__PURE__ */ jsxs7("p", { className: "booking-card__tz", children: [
4843
5092
  "Times in ",
4844
5093
  timeZone
4845
5094
  ] }) : null
4846
5095
  ] })
4847
5096
  ] }),
4848
- /* @__PURE__ */ jsx6("div", { className: "booking-card__times", children: daySlots.map((slot) => /* @__PURE__ */ jsx6(
5097
+ /* @__PURE__ */ jsx7("div", { className: "booking-card__times", children: daySlots.map((slot) => /* @__PURE__ */ jsx7(
4849
5098
  "button",
4850
5099
  {
4851
5100
  type: "button",
@@ -4857,9 +5106,9 @@ function BookingCard({
4857
5106
  slot.startTime
4858
5107
  )) })
4859
5108
  ] }, "time") : null,
4860
- step === "details" ? /* @__PURE__ */ jsxs6("div", { className: "booking-card__step", ref: activeStepRef, children: [
4861
- /* @__PURE__ */ jsxs6("div", { className: "booking-card__step-bar", children: [
4862
- /* @__PURE__ */ jsx6(
5109
+ step === "details" ? /* @__PURE__ */ jsxs7("div", { className: "booking-card__step", ref: activeStepRef, children: [
5110
+ /* @__PURE__ */ jsxs7("div", { className: "booking-card__step-bar", children: [
5111
+ /* @__PURE__ */ jsx7(
4863
5112
  "button",
4864
5113
  {
4865
5114
  type: "button",
@@ -4870,21 +5119,21 @@ function BookingCard({
4870
5119
  children: "\u2039"
4871
5120
  }
4872
5121
  ),
4873
- /* @__PURE__ */ jsxs6("div", { children: [
4874
- /* @__PURE__ */ jsx6("p", { className: "booking-card__title", children: "Enter details" }),
4875
- /* @__PURE__ */ jsx6("p", { className: "booking-card__tz", children: formatSlotLabel(startTime) }),
4876
- selectedType?.location ? /* @__PURE__ */ jsx6("p", { className: "booking-card__tz", children: selectedType.location }) : null
5122
+ /* @__PURE__ */ jsxs7("div", { children: [
5123
+ /* @__PURE__ */ jsx7("p", { className: "booking-card__title", children: "Enter details" }),
5124
+ /* @__PURE__ */ jsx7("p", { className: "booking-card__tz", children: formatSlotLabel(startTime) }),
5125
+ selectedType?.location ? /* @__PURE__ */ jsx7("p", { className: "booking-card__tz", children: selectedType.location }) : null
4877
5126
  ] })
4878
5127
  ] }),
4879
- /* @__PURE__ */ jsxs6("div", { className: "booking-card__identity", children: [
4880
- /* @__PURE__ */ jsxs6(
5128
+ /* @__PURE__ */ jsxs7("div", { className: "booking-card__identity", children: [
5129
+ /* @__PURE__ */ jsxs7(
4881
5130
  "label",
4882
5131
  {
4883
5132
  className: "booking-card__field",
4884
5133
  htmlFor: `${fieldId}-name`,
4885
5134
  children: [
4886
- /* @__PURE__ */ jsx6("span", { children: "Name" }),
4887
- /* @__PURE__ */ jsx6(
5135
+ /* @__PURE__ */ jsx7("span", { children: "Name" }),
5136
+ /* @__PURE__ */ jsx7(
4888
5137
  "input",
4889
5138
  {
4890
5139
  id: `${fieldId}-name`,
@@ -4898,14 +5147,14 @@ function BookingCard({
4898
5147
  ]
4899
5148
  }
4900
5149
  ),
4901
- /* @__PURE__ */ jsxs6(
5150
+ /* @__PURE__ */ jsxs7(
4902
5151
  "label",
4903
5152
  {
4904
5153
  className: "booking-card__field",
4905
5154
  htmlFor: `${fieldId}-email`,
4906
5155
  children: [
4907
- /* @__PURE__ */ jsx6("span", { children: "Email" }),
4908
- /* @__PURE__ */ jsx6(
5156
+ /* @__PURE__ */ jsx7("span", { children: "Email" }),
5157
+ /* @__PURE__ */ jsx7(
4909
5158
  "input",
4910
5159
  {
4911
5160
  id: `${fieldId}-email`,
@@ -4921,7 +5170,7 @@ function BookingCard({
4921
5170
  }
4922
5171
  )
4923
5172
  ] }),
4924
- /* @__PURE__ */ jsx6(
5173
+ /* @__PURE__ */ jsx7(
4925
5174
  "button",
4926
5175
  {
4927
5176
  type: "submit",
@@ -4939,9 +5188,9 @@ function BookingCard({
4939
5188
  // src/react/components/MessageBubble/MessageBubble.tsx
4940
5189
  import { Streamdown } from "streamdown";
4941
5190
  import "streamdown/styles.css";
4942
- import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
4943
- function normalizeDedupeText(text) {
4944
- return text.trim().replace(/\s+/g, " ").toLowerCase();
5191
+ import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
5192
+ function normalizeDedupeText(text2) {
5193
+ return text2.trim().replace(/\s+/g, " ").toLowerCase();
4945
5194
  }
4946
5195
  function paragraphsAreNearDuplicates(first, second) {
4947
5196
  const left = normalizeDedupeText(first);
@@ -4957,8 +5206,8 @@ function paragraphsShareOpening(first, second) {
4957
5206
  if (!opening || opening.length < 20) return false;
4958
5207
  return second.trim().startsWith(opening);
4959
5208
  }
4960
- function collapseRepeatedText(text) {
4961
- const trimmed = text.trim();
5209
+ function collapseRepeatedText(text2) {
5210
+ const trimmed = text2.trim();
4962
5211
  if (trimmed.length < 40) return trimmed;
4963
5212
  const paragraphs = trimmed.split(/\n{2,}/u).map((part) => part.trim()).filter(Boolean);
4964
5213
  if (paragraphs.length === 2 && (paragraphsAreNearDuplicates(paragraphs[0], paragraphs[1]) || paragraphsShareOpening(paragraphs[0], paragraphs[1]))) {
@@ -4996,11 +5245,11 @@ function MessageBubble({
4996
5245
  offers.length > 0 ? sanitizeBookingOfferCopy(visibleText) : looksLikeBookingAvailabilityDump(visibleText) ? sanitizeBookingOfferCopy(visibleText) : visibleText || (isStreaming ? "" : message.text)
4997
5246
  );
4998
5247
  if (message.role === "visitor") {
4999
- return /* @__PURE__ */ jsx7("article", { className: "message-bubble message-bubble--visitor", children: /* @__PURE__ */ jsx7("p", { className: "message-bubble__text", children: message.text }) });
5248
+ return /* @__PURE__ */ jsx8("article", { className: "message-bubble message-bubble--visitor", children: /* @__PURE__ */ jsx8("p", { className: "message-bubble__text", children: message.text }) });
5000
5249
  }
5001
5250
  const citations = message.citations ?? [];
5002
- const agentText = /* @__PURE__ */ jsxs7("div", { className: "message-bubble__text", children: [
5003
- /* @__PURE__ */ jsx7(
5251
+ const agentText = /* @__PURE__ */ jsxs8("div", { className: "message-bubble__text", children: [
5252
+ /* @__PURE__ */ jsx8(
5004
5253
  Streamdown,
5005
5254
  {
5006
5255
  animated: isStreaming,
@@ -5014,8 +5263,9 @@ function MessageBubble({
5014
5263
  children: displayText
5015
5264
  }
5016
5265
  ),
5017
- citations.length > 0 ? /* @__PURE__ */ jsx7("ul", { className: "message-bubble__sources", "aria-label": "Sources", children: citations.map((citation) => /* @__PURE__ */ jsx7("li", { children: /* @__PURE__ */ jsxs7("a", { href: citation.url, target: "_blank", rel: "noreferrer", children: [
5018
- /* @__PURE__ */ jsx7(
5266
+ /* @__PURE__ */ jsx8(SearchReferences, { results: message.searchResults ?? [] }),
5267
+ citations.length > 0 ? /* @__PURE__ */ jsx8("ul", { className: "message-bubble__sources", "aria-label": "Sources", children: citations.map((citation) => /* @__PURE__ */ jsx8("li", { children: /* @__PURE__ */ jsxs8("a", { href: citation.url, target: "_blank", rel: "noreferrer", children: [
5268
+ /* @__PURE__ */ jsx8(
5019
5269
  "span",
5020
5270
  {
5021
5271
  className: "message-bubble__source-icon",
@@ -5023,12 +5273,12 @@ function MessageBubble({
5023
5273
  children: "\u25A6"
5024
5274
  }
5025
5275
  ),
5026
- /* @__PURE__ */ jsx7("span", { children: citation.label })
5276
+ /* @__PURE__ */ jsx8("span", { children: citation.label })
5027
5277
  ] }) }, citation.id)) }) : null
5028
5278
  ] });
5029
- return /* @__PURE__ */ jsxs7("article", { className: "message-bubble message-bubble--agent", children: [
5030
- displayText ? showBrandLogo ? /* @__PURE__ */ jsxs7("div", { className: "message-bubble__agent-row", children: [
5031
- /* @__PURE__ */ jsx7("span", { className: "message-bubble__agent-avatar", "aria-hidden": "true", children: /* @__PURE__ */ jsx7(
5279
+ return /* @__PURE__ */ jsxs8("article", { className: "message-bubble message-bubble--agent", children: [
5280
+ displayText || message.searchResults?.length ? showBrandLogo ? /* @__PURE__ */ jsxs8("div", { className: "message-bubble__agent-row", children: [
5281
+ /* @__PURE__ */ jsx8("span", { className: "message-bubble__agent-avatar", "aria-hidden": "true", children: /* @__PURE__ */ jsx8(
5032
5282
  "img",
5033
5283
  {
5034
5284
  src: resolvedLogoUrl,
@@ -5040,7 +5290,7 @@ function MessageBubble({
5040
5290
  ) }),
5041
5291
  agentText
5042
5292
  ] }) : agentText : null,
5043
- offers.map((nextOffer, index) => /* @__PURE__ */ jsx7(
5293
+ offers.map((nextOffer, index) => /* @__PURE__ */ jsx8(
5044
5294
  BookingCard,
5045
5295
  {
5046
5296
  disabled: bookingDisabled,
@@ -5056,7 +5306,7 @@ function MessageBubble({
5056
5306
  import { useState as useState8 } from "react";
5057
5307
 
5058
5308
  // src/react/components/ConfirmationCard/ConfirmationCard.tsx
5059
- import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
5309
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
5060
5310
  function ConfirmationCard({
5061
5311
  disabled = false,
5062
5312
  request,
@@ -5065,17 +5315,17 @@ function ConfirmationCard({
5065
5315
  const options = request.options ?? [];
5066
5316
  const heading = request.kind === "tool-approval" ? "Confirm this action" : request.prompt;
5067
5317
  const prompt = request.kind === "tool-approval" ? request.prompt : void 0;
5068
- return /* @__PURE__ */ jsxs8(
5318
+ return /* @__PURE__ */ jsxs9(
5069
5319
  "section",
5070
5320
  {
5071
5321
  className: "confirmation-card",
5072
5322
  "aria-labelledby": `confirmation-${request.requestId}`,
5073
5323
  children: [
5074
- /* @__PURE__ */ jsxs8("div", { className: "confirmation-card__heading", children: [
5075
- /* @__PURE__ */ jsx8("strong", { id: `confirmation-${request.requestId}`, children: heading }),
5076
- prompt ? /* @__PURE__ */ jsx8("p", { children: prompt }) : null
5324
+ /* @__PURE__ */ jsxs9("div", { className: "confirmation-card__heading", children: [
5325
+ /* @__PURE__ */ jsx9("strong", { id: `confirmation-${request.requestId}`, children: heading }),
5326
+ prompt ? /* @__PURE__ */ jsx9("p", { children: prompt }) : null
5077
5327
  ] }),
5078
- /* @__PURE__ */ jsx8("div", { className: "confirmation-card__actions", children: options.map((option) => /* @__PURE__ */ jsx8(
5328
+ /* @__PURE__ */ jsx9("div", { className: "confirmation-card__actions", children: options.map((option) => /* @__PURE__ */ jsx9(
5079
5329
  "button",
5080
5330
  {
5081
5331
  type: "button",
@@ -5096,7 +5346,7 @@ function ConfirmationCard({
5096
5346
 
5097
5347
  // src/react/components/ToolInputCard/ToolInputCard.tsx
5098
5348
  import { useState as useState7 } from "react";
5099
- import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
5349
+ import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
5100
5350
  function isRecord5(value) {
5101
5351
  return value !== null && typeof value === "object" && !Array.isArray(value);
5102
5352
  }
@@ -5220,7 +5470,7 @@ function FieldDescription({
5220
5470
  field,
5221
5471
  id
5222
5472
  }) {
5223
- return field.description ? /* @__PURE__ */ jsx9("span", { id, className: "tool-input-card__description", children: field.description }) : null;
5473
+ return field.description ? /* @__PURE__ */ jsx10("span", { id, className: "tool-input-card__description", children: field.description }) : null;
5224
5474
  }
5225
5475
  function ChoiceField({
5226
5476
  field,
@@ -5239,7 +5489,7 @@ function ChoiceField({
5239
5489
  const selectedIndex = options.findIndex(
5240
5490
  (option) => valuesMatch(option.value, value)
5241
5491
  );
5242
- return /* @__PURE__ */ jsxs9(
5492
+ return /* @__PURE__ */ jsxs10(
5243
5493
  "select",
5244
5494
  {
5245
5495
  id,
@@ -5254,13 +5504,13 @@ function ChoiceField({
5254
5504
  if (option) onChange(option.value);
5255
5505
  },
5256
5506
  children: [
5257
- /* @__PURE__ */ jsx9("option", { value: "", disabled: field.required, children: "Choose an option" }),
5258
- options.map((option, index) => /* @__PURE__ */ jsx9("option", { value: index, children: option.label }, optionKey(option)))
5507
+ /* @__PURE__ */ jsx10("option", { value: "", disabled: field.required, children: "Choose an option" }),
5508
+ options.map((option, index) => /* @__PURE__ */ jsx10("option", { value: index, children: option.label }, optionKey(option)))
5259
5509
  ]
5260
5510
  }
5261
5511
  );
5262
5512
  }
5263
- return /* @__PURE__ */ jsx9(
5513
+ return /* @__PURE__ */ jsx10(
5264
5514
  "div",
5265
5515
  {
5266
5516
  className: "tool-input-card__choices",
@@ -5271,8 +5521,8 @@ function ChoiceField({
5271
5521
  "aria-required": field.required,
5272
5522
  children: options.map((option, index) => {
5273
5523
  const checked = multiple ? selected.some((item) => valuesMatch(item, option.value)) : valuesMatch(value, option.value);
5274
- return /* @__PURE__ */ jsxs9("label", { className: "tool-input-card__choice", children: [
5275
- /* @__PURE__ */ jsx9(
5524
+ return /* @__PURE__ */ jsxs10("label", { className: "tool-input-card__choice", children: [
5525
+ /* @__PURE__ */ jsx10(
5276
5526
  "input",
5277
5527
  {
5278
5528
  type: multiple ? "checkbox" : "radio",
@@ -5294,7 +5544,7 @@ function ChoiceField({
5294
5544
  }
5295
5545
  }
5296
5546
  ),
5297
- /* @__PURE__ */ jsx9("span", { children: option.label })
5547
+ /* @__PURE__ */ jsx10("span", { children: option.label })
5298
5548
  ] }, optionKey(option));
5299
5549
  })
5300
5550
  }
@@ -5314,9 +5564,9 @@ function ToolField({
5314
5564
  error ? `${id}-error` : ""
5315
5565
  ].filter(Boolean).join(" ");
5316
5566
  if (field.kind === "checkbox" || field.kind === "confirmation") {
5317
- return /* @__PURE__ */ jsxs9("div", { className: "tool-input-card__field", children: [
5318
- /* @__PURE__ */ jsxs9("label", { className: "tool-input-card__check", htmlFor: id, children: [
5319
- /* @__PURE__ */ jsx9(
5567
+ return /* @__PURE__ */ jsxs10("div", { className: "tool-input-card__field", children: [
5568
+ /* @__PURE__ */ jsxs10("label", { className: "tool-input-card__check", htmlFor: id, children: [
5569
+ /* @__PURE__ */ jsx10(
5320
5570
  "input",
5321
5571
  {
5322
5572
  id,
@@ -5329,17 +5579,17 @@ function ToolField({
5329
5579
  onChange: (event) => onChange(event.target.checked)
5330
5580
  }
5331
5581
  ),
5332
- /* @__PURE__ */ jsxs9("span", { children: [
5333
- /* @__PURE__ */ jsx9("strong", { children: field.label }),
5334
- field.description ? /* @__PURE__ */ jsx9("span", { id: `${id}-description`, children: field.description }) : null
5582
+ /* @__PURE__ */ jsxs10("span", { children: [
5583
+ /* @__PURE__ */ jsx10("strong", { children: field.label }),
5584
+ field.description ? /* @__PURE__ */ jsx10("span", { id: `${id}-description`, children: field.description }) : null
5335
5585
  ] })
5336
5586
  ] }),
5337
- error ? /* @__PURE__ */ jsx9("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
5587
+ error ? /* @__PURE__ */ jsx10("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
5338
5588
  ] });
5339
5589
  }
5340
- const label = /* @__PURE__ */ jsxs9("label", { id: `${id}-label`, htmlFor: id, children: [
5590
+ const label = /* @__PURE__ */ jsxs10("label", { id: `${id}-label`, htmlFor: id, children: [
5341
5591
  field.label,
5342
- field.required ? /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", children: " *" }) : null
5592
+ field.required ? /* @__PURE__ */ jsx10("span", { "aria-hidden": "true", children: " *" }) : null
5343
5593
  ] });
5344
5594
  const common = {
5345
5595
  id,
@@ -5351,7 +5601,7 @@ function ToolField({
5351
5601
  };
5352
5602
  let control;
5353
5603
  if (field.kind === "select" || field.kind === "radio" || field.kind === "multi-select") {
5354
- control = /* @__PURE__ */ jsx9(
5604
+ control = /* @__PURE__ */ jsx10(
5355
5605
  ChoiceField,
5356
5606
  {
5357
5607
  field,
@@ -5365,7 +5615,7 @@ function ToolField({
5365
5615
  }
5366
5616
  );
5367
5617
  } else if (field.kind === "textarea" || field.kind === "json") {
5368
- control = /* @__PURE__ */ jsx9(
5618
+ control = /* @__PURE__ */ jsx10(
5369
5619
  "textarea",
5370
5620
  {
5371
5621
  ...common,
@@ -5379,8 +5629,8 @@ function ToolField({
5379
5629
  );
5380
5630
  } else if (field.kind === "range") {
5381
5631
  const numericValue = typeof value === "number" ? value : field.min ?? 0;
5382
- control = /* @__PURE__ */ jsxs9("div", { className: "tool-input-card__range", children: [
5383
- /* @__PURE__ */ jsx9(
5632
+ control = /* @__PURE__ */ jsxs10("div", { className: "tool-input-card__range", children: [
5633
+ /* @__PURE__ */ jsx10(
5384
5634
  "input",
5385
5635
  {
5386
5636
  ...common,
@@ -5392,11 +5642,11 @@ function ToolField({
5392
5642
  onChange: (event) => onChange(Number(event.target.value))
5393
5643
  }
5394
5644
  ),
5395
- /* @__PURE__ */ jsx9("output", { htmlFor: id, children: numericValue })
5645
+ /* @__PURE__ */ jsx10("output", { htmlFor: id, children: numericValue })
5396
5646
  ] });
5397
5647
  } else {
5398
5648
  const type = field.kind === "date-time" ? "datetime-local" : field.kind === "calendar" ? "date" : field.kind;
5399
- control = /* @__PURE__ */ jsx9(
5649
+ control = /* @__PURE__ */ jsx10(
5400
5650
  "input",
5401
5651
  {
5402
5652
  ...common,
@@ -5414,11 +5664,11 @@ function ToolField({
5414
5664
  }
5415
5665
  );
5416
5666
  }
5417
- return /* @__PURE__ */ jsxs9("div", { className: "tool-input-card__field", children: [
5667
+ return /* @__PURE__ */ jsxs10("div", { className: "tool-input-card__field", children: [
5418
5668
  label,
5419
- /* @__PURE__ */ jsx9(FieldDescription, { field, id: `${id}-description` }),
5669
+ /* @__PURE__ */ jsx10(FieldDescription, { field, id: `${id}-description` }),
5420
5670
  control,
5421
- error ? /* @__PURE__ */ jsx9("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
5671
+ error ? /* @__PURE__ */ jsx10("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
5422
5672
  ] });
5423
5673
  }
5424
5674
  function ToolInputCard({
@@ -5455,14 +5705,14 @@ function ToolInputCard({
5455
5705
  onSubmit?.(surface, result);
5456
5706
  }
5457
5707
  if (submitted) {
5458
- return /* @__PURE__ */ jsxs9(
5708
+ return /* @__PURE__ */ jsxs10(
5459
5709
  "section",
5460
5710
  {
5461
5711
  className: "tool-input-card tool-input-card--submitted",
5462
5712
  role: "status",
5463
5713
  children: [
5464
- /* @__PURE__ */ jsx9("span", { "aria-hidden": "true", children: "\u2713" }),
5465
- /* @__PURE__ */ jsxs9("strong", { children: [
5714
+ /* @__PURE__ */ jsx10("span", { "aria-hidden": "true", children: "\u2713" }),
5715
+ /* @__PURE__ */ jsxs10("strong", { children: [
5466
5716
  surface.title,
5467
5717
  " submitted"
5468
5718
  ] })
@@ -5470,18 +5720,18 @@ function ToolInputCard({
5470
5720
  }
5471
5721
  );
5472
5722
  }
5473
- return /* @__PURE__ */ jsxs9(
5723
+ return /* @__PURE__ */ jsxs10(
5474
5724
  "section",
5475
5725
  {
5476
5726
  className: "tool-input-card",
5477
5727
  "aria-labelledby": `tool-input-${surface.id}`,
5478
5728
  children: [
5479
- /* @__PURE__ */ jsxs9("div", { className: "tool-input-card__heading", children: [
5480
- /* @__PURE__ */ jsx9("strong", { id: `tool-input-${surface.id}`, children: surface.title }),
5481
- surface.description ? /* @__PURE__ */ jsx9("p", { children: surface.description }) : null
5729
+ /* @__PURE__ */ jsxs10("div", { className: "tool-input-card__heading", children: [
5730
+ /* @__PURE__ */ jsx10("strong", { id: `tool-input-${surface.id}`, children: surface.title }),
5731
+ surface.description ? /* @__PURE__ */ jsx10("p", { children: surface.description }) : null
5482
5732
  ] }),
5483
- /* @__PURE__ */ jsxs9("form", { noValidate: true, onSubmit: submit, children: [
5484
- /* @__PURE__ */ jsx9("div", { className: "tool-input-card__fields", children: surface.fields.map((field, index) => /* @__PURE__ */ jsx9(
5733
+ /* @__PURE__ */ jsxs10("form", { noValidate: true, onSubmit: submit, children: [
5734
+ /* @__PURE__ */ jsx10("div", { className: "tool-input-card__fields", children: surface.fields.map((field, index) => /* @__PURE__ */ jsx10(
5485
5735
  ToolField,
5486
5736
  {
5487
5737
  disabled,
@@ -5494,8 +5744,8 @@ function ToolInputCard({
5494
5744
  },
5495
5745
  field.path
5496
5746
  )) }),
5497
- /* @__PURE__ */ jsxs9("div", { className: "tool-input-card__actions", children: [
5498
- surface.actions?.some((action) => action.id === "reset") ? /* @__PURE__ */ jsx9(
5747
+ /* @__PURE__ */ jsxs10("div", { className: "tool-input-card__actions", children: [
5748
+ surface.actions?.some((action) => action.id === "reset") ? /* @__PURE__ */ jsx10(
5499
5749
  "button",
5500
5750
  {
5501
5751
  type: "button",
@@ -5508,7 +5758,7 @@ function ToolInputCard({
5508
5758
  children: surface.actions.find((action) => action.id === "reset")?.label ?? "Clear"
5509
5759
  }
5510
5760
  ) : null,
5511
- /* @__PURE__ */ jsx9("button", { type: "submit", disabled, children: surface.submitLabel ?? surface.actions?.find((action) => action.id === "submit")?.label ?? "Continue" })
5761
+ /* @__PURE__ */ jsx10("button", { type: "submit", disabled, children: surface.submitLabel ?? surface.actions?.find((action) => action.id === "submit")?.label ?? "Continue" })
5512
5762
  ] })
5513
5763
  ] })
5514
5764
  ]
@@ -5517,17 +5767,17 @@ function ToolInputCard({
5517
5767
  }
5518
5768
 
5519
5769
  // src/react/components/HumanInputCard/HumanInputCard.tsx
5520
- import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
5770
+ import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
5521
5771
  function HumanInputCard({
5522
5772
  disabled = false,
5523
5773
  request,
5524
5774
  onRespond
5525
5775
  }) {
5526
- const [text, setText] = useState8("");
5776
+ const [text2, setText] = useState8("");
5527
5777
  const options = request.options ?? [];
5528
5778
  const showText = request.display === "text" || request.allowFreeform && options.length === 0;
5529
5779
  if (request.ui) {
5530
- return /* @__PURE__ */ jsx10(
5780
+ return /* @__PURE__ */ jsx11(
5531
5781
  ToolInputCard,
5532
5782
  {
5533
5783
  disabled,
@@ -5537,7 +5787,7 @@ function HumanInputCard({
5537
5787
  );
5538
5788
  }
5539
5789
  if (options.length > 0) {
5540
- return /* @__PURE__ */ jsx10(
5790
+ return /* @__PURE__ */ jsx11(
5541
5791
  ConfirmationCard,
5542
5792
  {
5543
5793
  disabled,
@@ -5548,62 +5798,62 @@ function HumanInputCard({
5548
5798
  }
5549
5799
  function submitText(event) {
5550
5800
  event.preventDefault();
5551
- const value = text.trim();
5801
+ const value = text2.trim();
5552
5802
  if (!value || disabled) return;
5553
5803
  onRespond?.({ requestId: request.requestId, text: value });
5554
5804
  }
5555
- return /* @__PURE__ */ jsxs10(
5805
+ return /* @__PURE__ */ jsxs11(
5556
5806
  "section",
5557
5807
  {
5558
5808
  className: "human-input-card",
5559
5809
  "aria-labelledby": `human-input-${request.requestId}`,
5560
5810
  children: [
5561
- /* @__PURE__ */ jsx10("div", { className: "human-input-card__heading", children: /* @__PURE__ */ jsx10("strong", { id: `human-input-${request.requestId}`, children: request.prompt }) }),
5562
- showText ? /* @__PURE__ */ jsxs10("form", { onSubmit: submitText, children: [
5563
- /* @__PURE__ */ jsx10("label", { htmlFor: `human-input-text-${request.requestId}`, children: "Response" }),
5564
- /* @__PURE__ */ jsxs10("div", { children: [
5565
- /* @__PURE__ */ jsx10(
5811
+ /* @__PURE__ */ jsx11("div", { className: "human-input-card__heading", children: /* @__PURE__ */ jsx11("strong", { id: `human-input-${request.requestId}`, children: request.prompt }) }),
5812
+ showText ? /* @__PURE__ */ jsxs11("form", { onSubmit: submitText, children: [
5813
+ /* @__PURE__ */ jsx11("label", { htmlFor: `human-input-text-${request.requestId}`, children: "Response" }),
5814
+ /* @__PURE__ */ jsxs11("div", { children: [
5815
+ /* @__PURE__ */ jsx11(
5566
5816
  "input",
5567
5817
  {
5568
5818
  id: `human-input-text-${request.requestId}`,
5569
- value: text,
5819
+ value: text2,
5570
5820
  disabled,
5571
5821
  onChange: (event) => setText(event.target.value)
5572
5822
  }
5573
5823
  ),
5574
- /* @__PURE__ */ jsx10("button", { type: "submit", disabled: disabled || !text.trim(), children: "Send" })
5824
+ /* @__PURE__ */ jsx11("button", { type: "submit", disabled: disabled || !text2.trim(), children: "Send" })
5575
5825
  ] })
5576
5826
  ] }) : null,
5577
- !showText && options.length === 0 ? /* @__PURE__ */ jsx10("p", { className: "human-input-card__unavailable", role: "status", children: "This request can\u2019t be answered here." }) : null
5827
+ !showText && options.length === 0 ? /* @__PURE__ */ jsx11("p", { className: "human-input-card__unavailable", role: "status", children: "This request can\u2019t be answered here." }) : null
5578
5828
  ]
5579
5829
  }
5580
5830
  );
5581
5831
  }
5582
5832
 
5583
5833
  // src/react/components/CollectionResultCard/CollectionResultCard.tsx
5584
- import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
5834
+ import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
5585
5835
  function CollectionResultCard({
5586
5836
  result
5587
5837
  }) {
5588
5838
  const empty = result.items.length === 0;
5589
- return /* @__PURE__ */ jsxs11(
5839
+ return /* @__PURE__ */ jsxs12(
5590
5840
  "section",
5591
5841
  {
5592
5842
  className: `collection-result-card tool-result-card tool-result-card--${result.status}`,
5593
5843
  "aria-label": result.title,
5594
5844
  children: [
5595
- /* @__PURE__ */ jsxs11("div", { className: "tool-result-card__heading", children: [
5596
- /* @__PURE__ */ jsx11("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
5597
- /* @__PURE__ */ jsx11("strong", { children: result.title })
5845
+ /* @__PURE__ */ jsxs12("div", { className: "tool-result-card__heading", children: [
5846
+ /* @__PURE__ */ jsx12("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
5847
+ /* @__PURE__ */ jsx12("strong", { children: result.title })
5598
5848
  ] }),
5599
- empty ? /* @__PURE__ */ jsx11("p", { className: "collection-result-card__empty", children: "No matching record for the email you shared." }) : /* @__PURE__ */ jsx11("ul", { className: "collection-result-card__list", children: result.items.map((item) => /* @__PURE__ */ jsxs11("li", { children: [
5600
- /* @__PURE__ */ jsx11("div", { className: "collection-result-card__item-title", children: item.title }),
5601
- item.description ? /* @__PURE__ */ jsx11("p", { children: item.description }) : null,
5602
- item.details?.length ? /* @__PURE__ */ jsx11("dl", { children: item.details.map((detail) => /* @__PURE__ */ jsxs11("div", { children: [
5603
- /* @__PURE__ */ jsx11("dt", { children: detail.label }),
5604
- /* @__PURE__ */ jsx11("dd", { children: detail.value })
5849
+ empty ? /* @__PURE__ */ jsx12("p", { className: "collection-result-card__empty", children: "No matching record for the email you shared." }) : /* @__PURE__ */ jsx12("ul", { className: "collection-result-card__list", children: result.items.map((item) => /* @__PURE__ */ jsxs12("li", { children: [
5850
+ /* @__PURE__ */ jsx12("div", { className: "collection-result-card__item-title", children: item.title }),
5851
+ item.description ? /* @__PURE__ */ jsx12("p", { children: item.description }) : null,
5852
+ item.details?.length ? /* @__PURE__ */ jsx12("dl", { children: item.details.map((detail) => /* @__PURE__ */ jsxs12("div", { children: [
5853
+ /* @__PURE__ */ jsx12("dt", { children: detail.label }),
5854
+ /* @__PURE__ */ jsx12("dd", { children: detail.value })
5605
5855
  ] }, `${detail.label}:${detail.value}`)) }) : null,
5606
- item.href ? /* @__PURE__ */ jsx11("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
5856
+ item.href ? /* @__PURE__ */ jsx12("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
5607
5857
  ] }, item.title)) })
5608
5858
  ]
5609
5859
  }
@@ -5611,26 +5861,26 @@ function CollectionResultCard({
5611
5861
  }
5612
5862
 
5613
5863
  // src/react/components/EntityResultCard/EntityResultCard.tsx
5614
- import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
5864
+ import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
5615
5865
  function EntityResultCard({
5616
5866
  result
5617
5867
  }) {
5618
- return /* @__PURE__ */ jsxs12(
5868
+ return /* @__PURE__ */ jsxs13(
5619
5869
  "section",
5620
5870
  {
5621
5871
  className: `entity-result-card tool-result-card tool-result-card--${result.status}`,
5622
5872
  "aria-label": result.title,
5623
5873
  children: [
5624
- /* @__PURE__ */ jsxs12("div", { className: "tool-result-card__heading", children: [
5625
- /* @__PURE__ */ jsx12("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
5626
- /* @__PURE__ */ jsx12("strong", { children: result.title })
5874
+ /* @__PURE__ */ jsxs13("div", { className: "tool-result-card__heading", children: [
5875
+ /* @__PURE__ */ jsx13("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
5876
+ /* @__PURE__ */ jsx13("strong", { children: result.title })
5627
5877
  ] }),
5628
- result.description ? /* @__PURE__ */ jsx12("p", { children: result.description }) : null,
5629
- result.details?.length ? /* @__PURE__ */ jsx12("dl", { children: result.details.map((detail) => /* @__PURE__ */ jsxs12("div", { children: [
5630
- /* @__PURE__ */ jsx12("dt", { children: detail.label }),
5631
- /* @__PURE__ */ jsx12("dd", { children: detail.value })
5878
+ result.description ? /* @__PURE__ */ jsx13("p", { children: result.description }) : null,
5879
+ result.details?.length ? /* @__PURE__ */ jsx13("dl", { children: result.details.map((detail) => /* @__PURE__ */ jsxs13("div", { children: [
5880
+ /* @__PURE__ */ jsx13("dt", { children: detail.label }),
5881
+ /* @__PURE__ */ jsx13("dd", { children: detail.value })
5632
5882
  ] }, `${detail.label}:${detail.value}`)) }) : null,
5633
- result.links?.length ? /* @__PURE__ */ jsx12("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ jsx12(
5883
+ result.links?.length ? /* @__PURE__ */ jsx13("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ jsx13(
5634
5884
  "a",
5635
5885
  {
5636
5886
  href: link.href,
@@ -5646,24 +5896,24 @@ function EntityResultCard({
5646
5896
  }
5647
5897
 
5648
5898
  // src/react/components/SignatureResultCard/SignatureResultCard.tsx
5649
- import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
5899
+ import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
5650
5900
  function SignatureResultCard({
5651
5901
  result
5652
5902
  }) {
5653
5903
  const primaryLink = result.links?.[0];
5654
- return /* @__PURE__ */ jsxs13(
5904
+ return /* @__PURE__ */ jsxs14(
5655
5905
  "section",
5656
5906
  {
5657
5907
  className: `signature-result-card tool-result-card tool-result-card--${result.status}`,
5658
5908
  "aria-label": result.title,
5659
5909
  children: [
5660
- /* @__PURE__ */ jsxs13("div", { className: "tool-result-card__heading", children: [
5661
- /* @__PURE__ */ jsx13("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
5662
- /* @__PURE__ */ jsx13("strong", { children: result.title })
5910
+ /* @__PURE__ */ jsxs14("div", { className: "tool-result-card__heading", children: [
5911
+ /* @__PURE__ */ jsx14("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
5912
+ /* @__PURE__ */ jsx14("strong", { children: result.title })
5663
5913
  ] }),
5664
- result.statusLabel ? /* @__PURE__ */ jsx13("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
5665
- result.description ? /* @__PURE__ */ jsx13("p", { children: result.description }) : null,
5666
- primaryLink ? /* @__PURE__ */ jsx13(
5914
+ result.statusLabel ? /* @__PURE__ */ jsx14("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
5915
+ result.description ? /* @__PURE__ */ jsx14("p", { children: result.description }) : null,
5916
+ primaryLink ? /* @__PURE__ */ jsx14(
5667
5917
  "a",
5668
5918
  {
5669
5919
  className: "signature-result-card__cta",
@@ -5679,26 +5929,26 @@ function SignatureResultCard({
5679
5929
  }
5680
5930
 
5681
5931
  // src/react/components/ToolResultCard/ToolResultCard.tsx
5682
- import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
5932
+ import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
5683
5933
  function ToolResultCard({
5684
5934
  result
5685
5935
  }) {
5686
- return /* @__PURE__ */ jsxs14(
5936
+ return /* @__PURE__ */ jsxs15(
5687
5937
  "section",
5688
5938
  {
5689
5939
  className: `tool-result-card tool-result-card--${result.status}`,
5690
5940
  "aria-label": result.title,
5691
5941
  children: [
5692
- /* @__PURE__ */ jsxs14("div", { className: "tool-result-card__heading", children: [
5693
- /* @__PURE__ */ jsx14("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
5694
- /* @__PURE__ */ jsx14("strong", { children: result.title })
5942
+ /* @__PURE__ */ jsxs15("div", { className: "tool-result-card__heading", children: [
5943
+ /* @__PURE__ */ jsx15("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
5944
+ /* @__PURE__ */ jsx15("strong", { children: result.title })
5695
5945
  ] }),
5696
- result.description ? /* @__PURE__ */ jsx14("p", { children: result.description }) : null,
5697
- result.details?.length ? /* @__PURE__ */ jsx14("dl", { children: result.details.map((detail) => /* @__PURE__ */ jsxs14("div", { children: [
5698
- /* @__PURE__ */ jsx14("dt", { children: detail.label }),
5699
- /* @__PURE__ */ jsx14("dd", { children: detail.value })
5946
+ result.description ? /* @__PURE__ */ jsx15("p", { children: result.description }) : null,
5947
+ result.details?.length ? /* @__PURE__ */ jsx15("dl", { children: result.details.map((detail) => /* @__PURE__ */ jsxs15("div", { children: [
5948
+ /* @__PURE__ */ jsx15("dt", { children: detail.label }),
5949
+ /* @__PURE__ */ jsx15("dd", { children: detail.value })
5700
5950
  ] }, `${detail.label}:${detail.value}`)) }) : null,
5701
- result.links?.length ? /* @__PURE__ */ jsx14("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ jsx14(
5951
+ result.links?.length ? /* @__PURE__ */ jsx15("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ jsx15(
5702
5952
  "a",
5703
5953
  {
5704
5954
  href: link.href,
@@ -5714,14 +5964,14 @@ function ToolResultCard({
5714
5964
  }
5715
5965
 
5716
5966
  // src/react/components/VisitorToolResultView/VisitorToolResultView.tsx
5717
- import { jsx as jsx15 } from "react/jsx-runtime";
5967
+ import { jsx as jsx16 } from "react/jsx-runtime";
5718
5968
  function VisitorToolResultView({
5719
5969
  disabled = false,
5720
5970
  onToolInput,
5721
5971
  result
5722
5972
  }) {
5723
5973
  if (result.kind === "input") {
5724
- return /* @__PURE__ */ jsx15(
5974
+ return /* @__PURE__ */ jsx16(
5725
5975
  ToolInputCard,
5726
5976
  {
5727
5977
  disabled,
@@ -5731,16 +5981,16 @@ function VisitorToolResultView({
5731
5981
  );
5732
5982
  }
5733
5983
  if (result.kind === "entity") {
5734
- return /* @__PURE__ */ jsx15(EntityResultCard, { result });
5984
+ return /* @__PURE__ */ jsx16(EntityResultCard, { result });
5735
5985
  }
5736
5986
  if (result.kind === "collection") {
5737
- return /* @__PURE__ */ jsx15(CollectionResultCard, { result });
5987
+ return /* @__PURE__ */ jsx16(CollectionResultCard, { result });
5738
5988
  }
5739
5989
  if (result.kind === "signature") {
5740
- return /* @__PURE__ */ jsx15(SignatureResultCard, { result });
5990
+ return /* @__PURE__ */ jsx16(SignatureResultCard, { result });
5741
5991
  }
5742
5992
  if (result.kind === "summary") {
5743
- return /* @__PURE__ */ jsx15(ToolResultCard, { result });
5993
+ return /* @__PURE__ */ jsx16(ToolResultCard, { result });
5744
5994
  }
5745
5995
  return null;
5746
5996
  }
@@ -5749,9 +5999,9 @@ function isRenderableVisitorToolResult(result) {
5749
5999
  }
5750
6000
 
5751
6001
  // src/react/components/AgentRail/AgentRail.tsx
5752
- import { Fragment as Fragment2, jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
6002
+ import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
5753
6003
  function MinimizeIcon() {
5754
- return /* @__PURE__ */ jsx16("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx16(
6004
+ return /* @__PURE__ */ jsx17("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
5755
6005
  "path",
5756
6006
  {
5757
6007
  d: "M3.5 8h9",
@@ -5762,7 +6012,7 @@ function MinimizeIcon() {
5762
6012
  ) });
5763
6013
  }
5764
6014
  function CloseIcon2() {
5765
- return /* @__PURE__ */ jsx16("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx16(
6015
+ return /* @__PURE__ */ jsx17("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
5766
6016
  "path",
5767
6017
  {
5768
6018
  d: "M4 4l8 8M12 4l-8 8",
@@ -5773,7 +6023,7 @@ function CloseIcon2() {
5773
6023
  ) });
5774
6024
  }
5775
6025
  function NewChatIcon() {
5776
- return /* @__PURE__ */ jsx16("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx16(
6026
+ return /* @__PURE__ */ jsx17("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
5777
6027
  "path",
5778
6028
  {
5779
6029
  d: "M9.5 3.5h3v3M12.25 3.75 8 8M7 4H4.5A1.5 1.5 0 0 0 3 5.5v6A1.5 1.5 0 0 0 4.5 13h6a1.5 1.5 0 0 0 1.5-1.5V9",
@@ -5785,7 +6035,7 @@ function NewChatIcon() {
5785
6035
  ) });
5786
6036
  }
5787
6037
  function ExpandIcon() {
5788
- return /* @__PURE__ */ jsx16("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx16(
6038
+ return /* @__PURE__ */ jsx17("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
5789
6039
  "path",
5790
6040
  {
5791
6041
  d: "M6 3.5H3.5V6M10 3.5h2.5V6M10 12.5h2.5V10M6 12.5H3.5V10",
@@ -5797,7 +6047,7 @@ function ExpandIcon() {
5797
6047
  ) });
5798
6048
  }
5799
6049
  function RestoreIcon() {
5800
- return /* @__PURE__ */ jsx16("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx16(
6050
+ return /* @__PURE__ */ jsx17("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
5801
6051
  "path",
5802
6052
  {
5803
6053
  d: "M5.5 5.5H3.5V7.5M10.5 5.5h2V7.5M10.5 10.5h2V8.5M5.5 10.5H3.5V8.5",
@@ -5809,7 +6059,7 @@ function RestoreIcon() {
5809
6059
  ) });
5810
6060
  }
5811
6061
  function ChevronDownIcon() {
5812
- return /* @__PURE__ */ jsx16("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx16(
6062
+ return /* @__PURE__ */ jsx17("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
5813
6063
  "path",
5814
6064
  {
5815
6065
  d: "M4 6.5l4 4 4-4",
@@ -5862,44 +6112,7 @@ function AgentRail({
5862
6112
  const [failedLogoUrl, setFailedLogoUrl] = useState9(null);
5863
6113
  const showBrandLogo = Boolean(resolvedBrandLogoUrl) && failedLogoUrl !== resolvedBrandLogoUrl;
5864
6114
  const resolvedColorScheme = useAgentColorScheme(colorScheme);
5865
- const brandedTheme = { ...defaultAgentRailTheme, ...theme };
5866
- const resolvedTheme = resolvedColorScheme === "dark" ? {
5867
- ...brandedTheme,
5868
- brand: theme?.brand ?? defaultDarkAgentRailTheme.brand,
5869
- brandDeep: theme?.brandDeep ?? defaultDarkAgentRailTheme.brandDeep,
5870
- brandSoft: theme?.brandSoft ?? `color-mix(in srgb, ${theme?.brand ?? defaultDarkAgentRailTheme.brand} 18%, ${defaultDarkAgentRailTheme.surface})`,
5871
- border: theme?.border ?? defaultDarkAgentRailTheme.border,
5872
- danger: theme?.danger ?? defaultDarkAgentRailTheme.danger,
5873
- onBrand: theme?.onBrand ?? defaultDarkAgentRailTheme.onBrand,
5874
- success: theme?.success ?? defaultDarkAgentRailTheme.success,
5875
- surface: theme?.surface ?? defaultDarkAgentRailTheme.surface,
5876
- surfaceMuted: theme?.surfaceMuted ?? defaultDarkAgentRailTheme.surfaceMuted,
5877
- text: theme?.text ?? defaultDarkAgentRailTheme.text,
5878
- textMuted: theme?.textMuted ?? defaultDarkAgentRailTheme.textMuted,
5879
- textSubtle: theme?.textSubtle ?? defaultDarkAgentRailTheme.textSubtle,
5880
- visitorBubble: theme?.visitorBubble ?? theme?.brand ?? defaultDarkAgentRailTheme.visitorBubble
5881
- } : brandedTheme;
5882
- const railStyle = {
5883
- "--rail-width": resolvedTheme.railMaxWidth,
5884
- "--as-rail-max-width": resolvedTheme.railMaxWidth,
5885
- "--as-brand": resolvedTheme.brand,
5886
- "--as-brand-soft": resolvedTheme.brandSoft,
5887
- "--as-brand-deep": resolvedTheme.brandDeep,
5888
- "--as-surface": resolvedTheme.surface,
5889
- "--as-surface-muted": resolvedTheme.surfaceMuted,
5890
- "--as-text": resolvedTheme.text,
5891
- "--as-text-muted": resolvedTheme.textMuted,
5892
- "--as-text-subtle": resolvedTheme.textSubtle,
5893
- "--as-border": resolvedTheme.border,
5894
- "--as-visitor-bubble": resolvedTheme.visitorBubble,
5895
- "--as-visitor-text": resolvedTheme.visitorText,
5896
- "--as-on-brand": resolvedTheme.onBrand,
5897
- "--as-success": resolvedTheme.success,
5898
- "--as-danger": resolvedTheme.danger,
5899
- "--as-font-body": resolvedTheme.fontBody,
5900
- "--as-font-display": resolvedTheme.fontDisplay,
5901
- colorScheme: resolvedColorScheme
5902
- };
6115
+ const railStyle = agentThemeStyle(theme, resolvedColorScheme);
5903
6116
  const pendingInputRequests = (state.pendingInputs ?? []).filter(
5904
6117
  (request) => shouldRenderVisitorInputCard(request) && (!state.pendingOffer || request.kind === "tool-approval")
5905
6118
  );
@@ -5946,7 +6159,10 @@ function AgentRail({
5946
6159
  id: "streaming-response",
5947
6160
  role: "agent",
5948
6161
  streaming: true,
5949
- text: state.streamingText
6162
+ text: state.streamingText,
6163
+ searchResults: (state.toolResults ?? []).filter(
6164
+ (result) => result.kind === "search"
6165
+ )
5950
6166
  } : state.pendingOffer && !lastIsAgent ? {
5951
6167
  createdAt: 0,
5952
6168
  id: "pending-booking",
@@ -6068,7 +6284,7 @@ function AgentRail({
6068
6284
  window.setTimeout(settle, 900);
6069
6285
  node.scrollTo({ top: node.scrollHeight, behavior: "smooth" });
6070
6286
  }
6071
- return /* @__PURE__ */ jsx16(
6287
+ return /* @__PURE__ */ jsx17(
6072
6288
  "aside",
6073
6289
  {
6074
6290
  ref: railRef,
@@ -6082,34 +6298,34 @@ function AgentRail({
6082
6298
  autoFocus: mobileFullscreen || expanded,
6083
6299
  role: mobileFullscreen || expanded ? "dialog" : void 0,
6084
6300
  tabIndex: mobileFullscreen || expanded ? -1 : void 0,
6085
- children: /* @__PURE__ */ jsxs15(
6301
+ children: /* @__PURE__ */ jsxs16(
6086
6302
  AgentRailOverlayContext.Provider,
6087
6303
  {
6088
6304
  value: { railRef, overlayRef },
6089
6305
  children: [
6090
- /* @__PURE__ */ jsxs15("div", { className: "agent-rail__surface", inert: receiptOpen || void 0, children: [
6091
- /* @__PURE__ */ jsx16("header", { className: "agent-rail__header", children: /* @__PURE__ */ jsxs15("div", { className: "agent-rail__brand-row", children: [
6092
- onCollapse ? /* @__PURE__ */ jsx16(
6306
+ /* @__PURE__ */ jsxs16("div", { className: "agent-rail__surface", inert: receiptOpen || void 0, children: [
6307
+ /* @__PURE__ */ jsx17("header", { className: "agent-rail__header", children: /* @__PURE__ */ jsxs16("div", { className: "agent-rail__brand-row", children: [
6308
+ onCollapse ? /* @__PURE__ */ jsx17(
6093
6309
  "button",
6094
6310
  {
6095
6311
  type: "button",
6096
6312
  className: "agent-rail__collapse",
6097
6313
  "aria-label": "Collapse assist",
6098
6314
  onClick: onCollapse,
6099
- children: /* @__PURE__ */ jsx16(MinimizeIcon, {})
6315
+ children: /* @__PURE__ */ jsx17(MinimizeIcon, {})
6100
6316
  }
6101
- ) : onClose ? /* @__PURE__ */ jsx16(
6317
+ ) : onClose ? /* @__PURE__ */ jsx17(
6102
6318
  "button",
6103
6319
  {
6104
6320
  type: "button",
6105
6321
  className: "agent-rail__close",
6106
6322
  "aria-label": "Close agent",
6107
6323
  onClick: onClose,
6108
- children: /* @__PURE__ */ jsx16(CloseIcon2, {})
6324
+ children: /* @__PURE__ */ jsx17(CloseIcon2, {})
6109
6325
  }
6110
- ) : /* @__PURE__ */ jsx16("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
6111
- resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ jsxs15("span", { className: "agent-rail__identity", children: [
6112
- showBrandLogo ? /* @__PURE__ */ jsx16("span", { className: "agent-rail__brand-mark", "aria-hidden": "true", children: /* @__PURE__ */ jsx16(
6326
+ ) : /* @__PURE__ */ jsx17("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
6327
+ resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ jsxs16("span", { className: "agent-rail__identity", children: [
6328
+ showBrandLogo ? /* @__PURE__ */ jsx17("span", { className: "agent-rail__brand-mark", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
6113
6329
  "img",
6114
6330
  {
6115
6331
  className: "agent-rail__brand-logo",
@@ -6120,10 +6336,10 @@ function AgentRail({
6120
6336
  }
6121
6337
  }
6122
6338
  ) }) : null,
6123
- resolvedBrandLabel ? /* @__PURE__ */ jsx16("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
6339
+ resolvedBrandLabel ? /* @__PURE__ */ jsx17("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
6124
6340
  ] }) : null,
6125
- /* @__PURE__ */ jsxs15("span", { className: "agent-rail__actions", children: [
6126
- onReset ? /* @__PURE__ */ jsx16(
6341
+ /* @__PURE__ */ jsxs16("span", { className: "agent-rail__actions", children: [
6342
+ onReset ? /* @__PURE__ */ jsx17(
6127
6343
  "button",
6128
6344
  {
6129
6345
  type: "button",
@@ -6131,24 +6347,24 @@ function AgentRail({
6131
6347
  "aria-label": "Start a new conversation",
6132
6348
  disabled: !hasVisitorMessages2,
6133
6349
  onClick: handleReset,
6134
- children: /* @__PURE__ */ jsx16(NewChatIcon, {})
6350
+ children: /* @__PURE__ */ jsx17(NewChatIcon, {})
6135
6351
  }
6136
6352
  ) : null,
6137
- onExpandToggle ? /* @__PURE__ */ jsx16(
6353
+ onExpandToggle ? /* @__PURE__ */ jsx17(
6138
6354
  "button",
6139
6355
  {
6140
6356
  type: "button",
6141
6357
  className: "agent-rail__expand",
6142
6358
  "aria-label": expanded ? "Exit full screen" : "Open full screen",
6143
6359
  onClick: onExpandToggle,
6144
- children: expanded ? /* @__PURE__ */ jsx16(RestoreIcon, {}) : /* @__PURE__ */ jsx16(ExpandIcon, {})
6360
+ children: expanded ? /* @__PURE__ */ jsx17(RestoreIcon, {}) : /* @__PURE__ */ jsx17(ExpandIcon, {})
6145
6361
  }
6146
6362
  ) : null
6147
6363
  ] })
6148
6364
  ] }) }),
6149
- /* @__PURE__ */ jsx16("div", { ref: transcriptRef, className: "agent-rail__transcript", children: /* @__PURE__ */ jsxs15("div", { className: "agent-rail__thread", children: [
6150
- !hasVisitorMessages2 ? /* @__PURE__ */ jsxs15("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
6151
- greeting?.role === "agent" ? /* @__PURE__ */ jsx16(
6365
+ /* @__PURE__ */ jsx17("div", { ref: transcriptRef, className: "agent-rail__transcript", children: /* @__PURE__ */ jsxs16("div", { className: "agent-rail__thread", children: [
6366
+ !hasVisitorMessages2 ? /* @__PURE__ */ jsxs16("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
6367
+ greeting?.role === "agent" ? /* @__PURE__ */ jsx17(
6152
6368
  MessageBubble,
6153
6369
  {
6154
6370
  message: greeting,
@@ -6157,7 +6373,7 @@ function AgentRail({
6157
6373
  onBook
6158
6374
  }
6159
6375
  ) : null,
6160
- showIdleFollowUps ? /* @__PURE__ */ jsx16("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ jsx16(
6376
+ showIdleFollowUps ? /* @__PURE__ */ jsx17("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ jsx17(
6161
6377
  FollowUpChips,
6162
6378
  {
6163
6379
  suggestions: state.followUps,
@@ -6166,7 +6382,7 @@ function AgentRail({
6166
6382
  onSelect: (suggestion) => handleFollowUpSelect(suggestion.label)
6167
6383
  }
6168
6384
  ) }) : null,
6169
- showActivity ? /* @__PURE__ */ jsx16(
6385
+ showActivity ? /* @__PURE__ */ jsx17(
6170
6386
  AgentActivityBubble,
6171
6387
  {
6172
6388
  brandLabel: resolvedBrandLabel,
@@ -6175,7 +6391,7 @@ function AgentRail({
6175
6391
  steps: state.toolSteps
6176
6392
  }
6177
6393
  ) : null,
6178
- visibleVisitorToolResults.map((result) => /* @__PURE__ */ jsx16(
6394
+ visibleVisitorToolResults.map((result) => /* @__PURE__ */ jsx17(
6179
6395
  VisitorToolResultView,
6180
6396
  {
6181
6397
  result,
@@ -6184,7 +6400,7 @@ function AgentRail({
6184
6400
  },
6185
6401
  result.id
6186
6402
  )),
6187
- pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ jsx16(
6403
+ pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ jsx17(
6188
6404
  HumanInputCard,
6189
6405
  {
6190
6406
  request,
@@ -6193,8 +6409,8 @@ function AgentRail({
6193
6409
  request.requestId
6194
6410
  ))
6195
6411
  ] }) : null,
6196
- visibleMessages.map((message, index) => /* @__PURE__ */ jsxs15("div", { className: "agent-rail__turn-block", children: [
6197
- /* @__PURE__ */ jsx16(
6412
+ visibleMessages.map((message, index) => /* @__PURE__ */ jsxs16("div", { className: "agent-rail__turn-block", children: [
6413
+ /* @__PURE__ */ jsx17(
6198
6414
  MessageBubble,
6199
6415
  {
6200
6416
  message,
@@ -6204,7 +6420,7 @@ function AgentRail({
6204
6420
  onBook
6205
6421
  }
6206
6422
  ),
6207
- index === lastAgentIndex && showMessageActions && message.role === "agent" ? /* @__PURE__ */ jsx16(
6423
+ index === lastAgentIndex && showMessageActions && message.role === "agent" ? /* @__PURE__ */ jsx17(
6208
6424
  MessageActions,
6209
6425
  {
6210
6426
  answeredAt: message.createdAt,
@@ -6216,8 +6432,8 @@ function AgentRail({
6216
6432
  onFeedback: onFeedback ? (rating) => onFeedback(rating, message) : void 0
6217
6433
  }
6218
6434
  ) : null,
6219
- index === lastVisitorIndex ? /* @__PURE__ */ jsxs15(Fragment2, { children: [
6220
- showActivity ? /* @__PURE__ */ jsx16(
6435
+ index === lastVisitorIndex ? /* @__PURE__ */ jsxs16(Fragment3, { children: [
6436
+ showActivity ? /* @__PURE__ */ jsx17(
6221
6437
  AgentActivityBubble,
6222
6438
  {
6223
6439
  brandLabel: resolvedBrandLabel,
@@ -6226,7 +6442,7 @@ function AgentRail({
6226
6442
  steps: state.toolSteps
6227
6443
  }
6228
6444
  ) : null,
6229
- visibleVisitorToolResults.map((result) => /* @__PURE__ */ jsx16(
6445
+ visibleVisitorToolResults.map((result) => /* @__PURE__ */ jsx17(
6230
6446
  VisitorToolResultView,
6231
6447
  {
6232
6448
  result,
@@ -6235,7 +6451,7 @@ function AgentRail({
6235
6451
  },
6236
6452
  result.id
6237
6453
  )),
6238
- pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ jsx16(
6454
+ pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ jsx17(
6239
6455
  HumanInputCard,
6240
6456
  {
6241
6457
  request,
@@ -6245,7 +6461,7 @@ function AgentRail({
6245
6461
  ))
6246
6462
  ] }) : null
6247
6463
  ] }, message.id)),
6248
- streamingMessage ? /* @__PURE__ */ jsx16(
6464
+ streamingMessage ? /* @__PURE__ */ jsx17(
6249
6465
  MessageBubble,
6250
6466
  {
6251
6467
  message: streamingMessage,
@@ -6255,16 +6471,16 @@ function AgentRail({
6255
6471
  onBook
6256
6472
  }
6257
6473
  ) : null,
6258
- waitingForBooking ? /* @__PURE__ */ jsx16(BookingCardLoader, {}) : null,
6259
- state.error ? /* @__PURE__ */ jsxs15("section", { className: "agent-rail__error", role: "alert", children: [
6260
- /* @__PURE__ */ jsxs15("div", { children: [
6261
- /* @__PURE__ */ jsx16("strong", { children: "Something went wrong" }),
6262
- /* @__PURE__ */ jsx16("p", { children: state.error })
6474
+ waitingForBooking ? /* @__PURE__ */ jsx17(BookingCardLoader, {}) : null,
6475
+ state.error ? /* @__PURE__ */ jsxs16("section", { className: "agent-rail__error", role: "alert", children: [
6476
+ /* @__PURE__ */ jsxs16("div", { children: [
6477
+ /* @__PURE__ */ jsx17("strong", { children: "Something went wrong" }),
6478
+ /* @__PURE__ */ jsx17("p", { children: state.error })
6263
6479
  ] }),
6264
- onRetry ? /* @__PURE__ */ jsx16("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
6480
+ onRetry ? /* @__PURE__ */ jsx17("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
6265
6481
  ] }) : null
6266
6482
  ] }) }),
6267
- showDisclaimerLabel ? /* @__PURE__ */ jsx16("div", { className: "agent-rail__disclaimer", children: /* @__PURE__ */ jsx16("p", { children: disclaimerLink ? /* @__PURE__ */ jsx16(
6483
+ showDisclaimerLabel ? /* @__PURE__ */ jsx17("div", { className: "agent-rail__disclaimer", children: /* @__PURE__ */ jsx17("p", { children: disclaimerLink ? /* @__PURE__ */ jsx17(
6268
6484
  "a",
6269
6485
  {
6270
6486
  href: disclaimerLink,
@@ -6273,8 +6489,8 @@ function AgentRail({
6273
6489
  children: resolvedDisclaimerLabel
6274
6490
  }
6275
6491
  ) : resolvedDisclaimerLabel }) }) : null,
6276
- /* @__PURE__ */ jsxs15("div", { className: "agent-rail__composer-wrap", children: [
6277
- showJumpToLatest ? /* @__PURE__ */ jsx16(
6492
+ /* @__PURE__ */ jsxs16("div", { className: "agent-rail__composer-wrap", children: [
6493
+ showJumpToLatest ? /* @__PURE__ */ jsx17(
6278
6494
  "button",
6279
6495
  {
6280
6496
  type: "button",
@@ -6282,10 +6498,10 @@ function AgentRail({
6282
6498
  "aria-label": "Jump to the latest message",
6283
6499
  title: "Jump to the latest message",
6284
6500
  onClick: scrollToLatest,
6285
- children: /* @__PURE__ */ jsx16(ChevronDownIcon, {})
6501
+ children: /* @__PURE__ */ jsx17(ChevronDownIcon, {})
6286
6502
  }
6287
6503
  ) : null,
6288
- /* @__PURE__ */ jsx16(
6504
+ /* @__PURE__ */ jsx17(
6289
6505
  Composer,
6290
6506
  {
6291
6507
  variant: expanded || mobileFullscreen ? "dock" : "default",
@@ -6297,11 +6513,11 @@ function AgentRail({
6297
6513
  },
6298
6514
  state.messages.find((message) => message.role === "visitor")?.id ?? "empty"
6299
6515
  ),
6300
- poweredByLabel ? /* @__PURE__ */ jsx16("div", { className: "agent-rail__footer", children: /* @__PURE__ */ jsx16("p", { children: /* @__PURE__ */ jsx16("span", { children: poweredByLabel }) }) }) : null
6516
+ poweredByLabel ? /* @__PURE__ */ jsx17("div", { className: "agent-rail__footer", children: /* @__PURE__ */ jsx17("p", { children: /* @__PURE__ */ jsx17("span", { children: poweredByLabel }) }) }) : null
6301
6517
  ] })
6302
6518
  ] }),
6303
- /* @__PURE__ */ jsx16("div", { ref: overlayRef, className: "agent-rail__overlay" }),
6304
- receiptOpen && receiptSteps ? /* @__PURE__ */ jsx16(
6519
+ /* @__PURE__ */ jsx17("div", { ref: overlayRef, className: "agent-rail__overlay" }),
6520
+ receiptOpen && receiptSteps ? /* @__PURE__ */ jsx17(
6305
6521
  AnswerReceiptDialog,
6306
6522
  {
6307
6523
  brandLabel: resolvedBrandLabel,
@@ -6317,9 +6533,9 @@ function AgentRail({
6317
6533
  }
6318
6534
 
6319
6535
  // src/react/components/AssistEdgeTab/AssistEdgeTab.tsx
6320
- import { Fragment as Fragment3, jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
6536
+ import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
6321
6537
  function SparklesIcon() {
6322
- return /* @__PURE__ */ jsxs16(
6538
+ return /* @__PURE__ */ jsxs17(
6323
6539
  "svg",
6324
6540
  {
6325
6541
  className: "assist-edge-tab__sparkles",
@@ -6327,21 +6543,21 @@ function SparklesIcon() {
6327
6543
  fill: "none",
6328
6544
  "aria-hidden": "true",
6329
6545
  children: [
6330
- /* @__PURE__ */ jsx17(
6546
+ /* @__PURE__ */ jsx18(
6331
6547
  "path",
6332
6548
  {
6333
6549
  d: "M8 1.2l.95 2.7 2.85.05-2.25 1.75.8 2.75L8 6.7 5.65 8.45l.8-2.75L4.2 3.95l2.85-.05L8 1.2z",
6334
6550
  fill: "currentColor"
6335
6551
  }
6336
6552
  ),
6337
- /* @__PURE__ */ jsx17(
6553
+ /* @__PURE__ */ jsx18(
6338
6554
  "path",
6339
6555
  {
6340
6556
  d: "M14.2 6.4l.55 1.55 1.65.03-1.3 1 .46 1.58-1.36-1-1.36 1 .46-1.58-1.3-1 1.65-.03.55-1.55z",
6341
6557
  fill: "currentColor"
6342
6558
  }
6343
6559
  ),
6344
- /* @__PURE__ */ jsx17(
6560
+ /* @__PURE__ */ jsx18(
6345
6561
  "path",
6346
6562
  {
6347
6563
  d: "M3.1 9.1l.4 1.15 1.22.02-.96.74.34 1.17-1-.74-1 .74.34-1.17-.96-.74 1.22-.02.4-1.15z",
@@ -6355,7 +6571,7 @@ function SparklesIcon() {
6355
6571
  function TabMarkIcon({ customIconUrl }) {
6356
6572
  const url = customIconUrl?.trim();
6357
6573
  if (url) {
6358
- return /* @__PURE__ */ jsx17(
6574
+ return /* @__PURE__ */ jsx18(
6359
6575
  "img",
6360
6576
  {
6361
6577
  alt: "",
@@ -6365,10 +6581,10 @@ function TabMarkIcon({ customIconUrl }) {
6365
6581
  }
6366
6582
  );
6367
6583
  }
6368
- return /* @__PURE__ */ jsx17(SparklesIcon, {});
6584
+ return /* @__PURE__ */ jsx18(SparklesIcon, {});
6369
6585
  }
6370
6586
  function ChevronLeftIcon() {
6371
- return /* @__PURE__ */ jsx17("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
6587
+ return /* @__PURE__ */ jsx18("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
6372
6588
  "path",
6373
6589
  {
6374
6590
  d: "M10 4L6 8l4 4",
@@ -6380,7 +6596,7 @@ function ChevronLeftIcon() {
6380
6596
  ) });
6381
6597
  }
6382
6598
  function ChevronDownIcon2() {
6383
- return /* @__PURE__ */ jsx17("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
6599
+ return /* @__PURE__ */ jsx18("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
6384
6600
  "path",
6385
6601
  {
6386
6602
  d: "M4 6l4 4 4-4",
@@ -6392,7 +6608,7 @@ function ChevronDownIcon2() {
6392
6608
  ) });
6393
6609
  }
6394
6610
  function DragDots() {
6395
- return /* @__PURE__ */ jsx17("span", { className: "assist-edge-tab__dots", "aria-hidden": "true", children: Array.from({ length: 12 }, (_, index) => /* @__PURE__ */ jsx17("i", {}, index)) });
6611
+ return /* @__PURE__ */ jsx18("span", { className: "assist-edge-tab__dots", "aria-hidden": "true", children: Array.from({ length: 12 }, (_, index) => /* @__PURE__ */ jsx18("i", {}, index)) });
6396
6612
  }
6397
6613
  var VARIANT_COPY = {
6398
6614
  outline: { label: "Ask anything", aria: "Ask anything" },
@@ -6438,7 +6654,7 @@ function AssistEdgeTab({
6438
6654
  ...resolvedTextColor ? { "--as-text": resolvedTextColor } : {},
6439
6655
  colorScheme: resolvedColorScheme
6440
6656
  };
6441
- return /* @__PURE__ */ jsxs16(
6657
+ return /* @__PURE__ */ jsxs17(
6442
6658
  "button",
6443
6659
  {
6444
6660
  type: "button",
@@ -6450,15 +6666,15 @@ function AssistEdgeTab({
6450
6666
  tabIndex: visible ? 0 : -1,
6451
6667
  onClick: onOpen,
6452
6668
  children: [
6453
- mobile ? /* @__PURE__ */ jsxs16(Fragment3, { children: [
6454
- /* @__PURE__ */ jsxs16(
6669
+ mobile ? /* @__PURE__ */ jsxs17(Fragment4, { children: [
6670
+ /* @__PURE__ */ jsxs17(
6455
6671
  "span",
6456
6672
  {
6457
6673
  className: "assist-edge-tab__mark assist-edge-tab__mark--mobile",
6458
6674
  "aria-hidden": "true",
6459
6675
  children: [
6460
- /* @__PURE__ */ jsx17(TabMarkIcon, { customIconUrl }),
6461
- showLogo ? /* @__PURE__ */ jsx17(
6676
+ /* @__PURE__ */ jsx18(TabMarkIcon, { customIconUrl }),
6677
+ showLogo ? /* @__PURE__ */ jsx18(
6462
6678
  "img",
6463
6679
  {
6464
6680
  className: "assist-edge-tab__logo",
@@ -6472,11 +6688,11 @@ function AssistEdgeTab({
6472
6688
  ]
6473
6689
  }
6474
6690
  ),
6475
- /* @__PURE__ */ jsx17("span", { className: "assist-edge-tab__label", children: visibleLabel })
6476
- ] }) : variant === "outline" ? /* @__PURE__ */ jsxs16(Fragment3, { children: [
6477
- /* @__PURE__ */ jsxs16("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
6478
- /* @__PURE__ */ jsx17(TabMarkIcon, { customIconUrl }),
6479
- showLogo ? /* @__PURE__ */ jsx17(
6691
+ /* @__PURE__ */ jsx18("span", { className: "assist-edge-tab__label", children: visibleLabel })
6692
+ ] }) : variant === "outline" ? /* @__PURE__ */ jsxs17(Fragment4, { children: [
6693
+ /* @__PURE__ */ jsxs17("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
6694
+ /* @__PURE__ */ jsx18(TabMarkIcon, { customIconUrl }),
6695
+ showLogo ? /* @__PURE__ */ jsx18(
6480
6696
  "img",
6481
6697
  {
6482
6698
  className: "assist-edge-tab__logo",
@@ -6488,18 +6704,18 @@ function AssistEdgeTab({
6488
6704
  }
6489
6705
  ) : null
6490
6706
  ] }),
6491
- /* @__PURE__ */ jsx17("span", { className: "assist-edge-tab__label", children: visibleLabel }),
6492
- /* @__PURE__ */ jsx17(ChevronDownIcon2, {})
6707
+ /* @__PURE__ */ jsx18("span", { className: "assist-edge-tab__label", children: visibleLabel }),
6708
+ /* @__PURE__ */ jsx18(ChevronDownIcon2, {})
6493
6709
  ] }) : null,
6494
- variant === "ask" ? /* @__PURE__ */ jsxs16(Fragment3, { children: [
6495
- /* @__PURE__ */ jsx17(ChevronLeftIcon, {}),
6496
- /* @__PURE__ */ jsx17("span", { className: "assist-edge-tab__label", children: visibleLabel }),
6497
- /* @__PURE__ */ jsx17(DragDots, {})
6710
+ variant === "ask" ? /* @__PURE__ */ jsxs17(Fragment4, { children: [
6711
+ /* @__PURE__ */ jsx18(ChevronLeftIcon, {}),
6712
+ /* @__PURE__ */ jsx18("span", { className: "assist-edge-tab__label", children: visibleLabel }),
6713
+ /* @__PURE__ */ jsx18(DragDots, {})
6498
6714
  ] }) : null,
6499
- variant === "fill" ? /* @__PURE__ */ jsxs16(Fragment3, { children: [
6500
- /* @__PURE__ */ jsxs16("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
6501
- /* @__PURE__ */ jsx17(TabMarkIcon, { customIconUrl }),
6502
- showLogo ? /* @__PURE__ */ jsx17(
6715
+ variant === "fill" ? /* @__PURE__ */ jsxs17(Fragment4, { children: [
6716
+ /* @__PURE__ */ jsxs17("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
6717
+ /* @__PURE__ */ jsx18(TabMarkIcon, { customIconUrl }),
6718
+ showLogo ? /* @__PURE__ */ jsx18(
6503
6719
  "img",
6504
6720
  {
6505
6721
  className: "assist-edge-tab__logo",
@@ -6511,8 +6727,8 @@ function AssistEdgeTab({
6511
6727
  }
6512
6728
  ) : null
6513
6729
  ] }),
6514
- /* @__PURE__ */ jsx17("span", { className: "assist-edge-tab__label", children: visibleLabel }),
6515
- /* @__PURE__ */ jsx17(ChevronLeftIcon, {})
6730
+ /* @__PURE__ */ jsx18("span", { className: "assist-edge-tab__label", children: visibleLabel }),
6731
+ /* @__PURE__ */ jsx18(ChevronLeftIcon, {})
6516
6732
  ] }) : null
6517
6733
  ]
6518
6734
  }
@@ -6534,8 +6750,8 @@ function findPrecedingVisitorText(messages, agentMessageId) {
6534
6750
  }
6535
6751
  return void 0;
6536
6752
  }
6537
- function normalizeAgentFeedbackAnswerText(text) {
6538
- const normalized = text.replace(/\s+/g, " ").trim();
6753
+ function normalizeAgentFeedbackAnswerText(text2) {
6754
+ const normalized = text2.replace(/\s+/g, " ").trim();
6539
6755
  if (!normalized) return void 0;
6540
6756
  return normalized.length > 4e3 ? `${normalized.slice(0, 3997)}...` : normalized;
6541
6757
  }
@@ -6675,7 +6891,7 @@ function useIsMobile(breakpoint = 767) {
6675
6891
  }
6676
6892
 
6677
6893
  // src/react/components/AgentWidget/AgentWidget.tsx
6678
- import { jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
6894
+ import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
6679
6895
  function AgentWidget({
6680
6896
  indexId,
6681
6897
  customerId,
@@ -6818,19 +7034,19 @@ function AgentWidget({
6818
7034
  window.addEventListener("keydown", handleKeyDown);
6819
7035
  return () => window.removeEventListener("keydown", handleKeyDown);
6820
7036
  }, [isMobile, railCollapsed, railExpanded]);
6821
- return /* @__PURE__ */ jsxs17("div", { className: "webless-agent-root", children: [
6822
- /* @__PURE__ */ jsx18(
7037
+ return /* @__PURE__ */ jsxs18("div", { className: "webless-agent-root", children: [
7038
+ /* @__PURE__ */ jsx19(
6823
7039
  "div",
6824
7040
  {
6825
7041
  className: `webless-agent-root__shell${railCollapsed ? " webless-agent-root__shell--collapsed" : ""}${railExpanded ? " webless-agent-root__shell--expanded" : ""}`,
6826
- children: /* @__PURE__ */ jsx18(
7042
+ children: /* @__PURE__ */ jsx19(
6827
7043
  "div",
6828
7044
  {
6829
7045
  ref: railSlotRef,
6830
7046
  className: "webless-agent-root__rail-slot",
6831
7047
  inert: railCollapsed || void 0,
6832
7048
  "aria-hidden": railCollapsed,
6833
- children: /* @__PURE__ */ jsx18(
7049
+ children: /* @__PURE__ */ jsx19(
6834
7050
  AgentRail,
6835
7051
  {
6836
7052
  theme,
@@ -6867,7 +7083,7 @@ function AgentWidget({
6867
7083
  )
6868
7084
  }
6869
7085
  ),
6870
- railCollapsed ? /* @__PURE__ */ jsx18(
7086
+ railCollapsed ? /* @__PURE__ */ jsx19(
6871
7087
  AssistEdgeTab,
6872
7088
  {
6873
7089
  variant: placement.variant,
@@ -6912,6 +7128,9 @@ export {
6912
7128
  submitAgentPanel,
6913
7129
  defaultAgentRailTheme,
6914
7130
  defaultDarkAgentRailTheme,
7131
+ agentThemeStyle,
7132
+ useAgentColorScheme,
7133
+ MessageBubble,
6915
7134
  MessageActions,
6916
7135
  AgentRail,
6917
7136
  AssistEdgeTab,
@@ -6921,4 +7140,4 @@ export {
6921
7140
  sendAgentAnswerFeedback,
6922
7141
  AgentWidget
6923
7142
  };
6924
- //# sourceMappingURL=chunk-GS65OJFL.js.map
7143
+ //# sourceMappingURL=chunk-JZPXXG76.js.map