@webless/agent 0.6.4 → 0.6.6

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.
@@ -1,5 +1,16 @@
1
1
  // src/runtime/tool-ui.ts
2
2
  var AGENT_TOOL_UI_SCHEMA_VERSION = "webless.tool-ui.v1";
3
+ var AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION = "webless.structured-tool-input.v1";
4
+ var AGENT_STRUCTURED_TOOL_INPUT_HEADER = "Webless-Structured-Tool-Input-JSON:";
5
+ function formatAgentStructuredToolInput(surface, values) {
6
+ const payload = {
7
+ schemaVersion: AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION,
8
+ toolSlug: surface.toolSlug,
9
+ ...surface.operationId ? { operationId: surface.operationId } : {},
10
+ values
11
+ };
12
+ return `${AGENT_STRUCTURED_TOOL_INPUT_HEADER} ${JSON.stringify(payload)}`;
13
+ }
3
14
  function isRecord(value) {
4
15
  return value !== null && typeof value === "object" && !Array.isArray(value);
5
16
  }
@@ -394,21 +405,46 @@ function looksLikeBookingCopy(text) {
394
405
  text
395
406
  );
396
407
  }
397
- function inferComposerForm(text) {
398
- const cleaned = text.trim();
399
- if (!cleaned || looksLikeBookingCopy(cleaned) || !looksLikeFieldCollection(cleaned)) {
400
- return null;
401
- }
402
- const fields = FIELD_LIBRARY.flatMap((field) => {
403
- if (field.exclude?.test(cleaned)) {
404
- const leftover = cleaned.replace(field.exclude, " ");
408
+ function echoedLabeledFieldIds(text) {
409
+ 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");
414
+ return ids;
415
+ }
416
+ function matchLibraryFields(text) {
417
+ return FIELD_LIBRARY.flatMap((field) => {
418
+ if (field.exclude?.test(text)) {
419
+ const leftover = text.replace(field.exclude, " ");
405
420
  if (!field.patterns.some((pattern) => pattern.test(leftover))) return [];
406
- } else if (!field.patterns.some((pattern) => pattern.test(cleaned))) {
421
+ } else if (!field.patterns.some((pattern) => pattern.test(text))) {
407
422
  return [];
408
423
  }
409
424
  const { patterns: _patterns, exclude: _exclude, ...next } = field;
410
425
  return [next];
411
426
  }).slice(0, MAX_FORM_FIELDS);
427
+ }
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);
431
+ if (echoingFilledFields) {
432
+ if (looksLikeFieldCollection(text)) {
433
+ const echoed = echoedLabeledFieldIds(text);
434
+ if (matchLibraryFields(text).some((field) => !echoed.has(field.id))) {
435
+ return false;
436
+ }
437
+ }
438
+ return true;
439
+ }
440
+ return confirmingCreate && !looksLikeFieldCollection(text);
441
+ }
442
+ function inferComposerForm(text) {
443
+ const cleaned = text.trim();
444
+ if (!cleaned || looksLikeBookingCopy(cleaned) || looksLikeCompletedActionRecap(cleaned) || !looksLikeFieldCollection(cleaned)) {
445
+ return null;
446
+ }
447
+ const fields = matchLibraryFields(cleaned);
412
448
  if (fields.length < MIN_FORM_FIELDS) return null;
413
449
  return {
414
450
  id: `inferred:${fields.map((field) => field.id).join("+")}`,
@@ -416,7 +452,9 @@ function inferComposerForm(text) {
416
452
  };
417
453
  }
418
454
  function resolveComposerForm(input) {
419
- if (input.enabled === false || input.hasBookingOffer) return null;
455
+ if (input.enabled === false || input.hasBookingOffer || input.hasPendingConfirmation) {
456
+ return null;
457
+ }
420
458
  const text = input.agentText.trim();
421
459
  if (!text) return null;
422
460
  const card = input.cards?.find((item) => item.type === "visitor_form");
@@ -441,7 +479,7 @@ function preferBookingOffer(current, next) {
441
479
  return next;
442
480
  }
443
481
  function looksLikeBookingReady(text) {
444
- return /demo option|options are ready|pick a (date|time)|available (times|slots)|book(ing)? (card|the demo)|schedule/i.test(
482
+ return /demo option|options are ready|pick a (date|time)|available (times|slots)|book(ing)? (card|the demo)|\bschedule\b/i.test(
445
483
  text
446
484
  );
447
485
  }
@@ -933,7 +971,8 @@ function presentVisitorToolResult(result, registry = []) {
933
971
  id: result.callId,
934
972
  toolName: result.toolName,
935
973
  status: result.status,
936
- kind: "hidden"
974
+ kind: "input",
975
+ surface: envelope.ui
937
976
  };
938
977
  }
939
978
  if (!proposed) {
@@ -1818,11 +1857,11 @@ function createAgentClient(options) {
1818
1857
 
1819
1858
  // src/runtime/errors.ts
1820
1859
  import { ClientError as ClientError3 } from "eve/client";
1821
- var TRANSIENT_AGENT_ERROR_MESSAGE = "I couldn\u2019t finish that answer. Please try again.";
1860
+ var TRANSIENT_AGENT_ERROR_MESSAGE = "The agent run stopped before the action finished. Please try again.";
1822
1861
  var PREVIEW_AUTHORIZATION_ERROR_MESSAGE = "This preview could not be authorized. Open the latest preview from Webless.";
1823
1862
  function isTransientRuntimeMessage(message) {
1824
1863
  const normalized = message.trim().toLowerCase();
1825
- return normalized.includes("empty response from runtime") || normalized.includes("failed to fetch") || normalized.includes("networkerror") || normalized.includes("load failed");
1864
+ return normalized.includes("empty response from runtime") || normalized.includes("failed to fetch") || normalized.includes("networkerror") || normalized.includes("network error") || normalized.includes("load failed") || normalized.includes("the stream");
1826
1865
  }
1827
1866
  function isPreviewAuthorizationMessage(message) {
1828
1867
  const normalized = message.trim().toLowerCase();
@@ -2124,6 +2163,7 @@ function clearPendingWidgetBooking(storageKeyPrefix, visitorSessionId) {
2124
2163
 
2125
2164
  // src/react/lib/visitor-input.ts
2126
2165
  function shouldRenderVisitorInputCard(request) {
2166
+ if (request.ui) return true;
2127
2167
  if (request.kind === "tool-approval" || request.kind === "session-limit") {
2128
2168
  return true;
2129
2169
  }
@@ -2457,7 +2497,6 @@ function useAgentChat({
2457
2497
  }
2458
2498
  if (!isActiveRun()) return;
2459
2499
  if (presentation.kind === "hidden") return;
2460
- if (presentation.kind === "input") return;
2461
2500
  setState((prev) => ({
2462
2501
  ...prev,
2463
2502
  toolResults: [
@@ -2735,14 +2774,13 @@ ${outgoing}` : outgoing;
2735
2774
  }, [runTurn, state.messages]);
2736
2775
  const respondToToolInput = useCallback(
2737
2776
  async (surface, values) => {
2738
- const details = JSON.stringify(values);
2739
- await submit(`${surface.title} details provided`, {
2777
+ await submit(`${surface.title} submitted`, {
2740
2778
  runtimeText: [
2741
- `Structured input provided for ${surface.toolSlug}.`,
2742
- surface.operationId ? `Operation: ${surface.operationId}.` : "",
2743
- `Use these exact values and retry the action: ${details}`,
2779
+ formatAgentStructuredToolInput(surface, values),
2780
+ "Use these exact structured values to retry the requested action.",
2781
+ "Reuse the operationId from the structured payload.",
2744
2782
  "Do not invent or alter any values."
2745
- ].filter(Boolean).join("\n")
2783
+ ].join("\n")
2746
2784
  });
2747
2785
  },
2748
2786
  [submit]
@@ -2891,6 +2929,7 @@ var defaultAgentRailTheme = {
2891
2929
  border: "rgb(42 51 70 / 0.1)",
2892
2930
  visitorBubble: "#f3edff",
2893
2931
  visitorText: "#171b2a",
2932
+ onBrand: "#ffffff",
2894
2933
  success: "#18794e",
2895
2934
  danger: "#c94b63",
2896
2935
  fontBody: '"Mulish", "Avenir Next", "Segoe UI", sans-serif',
@@ -2909,12 +2948,13 @@ var defaultDarkAgentRailTheme = {
2909
2948
  border: "rgb(226 232 240 / 0.16)",
2910
2949
  visitorBubble: "#2b2140",
2911
2950
  visitorText: "#f5f7fb",
2951
+ onBrand: "#171b2a",
2912
2952
  success: "#55cf91",
2913
2953
  danger: "#ff8da1"
2914
2954
  };
2915
2955
 
2916
2956
  // src/react/components/AgentRail/AgentRail.tsx
2917
- import { useEffect as useEffect3, useRef as useRef3, useState as useState7 } from "react";
2957
+ import { useEffect as useEffect3, useRef as useRef3, useState as useState8 } from "react";
2918
2958
 
2919
2959
  // src/react/hooks/useAgentColorScheme.ts
2920
2960
  import { useSyncExternalStore } from "react";
@@ -3029,7 +3069,7 @@ function AgentActivityBubble({
3029
3069
  workSummary(steps, failed, brandLabel)
3030
3070
  ] }),
3031
3071
  /* @__PURE__ */ jsxs("div", { className: "agent-activity-bubble__details", children: [
3032
- /* @__PURE__ */ jsxs(
3072
+ /* @__PURE__ */ jsx(
3033
3073
  "button",
3034
3074
  {
3035
3075
  type: "button",
@@ -3041,10 +3081,7 @@ function AgentActivityBubble({
3041
3081
  (current) => current === receiptId ? null : receiptId
3042
3082
  );
3043
3083
  },
3044
- children: [
3045
- /* @__PURE__ */ jsx("span", { className: "agent-activity-bubble__summary-title", children: "How this answer was made" }),
3046
- /* @__PURE__ */ jsx("span", { className: "agent-activity-bubble__summary-toggle", children: detailsOpen ? "Hide work" : "Show work" })
3047
- ]
3084
+ children: "How this answer was made"
3048
3085
  }
3049
3086
  ),
3050
3087
  detailsOpen ? /* @__PURE__ */ jsx("ol", { className: "agent-activity-bubble__steps", children: visibleSteps.map((step) => {
@@ -3361,6 +3398,9 @@ function calendarCells(year, month) {
3361
3398
  while (cells.length < 42) cells.push(null);
3362
3399
  return cells;
3363
3400
  }
3401
+ function BookingCardLoader() {
3402
+ return /* @__PURE__ */ jsx4("section", { className: "booking-card", "aria-label": "Book a meeting", children: /* @__PURE__ */ jsx4("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) });
3403
+ }
3364
3404
  function BookingCard({
3365
3405
  offer,
3366
3406
  onBook
@@ -3780,7 +3820,7 @@ function MessageBubble({
3780
3820
  }
3781
3821
 
3782
3822
  // src/react/components/HumanInputCard/HumanInputCard.tsx
3783
- import { useState as useState6 } from "react";
3823
+ import { useState as useState7 } from "react";
3784
3824
 
3785
3825
  // src/react/components/ConfirmationCard/ConfirmationCard.tsx
3786
3826
  import { jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
@@ -3821,18 +3861,450 @@ function ConfirmationCard({
3821
3861
  );
3822
3862
  }
3823
3863
 
3824
- // src/react/components/HumanInputCard/HumanInputCard.tsx
3864
+ // src/react/components/ToolInputCard/ToolInputCard.tsx
3865
+ import { useState as useState6 } from "react";
3825
3866
  import { jsx as jsx7, jsxs as jsxs7 } from "react/jsx-runtime";
3867
+ function isRecord4(value) {
3868
+ return value !== null && typeof value === "object" && !Array.isArray(value);
3869
+ }
3870
+ function pathSegments(path) {
3871
+ return path.replace(/\[(\d+)\]/gu, ".$1").split(".").filter(Boolean);
3872
+ }
3873
+ function valueAtPath(root, path) {
3874
+ let current = root;
3875
+ for (const segment of pathSegments(path)) {
3876
+ if (Array.isArray(current)) {
3877
+ const index = Number(segment);
3878
+ current = Number.isInteger(index) ? current[index] : void 0;
3879
+ continue;
3880
+ }
3881
+ current = isRecord4(current) ? current[segment] : void 0;
3882
+ }
3883
+ return current;
3884
+ }
3885
+ function initialFieldValue(field, surface) {
3886
+ const supplied = valueAtPath(surface.values, field.path);
3887
+ if (supplied !== void 0) return supplied;
3888
+ if (field.defaultValue !== void 0) return field.defaultValue;
3889
+ if (field.kind === "checkbox" || field.kind === "confirmation") return false;
3890
+ if (field.kind === "multi-select") return [];
3891
+ if (field.kind === "range") return field.min ?? 0;
3892
+ return "";
3893
+ }
3894
+ function initialValues(surface) {
3895
+ return Object.fromEntries(
3896
+ surface.fields.map((field) => [
3897
+ field.path,
3898
+ initialFieldValue(field, surface)
3899
+ ])
3900
+ );
3901
+ }
3902
+ function cloneJsonValue(value) {
3903
+ if (Array.isArray(value)) return value.map(cloneJsonValue);
3904
+ if (isRecord4(value)) {
3905
+ return Object.fromEntries(
3906
+ Object.entries(value).map(([key, item]) => [key, cloneJsonValue(item)])
3907
+ );
3908
+ }
3909
+ return value;
3910
+ }
3911
+ function assignPath(target, path, value) {
3912
+ const segments = pathSegments(path);
3913
+ let current = target;
3914
+ segments.forEach((segment, index) => {
3915
+ if (index === segments.length - 1) {
3916
+ current[segment] = value;
3917
+ return;
3918
+ }
3919
+ const existing = current[segment];
3920
+ if (!isRecord4(existing)) current[segment] = {};
3921
+ current = current[segment];
3922
+ });
3923
+ }
3924
+ function isJsonValue3(value, seen = /* @__PURE__ */ new Set()) {
3925
+ if (value === null || typeof value === "string" || typeof value === "boolean") {
3926
+ return true;
3927
+ }
3928
+ if (typeof value === "number") return Number.isFinite(value);
3929
+ if (typeof value !== "object" || seen.has(value)) return false;
3930
+ seen.add(value);
3931
+ const valid = Array.isArray(value) ? value.every((item) => isJsonValue3(item, seen)) : Object.values(value).every((item) => isJsonValue3(item, seen));
3932
+ seen.delete(value);
3933
+ return valid;
3934
+ }
3935
+ function parsedFieldValue(field, value) {
3936
+ if (field.kind !== "json" || typeof value !== "string") return value;
3937
+ try {
3938
+ const parsed = JSON.parse(value);
3939
+ return isJsonValue3(parsed) ? parsed : void 0;
3940
+ } catch {
3941
+ return void 0;
3942
+ }
3943
+ }
3944
+ function isEmpty(value) {
3945
+ if (typeof value === "string") return value.trim().length === 0;
3946
+ if (Array.isArray(value)) return value.length === 0;
3947
+ return value === null || value === false;
3948
+ }
3949
+ function validateField(field, value) {
3950
+ if (field.required && isEmpty(value))
3951
+ return `Enter ${field.label.toLowerCase()}.`;
3952
+ if (typeof value === "string" && value.trim().length === 0) return "";
3953
+ if (field.kind === "email" && (typeof value !== "string" || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/u.test(value))) {
3954
+ return "Enter a valid email address.";
3955
+ }
3956
+ if (typeof value === "string") {
3957
+ if (field.minLength !== void 0 && value.length < field.minLength) {
3958
+ return `Use at least ${field.minLength} characters.`;
3959
+ }
3960
+ if (field.maxLength !== void 0 && value.length > field.maxLength) {
3961
+ return `Use no more than ${field.maxLength} characters.`;
3962
+ }
3963
+ }
3964
+ if (typeof value === "number") {
3965
+ if (field.min !== void 0 && value < field.min) {
3966
+ return `Choose ${field.min} or higher.`;
3967
+ }
3968
+ if (field.max !== void 0 && value > field.max) {
3969
+ return `Choose ${field.max} or lower.`;
3970
+ }
3971
+ }
3972
+ if (field.maxItems !== void 0 && Array.isArray(value) && value.length > field.maxItems) {
3973
+ return `Choose no more than ${field.maxItems}.`;
3974
+ }
3975
+ if (field.kind === "json" && parsedFieldValue(field, value) === void 0) {
3976
+ return "Enter valid JSON.";
3977
+ }
3978
+ return "";
3979
+ }
3980
+ function optionKey(option) {
3981
+ return JSON.stringify(option.value);
3982
+ }
3983
+ function valuesMatch(left, right) {
3984
+ return JSON.stringify(left) === JSON.stringify(right);
3985
+ }
3986
+ function FieldDescription({
3987
+ field,
3988
+ id
3989
+ }) {
3990
+ return field.description ? /* @__PURE__ */ jsx7("span", { id, className: "tool-input-card__description", children: field.description }) : null;
3991
+ }
3992
+ function ChoiceField({
3993
+ field,
3994
+ id,
3995
+ value,
3996
+ disabled,
3997
+ describedBy,
3998
+ error,
3999
+ onBlur,
4000
+ onChange
4001
+ }) {
4002
+ const options = field.options ?? [];
4003
+ const multiple = field.kind === "multi-select";
4004
+ const selected = Array.isArray(value) ? value : [];
4005
+ if (field.kind === "select") {
4006
+ const selectedIndex = options.findIndex(
4007
+ (option) => valuesMatch(option.value, value)
4008
+ );
4009
+ return /* @__PURE__ */ jsxs7(
4010
+ "select",
4011
+ {
4012
+ id,
4013
+ value: selectedIndex >= 0 ? String(selectedIndex) : "",
4014
+ disabled,
4015
+ required: field.required,
4016
+ "aria-describedby": describedBy,
4017
+ "aria-invalid": Boolean(error),
4018
+ onBlur,
4019
+ onChange: (event) => {
4020
+ const option = options[Number(event.target.value)];
4021
+ if (option) onChange(option.value);
4022
+ },
4023
+ children: [
4024
+ /* @__PURE__ */ jsx7("option", { value: "", disabled: field.required, children: "Choose an option" }),
4025
+ options.map((option, index) => /* @__PURE__ */ jsx7("option", { value: index, children: option.label }, optionKey(option)))
4026
+ ]
4027
+ }
4028
+ );
4029
+ }
4030
+ return /* @__PURE__ */ jsx7(
4031
+ "div",
4032
+ {
4033
+ className: "tool-input-card__choices",
4034
+ role: multiple ? "group" : "radiogroup",
4035
+ "aria-labelledby": `${id}-label`,
4036
+ "aria-describedby": describedBy,
4037
+ "aria-invalid": Boolean(error),
4038
+ "aria-required": field.required,
4039
+ children: options.map((option, index) => {
4040
+ const checked = multiple ? selected.some((item) => valuesMatch(item, option.value)) : valuesMatch(value, option.value);
4041
+ return /* @__PURE__ */ jsxs7("label", { className: "tool-input-card__choice", children: [
4042
+ /* @__PURE__ */ jsx7(
4043
+ "input",
4044
+ {
4045
+ type: multiple ? "checkbox" : "radio",
4046
+ name: id,
4047
+ value: String(index),
4048
+ checked,
4049
+ disabled,
4050
+ onBlur,
4051
+ onChange: () => {
4052
+ if (!multiple) {
4053
+ onChange(option.value);
4054
+ return;
4055
+ }
4056
+ onChange(
4057
+ checked ? selected.filter(
4058
+ (item) => !valuesMatch(item, option.value)
4059
+ ) : [...selected, option.value]
4060
+ );
4061
+ }
4062
+ }
4063
+ ),
4064
+ /* @__PURE__ */ jsx7("span", { children: option.label })
4065
+ ] }, optionKey(option));
4066
+ })
4067
+ }
4068
+ );
4069
+ }
4070
+ function ToolField({
4071
+ disabled,
4072
+ error,
4073
+ field,
4074
+ id,
4075
+ value,
4076
+ onBlur,
4077
+ onChange
4078
+ }) {
4079
+ const describedBy = [
4080
+ field.description ? `${id}-description` : "",
4081
+ error ? `${id}-error` : ""
4082
+ ].filter(Boolean).join(" ");
4083
+ if (field.kind === "checkbox" || field.kind === "confirmation") {
4084
+ return /* @__PURE__ */ jsxs7("div", { className: "tool-input-card__field", children: [
4085
+ /* @__PURE__ */ jsxs7("label", { className: "tool-input-card__check", htmlFor: id, children: [
4086
+ /* @__PURE__ */ jsx7(
4087
+ "input",
4088
+ {
4089
+ id,
4090
+ type: "checkbox",
4091
+ checked: value === true,
4092
+ disabled,
4093
+ "aria-describedby": describedBy || void 0,
4094
+ "aria-invalid": Boolean(error),
4095
+ onBlur,
4096
+ onChange: (event) => onChange(event.target.checked)
4097
+ }
4098
+ ),
4099
+ /* @__PURE__ */ jsxs7("span", { children: [
4100
+ /* @__PURE__ */ jsx7("strong", { children: field.label }),
4101
+ field.description ? /* @__PURE__ */ jsx7("span", { id: `${id}-description`, children: field.description }) : null
4102
+ ] })
4103
+ ] }),
4104
+ error ? /* @__PURE__ */ jsx7("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
4105
+ ] });
4106
+ }
4107
+ const label = /* @__PURE__ */ jsxs7("label", { id: `${id}-label`, htmlFor: id, children: [
4108
+ field.label,
4109
+ field.required ? /* @__PURE__ */ jsx7("span", { "aria-hidden": "true", children: " *" }) : null
4110
+ ] });
4111
+ const common = {
4112
+ id,
4113
+ disabled,
4114
+ required: field.required,
4115
+ "aria-describedby": describedBy || void 0,
4116
+ "aria-invalid": Boolean(error),
4117
+ onBlur
4118
+ };
4119
+ let control;
4120
+ if (field.kind === "select" || field.kind === "radio" || field.kind === "multi-select") {
4121
+ control = /* @__PURE__ */ jsx7(
4122
+ ChoiceField,
4123
+ {
4124
+ field,
4125
+ id,
4126
+ value,
4127
+ disabled,
4128
+ describedBy: describedBy || void 0,
4129
+ error,
4130
+ onBlur,
4131
+ onChange
4132
+ }
4133
+ );
4134
+ } else if (field.kind === "textarea" || field.kind === "json") {
4135
+ control = /* @__PURE__ */ jsx7(
4136
+ "textarea",
4137
+ {
4138
+ ...common,
4139
+ rows: field.kind === "json" ? 4 : 3,
4140
+ maxLength: field.maxLength,
4141
+ minLength: field.minLength,
4142
+ placeholder: field.placeholder,
4143
+ value: typeof value === "string" ? value : JSON.stringify(value),
4144
+ onChange: (event) => onChange(event.target.value)
4145
+ }
4146
+ );
4147
+ } else if (field.kind === "range") {
4148
+ const numericValue = typeof value === "number" ? value : field.min ?? 0;
4149
+ control = /* @__PURE__ */ jsxs7("div", { className: "tool-input-card__range", children: [
4150
+ /* @__PURE__ */ jsx7(
4151
+ "input",
4152
+ {
4153
+ ...common,
4154
+ type: "range",
4155
+ min: field.min,
4156
+ max: field.max,
4157
+ step: field.step,
4158
+ value: numericValue,
4159
+ onChange: (event) => onChange(Number(event.target.value))
4160
+ }
4161
+ ),
4162
+ /* @__PURE__ */ jsx7("output", { htmlFor: id, children: numericValue })
4163
+ ] });
4164
+ } else {
4165
+ const type = field.kind === "date-time" ? "datetime-local" : field.kind === "calendar" ? "date" : field.kind;
4166
+ control = /* @__PURE__ */ jsx7(
4167
+ "input",
4168
+ {
4169
+ ...common,
4170
+ type,
4171
+ min: field.min,
4172
+ max: field.max,
4173
+ step: field.step,
4174
+ minLength: field.minLength,
4175
+ maxLength: field.maxLength,
4176
+ placeholder: field.placeholder,
4177
+ value: typeof value === "number" || typeof value === "string" ? value : "",
4178
+ onChange: (event) => onChange(
4179
+ field.kind === "number" && event.target.value !== "" ? Number(event.target.value) : event.target.value
4180
+ )
4181
+ }
4182
+ );
4183
+ }
4184
+ return /* @__PURE__ */ jsxs7("div", { className: "tool-input-card__field", children: [
4185
+ label,
4186
+ /* @__PURE__ */ jsx7(FieldDescription, { field, id: `${id}-description` }),
4187
+ control,
4188
+ error ? /* @__PURE__ */ jsx7("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
4189
+ ] });
4190
+ }
4191
+ function ToolInputCard({
4192
+ disabled = false,
4193
+ surface,
4194
+ onSubmit
4195
+ }) {
4196
+ const [values, setValues] = useState6(
4197
+ () => initialValues(surface)
4198
+ );
4199
+ const [touched, setTouched] = useState6(() => /* @__PURE__ */ new Set());
4200
+ const [submitted, setSubmitted] = useState6(false);
4201
+ const errors = Object.fromEntries(
4202
+ surface.fields.map((field) => [
4203
+ field.path,
4204
+ touched.has(field.path) ? validateField(field, values[field.path] ?? "") : ""
4205
+ ])
4206
+ );
4207
+ function submit(event) {
4208
+ event.preventDefault();
4209
+ if (disabled || submitted) return;
4210
+ const allTouched = new Set(surface.fields.map((field) => field.path));
4211
+ setTouched(allTouched);
4212
+ const nextErrors = surface.fields.map(
4213
+ (field) => validateField(field, values[field.path] ?? "")
4214
+ );
4215
+ if (nextErrors.some(Boolean)) return;
4216
+ const result = isRecord4(surface.values) ? cloneJsonValue(surface.values) : {};
4217
+ for (const field of surface.fields) {
4218
+ const parsed = parsedFieldValue(field, values[field.path] ?? "");
4219
+ if (parsed !== void 0) assignPath(result, field.path, parsed);
4220
+ }
4221
+ setSubmitted(true);
4222
+ onSubmit?.(surface, result);
4223
+ }
4224
+ if (submitted) {
4225
+ return /* @__PURE__ */ jsxs7(
4226
+ "section",
4227
+ {
4228
+ className: "tool-input-card tool-input-card--submitted",
4229
+ role: "status",
4230
+ children: [
4231
+ /* @__PURE__ */ jsx7("span", { "aria-hidden": "true", children: "\u2713" }),
4232
+ /* @__PURE__ */ jsxs7("strong", { children: [
4233
+ surface.title,
4234
+ " submitted"
4235
+ ] })
4236
+ ]
4237
+ }
4238
+ );
4239
+ }
4240
+ return /* @__PURE__ */ jsxs7(
4241
+ "section",
4242
+ {
4243
+ className: "tool-input-card",
4244
+ "aria-labelledby": `tool-input-${surface.id}`,
4245
+ children: [
4246
+ /* @__PURE__ */ jsxs7("div", { className: "tool-input-card__heading", children: [
4247
+ /* @__PURE__ */ jsx7("strong", { id: `tool-input-${surface.id}`, children: surface.title }),
4248
+ surface.description ? /* @__PURE__ */ jsx7("p", { children: surface.description }) : null
4249
+ ] }),
4250
+ /* @__PURE__ */ jsxs7("form", { noValidate: true, onSubmit: submit, children: [
4251
+ /* @__PURE__ */ jsx7("div", { className: "tool-input-card__fields", children: surface.fields.map((field, index) => /* @__PURE__ */ jsx7(
4252
+ ToolField,
4253
+ {
4254
+ disabled,
4255
+ error: errors[field.path] ?? "",
4256
+ field,
4257
+ id: `tool-input-${surface.id}-${index}`,
4258
+ value: values[field.path] ?? "",
4259
+ onBlur: () => setTouched((current) => /* @__PURE__ */ new Set([...current, field.path])),
4260
+ onChange: (value) => setValues((current) => ({ ...current, [field.path]: value }))
4261
+ },
4262
+ field.path
4263
+ )) }),
4264
+ /* @__PURE__ */ jsxs7("div", { className: "tool-input-card__actions", children: [
4265
+ surface.actions?.some((action) => action.id === "reset") ? /* @__PURE__ */ jsx7(
4266
+ "button",
4267
+ {
4268
+ type: "button",
4269
+ className: "tool-input-card__secondary",
4270
+ disabled,
4271
+ onClick: () => {
4272
+ setValues(initialValues(surface));
4273
+ setTouched(/* @__PURE__ */ new Set());
4274
+ },
4275
+ children: surface.actions.find((action) => action.id === "reset")?.label ?? "Clear"
4276
+ }
4277
+ ) : null,
4278
+ /* @__PURE__ */ jsx7("button", { type: "submit", disabled, children: surface.submitLabel ?? surface.actions?.find((action) => action.id === "submit")?.label ?? "Continue" })
4279
+ ] })
4280
+ ] })
4281
+ ]
4282
+ }
4283
+ );
4284
+ }
4285
+
4286
+ // src/react/components/HumanInputCard/HumanInputCard.tsx
4287
+ import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
3826
4288
  function HumanInputCard({
3827
4289
  disabled = false,
3828
4290
  request,
3829
4291
  onRespond
3830
4292
  }) {
3831
- const [text, setText] = useState6("");
4293
+ const [text, setText] = useState7("");
3832
4294
  const options = request.options ?? [];
3833
4295
  const showText = request.display === "text" || request.allowFreeform && options.length === 0;
4296
+ if (request.ui) {
4297
+ return /* @__PURE__ */ jsx8(
4298
+ ToolInputCard,
4299
+ {
4300
+ disabled,
4301
+ surface: request.ui,
4302
+ onSubmit: (_, value) => onRespond?.({ requestId: request.requestId, value })
4303
+ }
4304
+ );
4305
+ }
3834
4306
  if (options.length > 0) {
3835
- return /* @__PURE__ */ jsx7(
4307
+ return /* @__PURE__ */ jsx8(
3836
4308
  ConfirmationCard,
3837
4309
  {
3838
4310
  disabled,
@@ -3847,17 +4319,17 @@ function HumanInputCard({
3847
4319
  if (!value || disabled) return;
3848
4320
  onRespond?.({ requestId: request.requestId, text: value });
3849
4321
  }
3850
- return /* @__PURE__ */ jsxs7(
4322
+ return /* @__PURE__ */ jsxs8(
3851
4323
  "section",
3852
4324
  {
3853
4325
  className: "human-input-card",
3854
4326
  "aria-labelledby": `human-input-${request.requestId}`,
3855
4327
  children: [
3856
- /* @__PURE__ */ jsx7("div", { className: "human-input-card__heading", children: /* @__PURE__ */ jsx7("strong", { id: `human-input-${request.requestId}`, children: request.prompt }) }),
3857
- showText ? /* @__PURE__ */ jsxs7("form", { onSubmit: submitText, children: [
3858
- /* @__PURE__ */ jsx7("label", { htmlFor: `human-input-text-${request.requestId}`, children: "Response" }),
3859
- /* @__PURE__ */ jsxs7("div", { children: [
3860
- /* @__PURE__ */ jsx7(
4328
+ /* @__PURE__ */ jsx8("div", { className: "human-input-card__heading", children: /* @__PURE__ */ jsx8("strong", { id: `human-input-${request.requestId}`, children: request.prompt }) }),
4329
+ showText ? /* @__PURE__ */ jsxs8("form", { onSubmit: submitText, children: [
4330
+ /* @__PURE__ */ jsx8("label", { htmlFor: `human-input-text-${request.requestId}`, children: "Response" }),
4331
+ /* @__PURE__ */ jsxs8("div", { children: [
4332
+ /* @__PURE__ */ jsx8(
3861
4333
  "input",
3862
4334
  {
3863
4335
  id: `human-input-text-${request.requestId}`,
@@ -3866,39 +4338,39 @@ function HumanInputCard({
3866
4338
  onChange: (event) => setText(event.target.value)
3867
4339
  }
3868
4340
  ),
3869
- /* @__PURE__ */ jsx7("button", { type: "submit", disabled: disabled || !text.trim(), children: "Send" })
4341
+ /* @__PURE__ */ jsx8("button", { type: "submit", disabled: disabled || !text.trim(), children: "Send" })
3870
4342
  ] })
3871
4343
  ] }) : null,
3872
- !showText && options.length === 0 ? /* @__PURE__ */ jsx7("p", { className: "human-input-card__unavailable", role: "status", children: "This request can\u2019t be answered here." }) : null
4344
+ !showText && options.length === 0 ? /* @__PURE__ */ jsx8("p", { className: "human-input-card__unavailable", role: "status", children: "This request can\u2019t be answered here." }) : null
3873
4345
  ]
3874
4346
  }
3875
4347
  );
3876
4348
  }
3877
4349
 
3878
4350
  // src/react/components/CollectionResultCard/CollectionResultCard.tsx
3879
- import { jsx as jsx8, jsxs as jsxs8 } from "react/jsx-runtime";
4351
+ import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
3880
4352
  function CollectionResultCard({
3881
4353
  result
3882
4354
  }) {
3883
4355
  const empty = result.items.length === 0;
3884
- return /* @__PURE__ */ jsxs8(
4356
+ return /* @__PURE__ */ jsxs9(
3885
4357
  "section",
3886
4358
  {
3887
4359
  className: `collection-result-card tool-result-card tool-result-card--${result.status}`,
3888
4360
  "aria-label": result.title,
3889
4361
  children: [
3890
- /* @__PURE__ */ jsxs8("div", { className: "tool-result-card__heading", children: [
3891
- /* @__PURE__ */ jsx8("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
3892
- /* @__PURE__ */ jsx8("strong", { children: result.title })
4362
+ /* @__PURE__ */ jsxs9("div", { className: "tool-result-card__heading", children: [
4363
+ /* @__PURE__ */ jsx9("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4364
+ /* @__PURE__ */ jsx9("strong", { children: result.title })
3893
4365
  ] }),
3894
- empty ? /* @__PURE__ */ jsx8("p", { className: "collection-result-card__empty", children: "No matching record for the email you shared." }) : /* @__PURE__ */ jsx8("ul", { className: "collection-result-card__list", children: result.items.map((item) => /* @__PURE__ */ jsxs8("li", { children: [
3895
- /* @__PURE__ */ jsx8("div", { className: "collection-result-card__item-title", children: item.title }),
3896
- item.description ? /* @__PURE__ */ jsx8("p", { children: item.description }) : null,
3897
- item.details?.length ? /* @__PURE__ */ jsx8("dl", { children: item.details.map((detail) => /* @__PURE__ */ jsxs8("div", { children: [
3898
- /* @__PURE__ */ jsx8("dt", { children: detail.label }),
3899
- /* @__PURE__ */ jsx8("dd", { children: detail.value })
4366
+ empty ? /* @__PURE__ */ jsx9("p", { className: "collection-result-card__empty", children: "No matching record for the email you shared." }) : /* @__PURE__ */ jsx9("ul", { className: "collection-result-card__list", children: result.items.map((item) => /* @__PURE__ */ jsxs9("li", { children: [
4367
+ /* @__PURE__ */ jsx9("div", { className: "collection-result-card__item-title", children: item.title }),
4368
+ item.description ? /* @__PURE__ */ jsx9("p", { children: item.description }) : null,
4369
+ item.details?.length ? /* @__PURE__ */ jsx9("dl", { children: item.details.map((detail) => /* @__PURE__ */ jsxs9("div", { children: [
4370
+ /* @__PURE__ */ jsx9("dt", { children: detail.label }),
4371
+ /* @__PURE__ */ jsx9("dd", { children: detail.value })
3900
4372
  ] }, `${detail.label}:${detail.value}`)) }) : null,
3901
- item.href ? /* @__PURE__ */ jsx8("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
4373
+ item.href ? /* @__PURE__ */ jsx9("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
3902
4374
  ] }, item.title)) })
3903
4375
  ]
3904
4376
  }
@@ -3906,26 +4378,26 @@ function CollectionResultCard({
3906
4378
  }
3907
4379
 
3908
4380
  // src/react/components/EntityResultCard/EntityResultCard.tsx
3909
- import { jsx as jsx9, jsxs as jsxs9 } from "react/jsx-runtime";
4381
+ import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
3910
4382
  function EntityResultCard({
3911
4383
  result
3912
4384
  }) {
3913
- return /* @__PURE__ */ jsxs9(
4385
+ return /* @__PURE__ */ jsxs10(
3914
4386
  "section",
3915
4387
  {
3916
4388
  className: `entity-result-card tool-result-card tool-result-card--${result.status}`,
3917
4389
  "aria-label": result.title,
3918
4390
  children: [
3919
- /* @__PURE__ */ jsxs9("div", { className: "tool-result-card__heading", children: [
3920
- /* @__PURE__ */ jsx9("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
3921
- /* @__PURE__ */ jsx9("strong", { children: result.title })
4391
+ /* @__PURE__ */ jsxs10("div", { className: "tool-result-card__heading", children: [
4392
+ /* @__PURE__ */ jsx10("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4393
+ /* @__PURE__ */ jsx10("strong", { children: result.title })
3922
4394
  ] }),
3923
- result.description ? /* @__PURE__ */ jsx9("p", { children: result.description }) : null,
3924
- result.details?.length ? /* @__PURE__ */ jsx9("dl", { children: result.details.map((detail) => /* @__PURE__ */ jsxs9("div", { children: [
3925
- /* @__PURE__ */ jsx9("dt", { children: detail.label }),
3926
- /* @__PURE__ */ jsx9("dd", { children: detail.value })
4395
+ result.description ? /* @__PURE__ */ jsx10("p", { children: result.description }) : null,
4396
+ result.details?.length ? /* @__PURE__ */ jsx10("dl", { children: result.details.map((detail) => /* @__PURE__ */ jsxs10("div", { children: [
4397
+ /* @__PURE__ */ jsx10("dt", { children: detail.label }),
4398
+ /* @__PURE__ */ jsx10("dd", { children: detail.value })
3927
4399
  ] }, `${detail.label}:${detail.value}`)) }) : null,
3928
- result.links?.length ? /* @__PURE__ */ jsx9("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ jsx9(
4400
+ result.links?.length ? /* @__PURE__ */ jsx10("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ jsx10(
3929
4401
  "a",
3930
4402
  {
3931
4403
  href: link.href,
@@ -3941,24 +4413,24 @@ function EntityResultCard({
3941
4413
  }
3942
4414
 
3943
4415
  // src/react/components/SignatureResultCard/SignatureResultCard.tsx
3944
- import { jsx as jsx10, jsxs as jsxs10 } from "react/jsx-runtime";
4416
+ import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
3945
4417
  function SignatureResultCard({
3946
4418
  result
3947
4419
  }) {
3948
4420
  const primaryLink = result.links?.[0];
3949
- return /* @__PURE__ */ jsxs10(
4421
+ return /* @__PURE__ */ jsxs11(
3950
4422
  "section",
3951
4423
  {
3952
4424
  className: `signature-result-card tool-result-card tool-result-card--${result.status}`,
3953
4425
  "aria-label": result.title,
3954
4426
  children: [
3955
- /* @__PURE__ */ jsxs10("div", { className: "tool-result-card__heading", children: [
3956
- /* @__PURE__ */ jsx10("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
3957
- /* @__PURE__ */ jsx10("strong", { children: result.title })
4427
+ /* @__PURE__ */ jsxs11("div", { className: "tool-result-card__heading", children: [
4428
+ /* @__PURE__ */ jsx11("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4429
+ /* @__PURE__ */ jsx11("strong", { children: result.title })
3958
4430
  ] }),
3959
- result.statusLabel ? /* @__PURE__ */ jsx10("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
3960
- result.description ? /* @__PURE__ */ jsx10("p", { children: result.description }) : null,
3961
- primaryLink ? /* @__PURE__ */ jsx10(
4431
+ result.statusLabel ? /* @__PURE__ */ jsx11("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
4432
+ result.description ? /* @__PURE__ */ jsx11("p", { children: result.description }) : null,
4433
+ primaryLink ? /* @__PURE__ */ jsx11(
3962
4434
  "a",
3963
4435
  {
3964
4436
  className: "signature-result-card__cta",
@@ -3974,26 +4446,26 @@ function SignatureResultCard({
3974
4446
  }
3975
4447
 
3976
4448
  // src/react/components/ToolResultCard/ToolResultCard.tsx
3977
- import { jsx as jsx11, jsxs as jsxs11 } from "react/jsx-runtime";
4449
+ import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
3978
4450
  function ToolResultCard({
3979
4451
  result
3980
4452
  }) {
3981
- return /* @__PURE__ */ jsxs11(
4453
+ return /* @__PURE__ */ jsxs12(
3982
4454
  "section",
3983
4455
  {
3984
4456
  className: `tool-result-card tool-result-card--${result.status}`,
3985
4457
  "aria-label": result.title,
3986
4458
  children: [
3987
- /* @__PURE__ */ jsxs11("div", { className: "tool-result-card__heading", children: [
3988
- /* @__PURE__ */ jsx11("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
3989
- /* @__PURE__ */ jsx11("strong", { children: result.title })
4459
+ /* @__PURE__ */ jsxs12("div", { className: "tool-result-card__heading", children: [
4460
+ /* @__PURE__ */ jsx12("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4461
+ /* @__PURE__ */ jsx12("strong", { children: result.title })
3990
4462
  ] }),
3991
- result.description ? /* @__PURE__ */ jsx11("p", { children: result.description }) : null,
3992
- result.details?.length ? /* @__PURE__ */ jsx11("dl", { children: result.details.map((detail) => /* @__PURE__ */ jsxs11("div", { children: [
3993
- /* @__PURE__ */ jsx11("dt", { children: detail.label }),
3994
- /* @__PURE__ */ jsx11("dd", { children: detail.value })
4463
+ result.description ? /* @__PURE__ */ jsx12("p", { children: result.description }) : null,
4464
+ result.details?.length ? /* @__PURE__ */ jsx12("dl", { children: result.details.map((detail) => /* @__PURE__ */ jsxs12("div", { children: [
4465
+ /* @__PURE__ */ jsx12("dt", { children: detail.label }),
4466
+ /* @__PURE__ */ jsx12("dd", { children: detail.value })
3995
4467
  ] }, `${detail.label}:${detail.value}`)) }) : null,
3996
- result.links?.length ? /* @__PURE__ */ jsx11("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ jsx11(
4468
+ result.links?.length ? /* @__PURE__ */ jsx12("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ jsx12(
3997
4469
  "a",
3998
4470
  {
3999
4471
  href: link.href,
@@ -4009,32 +4481,44 @@ function ToolResultCard({
4009
4481
  }
4010
4482
 
4011
4483
  // src/react/components/VisitorToolResultView/VisitorToolResultView.tsx
4012
- import { jsx as jsx12 } from "react/jsx-runtime";
4484
+ import { jsx as jsx13 } from "react/jsx-runtime";
4013
4485
  function VisitorToolResultView({
4486
+ disabled = false,
4487
+ onToolInput,
4014
4488
  result
4015
4489
  }) {
4490
+ if (result.kind === "input") {
4491
+ return /* @__PURE__ */ jsx13(
4492
+ ToolInputCard,
4493
+ {
4494
+ disabled,
4495
+ surface: result.surface,
4496
+ onSubmit: onToolInput
4497
+ }
4498
+ );
4499
+ }
4016
4500
  if (result.kind === "entity") {
4017
- return /* @__PURE__ */ jsx12(EntityResultCard, { result });
4501
+ return /* @__PURE__ */ jsx13(EntityResultCard, { result });
4018
4502
  }
4019
4503
  if (result.kind === "collection") {
4020
- return /* @__PURE__ */ jsx12(CollectionResultCard, { result });
4504
+ return /* @__PURE__ */ jsx13(CollectionResultCard, { result });
4021
4505
  }
4022
4506
  if (result.kind === "signature") {
4023
- return /* @__PURE__ */ jsx12(SignatureResultCard, { result });
4507
+ return /* @__PURE__ */ jsx13(SignatureResultCard, { result });
4024
4508
  }
4025
4509
  if (result.kind === "summary") {
4026
- return /* @__PURE__ */ jsx12(ToolResultCard, { result });
4510
+ return /* @__PURE__ */ jsx13(ToolResultCard, { result });
4027
4511
  }
4028
4512
  return null;
4029
4513
  }
4030
4514
  function isRenderableVisitorToolResult(result) {
4031
- return result.kind === "summary" || result.kind === "entity" || result.kind === "collection" || result.kind === "signature";
4515
+ return result.kind === "summary" || result.kind === "input" || result.kind === "entity" || result.kind === "collection" || result.kind === "signature";
4032
4516
  }
4033
4517
 
4034
4518
  // src/react/components/AgentRail/AgentRail.tsx
4035
- import { Fragment, jsx as jsx13, jsxs as jsxs12 } from "react/jsx-runtime";
4519
+ import { Fragment, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
4036
4520
  function MinimizeIcon() {
4037
- return /* @__PURE__ */ jsx13("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx13(
4521
+ return /* @__PURE__ */ jsx14("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx14(
4038
4522
  "path",
4039
4523
  {
4040
4524
  d: "M3.5 8h9",
@@ -4045,7 +4529,7 @@ function MinimizeIcon() {
4045
4529
  ) });
4046
4530
  }
4047
4531
  function CloseIcon() {
4048
- return /* @__PURE__ */ jsx13("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx13(
4532
+ return /* @__PURE__ */ jsx14("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx14(
4049
4533
  "path",
4050
4534
  {
4051
4535
  d: "M4 4l8 8M12 4l-8 8",
@@ -4056,7 +4540,7 @@ function CloseIcon() {
4056
4540
  ) });
4057
4541
  }
4058
4542
  function NewChatIcon() {
4059
- return /* @__PURE__ */ jsx13("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx13(
4543
+ return /* @__PURE__ */ jsx14("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx14(
4060
4544
  "path",
4061
4545
  {
4062
4546
  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",
@@ -4068,7 +4552,7 @@ function NewChatIcon() {
4068
4552
  ) });
4069
4553
  }
4070
4554
  function ExpandIcon() {
4071
- return /* @__PURE__ */ jsx13("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx13(
4555
+ return /* @__PURE__ */ jsx14("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx14(
4072
4556
  "path",
4073
4557
  {
4074
4558
  d: "M6 3.5H3.5V6M10 3.5h2.5V6M10 12.5h2.5V10M6 12.5H3.5V10",
@@ -4080,7 +4564,7 @@ function ExpandIcon() {
4080
4564
  ) });
4081
4565
  }
4082
4566
  function RestoreIcon() {
4083
- return /* @__PURE__ */ jsx13("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx13(
4567
+ return /* @__PURE__ */ jsx14("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx14(
4084
4568
  "path",
4085
4569
  {
4086
4570
  d: "M5.5 5.5H3.5V7.5M10.5 5.5h2V7.5M10.5 10.5h2V8.5M5.5 10.5H3.5V8.5",
@@ -4109,12 +4593,13 @@ function AgentRail({
4109
4593
  onSubmit,
4110
4594
  onFollowUpSelect,
4111
4595
  onBook,
4112
- onInputResponse
4596
+ onInputResponse,
4597
+ onToolInput
4113
4598
  }) {
4114
4599
  const transcriptRef = useRef3(null);
4115
4600
  const resolvedBrandLabel = brandLabel.trim();
4116
4601
  const resolvedBrandLogoUrl = brandLogoUrl?.trim();
4117
- const [failedLogoUrl, setFailedLogoUrl] = useState7(null);
4602
+ const [failedLogoUrl, setFailedLogoUrl] = useState8(null);
4118
4603
  const showBrandLogo = Boolean(resolvedBrandLogoUrl) && failedLogoUrl !== resolvedBrandLogoUrl;
4119
4604
  const resolvedColorScheme = useAgentColorScheme(colorScheme);
4120
4605
  const brandedTheme = { ...defaultAgentRailTheme, ...theme };
@@ -4125,6 +4610,7 @@ function AgentRail({
4125
4610
  brandSoft: theme?.brandSoft ?? `color-mix(in srgb, ${theme?.brand ?? defaultDarkAgentRailTheme.brand} 18%, ${defaultDarkAgentRailTheme.surface})`,
4126
4611
  border: theme?.border ?? defaultDarkAgentRailTheme.border,
4127
4612
  danger: theme?.danger ?? defaultDarkAgentRailTheme.danger,
4613
+ onBrand: theme?.onBrand ?? defaultDarkAgentRailTheme.onBrand,
4128
4614
  success: theme?.success ?? defaultDarkAgentRailTheme.success,
4129
4615
  surface: theme?.surface ?? defaultDarkAgentRailTheme.surface,
4130
4616
  surfaceMuted: theme?.surfaceMuted ?? defaultDarkAgentRailTheme.surfaceMuted,
@@ -4147,6 +4633,7 @@ function AgentRail({
4147
4633
  "--as-border": resolvedTheme.border,
4148
4634
  "--as-visitor-bubble": resolvedTheme.visitorBubble,
4149
4635
  "--as-visitor-text": resolvedTheme.visitorText,
4636
+ "--as-on-brand": resolvedTheme.onBrand,
4150
4637
  "--as-success": resolvedTheme.success,
4151
4638
  "--as-danger": resolvedTheme.danger,
4152
4639
  "--as-font-body": resolvedTheme.fontBody,
@@ -4158,10 +4645,12 @@ function AgentRail({
4158
4645
  );
4159
4646
  const isBusy = state.phase === "thinking" || state.phase === "running-tools" || state.phase === "streaming" || state.phase === "waiting-input" && pendingInputRequests.length > 0;
4160
4647
  const semanticSurfaceDisabled = isBusy && state.phase !== "waiting-input";
4161
- const showActivity = state.toolSteps.length > 0;
4162
4648
  const visitorToolResults = (state.toolResults ?? []).filter(
4163
4649
  isRenderableVisitorToolResult
4164
4650
  );
4651
+ const activeVisitorToolInput = [...visitorToolResults].reverse().find((result) => result.kind === "input");
4652
+ const visibleVisitorToolResults = activeVisitorToolInput ? [activeVisitorToolInput] : visitorToolResults;
4653
+ const showActivity = state.toolSteps.length > 0 && visibleVisitorToolResults.length === 0 && pendingInputRequests.length === 0 && !state.pendingOffer;
4165
4654
  const hasVisitorMessages2 = state.messages.some(
4166
4655
  (message) => message.role === "visitor"
4167
4656
  );
@@ -4202,10 +4691,14 @@ function AgentRail({
4202
4691
  const bookingReadyText = state.streamingText || (lastIsAgent && lastMessage?.role === "agent" ? lastMessage.text : "");
4203
4692
  const waitingForBooking = !state.pendingOffer && looksLikeBookingReady(bookingReadyText) && (state.phase === "thinking" || state.phase === "running-tools" || state.phase === "streaming");
4204
4693
  const lastAgentText = lastIsAgent && lastMessage?.role === "agent" ? lastMessage.text : "";
4694
+ const hasPendingConfirmation = pendingInputRequests.some(
4695
+ (request) => request.kind === "tool-approval" || request.kind === "question" && (request.options?.length ?? 0) > 0
4696
+ );
4205
4697
  const composerForm = resolveComposerForm({
4206
4698
  agentText: lastAgentText,
4207
4699
  cards: extractToolCards(lastAgentText),
4208
4700
  hasBookingOffer: Boolean(state.pendingOffer) || waitingForBooking,
4701
+ hasPendingConfirmation,
4209
4702
  enabled: lastIsAgent && !isBusy
4210
4703
  });
4211
4704
  useEffect3(() => {
@@ -4219,7 +4712,7 @@ function AgentRail({
4219
4712
  state.followUps,
4220
4713
  state.journey
4221
4714
  ]);
4222
- return /* @__PURE__ */ jsxs12(
4715
+ return /* @__PURE__ */ jsxs13(
4223
4716
  "aside",
4224
4717
  {
4225
4718
  className: `agent-rail not-typeset${mobileFullscreen ? " agent-rail--mobile-fullscreen" : ""}${expanded ? " agent-rail--expanded" : ""}`,
@@ -4233,28 +4726,28 @@ function AgentRail({
4233
4726
  role: mobileFullscreen || expanded ? "dialog" : void 0,
4234
4727
  tabIndex: mobileFullscreen || expanded ? -1 : void 0,
4235
4728
  children: [
4236
- /* @__PURE__ */ jsx13("header", { className: "agent-rail__header", children: /* @__PURE__ */ jsxs12("div", { className: "agent-rail__brand-row", children: [
4237
- onCollapse ? /* @__PURE__ */ jsx13(
4729
+ /* @__PURE__ */ jsx14("header", { className: "agent-rail__header", children: /* @__PURE__ */ jsxs13("div", { className: "agent-rail__brand-row", children: [
4730
+ onCollapse ? /* @__PURE__ */ jsx14(
4238
4731
  "button",
4239
4732
  {
4240
4733
  type: "button",
4241
4734
  className: "agent-rail__collapse",
4242
4735
  "aria-label": "Collapse assist",
4243
4736
  onClick: onCollapse,
4244
- children: /* @__PURE__ */ jsx13(MinimizeIcon, {})
4737
+ children: /* @__PURE__ */ jsx14(MinimizeIcon, {})
4245
4738
  }
4246
- ) : onClose ? /* @__PURE__ */ jsx13(
4739
+ ) : onClose ? /* @__PURE__ */ jsx14(
4247
4740
  "button",
4248
4741
  {
4249
4742
  type: "button",
4250
4743
  className: "agent-rail__close",
4251
4744
  "aria-label": "Close agent",
4252
4745
  onClick: onClose,
4253
- children: /* @__PURE__ */ jsx13(CloseIcon, {})
4746
+ children: /* @__PURE__ */ jsx14(CloseIcon, {})
4254
4747
  }
4255
- ) : /* @__PURE__ */ jsx13("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
4256
- resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ jsxs12("span", { className: "agent-rail__identity", children: [
4257
- showBrandLogo ? /* @__PURE__ */ jsx13("span", { className: "agent-rail__brand-mark", "aria-hidden": "true", children: /* @__PURE__ */ jsx13(
4748
+ ) : /* @__PURE__ */ jsx14("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
4749
+ resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ jsxs13("span", { className: "agent-rail__identity", children: [
4750
+ showBrandLogo ? /* @__PURE__ */ jsx14("span", { className: "agent-rail__brand-mark", "aria-hidden": "true", children: /* @__PURE__ */ jsx14(
4258
4751
  "img",
4259
4752
  {
4260
4753
  className: "agent-rail__brand-logo",
@@ -4265,10 +4758,10 @@ function AgentRail({
4265
4758
  }
4266
4759
  }
4267
4760
  ) }) : null,
4268
- resolvedBrandLabel ? /* @__PURE__ */ jsx13("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
4761
+ resolvedBrandLabel ? /* @__PURE__ */ jsx14("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
4269
4762
  ] }) : null,
4270
- /* @__PURE__ */ jsxs12("span", { className: "agent-rail__actions", children: [
4271
- onReset ? /* @__PURE__ */ jsx13(
4763
+ /* @__PURE__ */ jsxs13("span", { className: "agent-rail__actions", children: [
4764
+ onReset ? /* @__PURE__ */ jsx14(
4272
4765
  "button",
4273
4766
  {
4274
4767
  type: "button",
@@ -4276,24 +4769,24 @@ function AgentRail({
4276
4769
  "aria-label": "Start a new conversation",
4277
4770
  disabled: !hasVisitorMessages2,
4278
4771
  onClick: onReset,
4279
- children: /* @__PURE__ */ jsx13(NewChatIcon, {})
4772
+ children: /* @__PURE__ */ jsx14(NewChatIcon, {})
4280
4773
  }
4281
4774
  ) : null,
4282
- onExpandToggle ? /* @__PURE__ */ jsx13(
4775
+ onExpandToggle ? /* @__PURE__ */ jsx14(
4283
4776
  "button",
4284
4777
  {
4285
4778
  type: "button",
4286
4779
  className: "agent-rail__expand",
4287
4780
  "aria-label": expanded ? "Exit full screen" : "Open full screen",
4288
4781
  onClick: onExpandToggle,
4289
- children: expanded ? /* @__PURE__ */ jsx13(RestoreIcon, {}) : /* @__PURE__ */ jsx13(ExpandIcon, {})
4782
+ children: expanded ? /* @__PURE__ */ jsx14(RestoreIcon, {}) : /* @__PURE__ */ jsx14(ExpandIcon, {})
4290
4783
  }
4291
4784
  ) : null
4292
4785
  ] })
4293
4786
  ] }) }),
4294
- /* @__PURE__ */ jsx13("div", { ref: transcriptRef, className: "agent-rail__transcript", children: /* @__PURE__ */ jsxs12("div", { className: "agent-rail__thread", children: [
4295
- !hasVisitorMessages2 ? /* @__PURE__ */ jsxs12("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
4296
- greeting?.role === "agent" ? /* @__PURE__ */ jsx13(
4787
+ /* @__PURE__ */ jsx14("div", { ref: transcriptRef, className: "agent-rail__transcript", children: /* @__PURE__ */ jsxs13("div", { className: "agent-rail__thread", children: [
4788
+ !hasVisitorMessages2 ? /* @__PURE__ */ jsxs13("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
4789
+ greeting?.role === "agent" ? /* @__PURE__ */ jsx14(
4297
4790
  MessageBubble,
4298
4791
  {
4299
4792
  message: greeting,
@@ -4301,7 +4794,7 @@ function AgentRail({
4301
4794
  onBook
4302
4795
  }
4303
4796
  ) : null,
4304
- showIdleFollowUps ? /* @__PURE__ */ jsx13("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ jsx13(
4797
+ showIdleFollowUps ? /* @__PURE__ */ jsx14("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ jsx14(
4305
4798
  FollowUpChips,
4306
4799
  {
4307
4800
  suggestions: state.followUps,
@@ -4310,7 +4803,7 @@ function AgentRail({
4310
4803
  onSelect: (suggestion) => onFollowUpSelect?.(suggestion.label)
4311
4804
  }
4312
4805
  ) }) : null,
4313
- showActivity ? /* @__PURE__ */ jsx13(
4806
+ showActivity ? /* @__PURE__ */ jsx14(
4314
4807
  AgentActivityBubble,
4315
4808
  {
4316
4809
  brandLabel: resolvedBrandLabel,
@@ -4319,8 +4812,16 @@ function AgentRail({
4319
4812
  steps: state.toolSteps
4320
4813
  }
4321
4814
  ) : null,
4322
- visitorToolResults.map((result) => /* @__PURE__ */ jsx13(VisitorToolResultView, { result }, result.id)),
4323
- pendingInputRequests.map((request) => /* @__PURE__ */ jsx13(
4815
+ visibleVisitorToolResults.map((result) => /* @__PURE__ */ jsx14(
4816
+ VisitorToolResultView,
4817
+ {
4818
+ result,
4819
+ disabled: semanticSurfaceDisabled,
4820
+ onToolInput
4821
+ },
4822
+ result.id
4823
+ )),
4824
+ pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ jsx14(
4324
4825
  HumanInputCard,
4325
4826
  {
4326
4827
  request,
@@ -4329,8 +4830,8 @@ function AgentRail({
4329
4830
  request.requestId
4330
4831
  ))
4331
4832
  ] }) : null,
4332
- visibleMessages.map((message, index) => /* @__PURE__ */ jsxs12("div", { className: "agent-rail__turn-block", children: [
4333
- /* @__PURE__ */ jsx13(
4833
+ visibleMessages.map((message, index) => /* @__PURE__ */ jsxs13("div", { className: "agent-rail__turn-block", children: [
4834
+ /* @__PURE__ */ jsx14(
4334
4835
  MessageBubble,
4335
4836
  {
4336
4837
  message,
@@ -4339,8 +4840,8 @@ function AgentRail({
4339
4840
  onBook
4340
4841
  }
4341
4842
  ),
4342
- index === lastVisitorIndex ? /* @__PURE__ */ jsxs12(Fragment, { children: [
4343
- showActivity ? /* @__PURE__ */ jsx13(
4843
+ index === lastVisitorIndex ? /* @__PURE__ */ jsxs13(Fragment, { children: [
4844
+ showActivity ? /* @__PURE__ */ jsx14(
4344
4845
  AgentActivityBubble,
4345
4846
  {
4346
4847
  brandLabel: resolvedBrandLabel,
@@ -4349,8 +4850,16 @@ function AgentRail({
4349
4850
  steps: state.toolSteps
4350
4851
  }
4351
4852
  ) : null,
4352
- visitorToolResults.map((result) => /* @__PURE__ */ jsx13(VisitorToolResultView, { result }, result.id)),
4353
- pendingInputRequests.map((request) => /* @__PURE__ */ jsx13(
4853
+ visibleVisitorToolResults.map((result) => /* @__PURE__ */ jsx14(
4854
+ VisitorToolResultView,
4855
+ {
4856
+ result,
4857
+ disabled: semanticSurfaceDisabled,
4858
+ onToolInput
4859
+ },
4860
+ result.id
4861
+ )),
4862
+ pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ jsx14(
4354
4863
  HumanInputCard,
4355
4864
  {
4356
4865
  request,
@@ -4360,7 +4869,7 @@ function AgentRail({
4360
4869
  ))
4361
4870
  ] }) : null
4362
4871
  ] }, message.id)),
4363
- streamingMessage ? /* @__PURE__ */ jsx13(
4872
+ streamingMessage ? /* @__PURE__ */ jsx14(
4364
4873
  MessageBubble,
4365
4874
  {
4366
4875
  message: streamingMessage,
@@ -4369,22 +4878,17 @@ function AgentRail({
4369
4878
  onBook
4370
4879
  }
4371
4880
  ) : null,
4372
- waitingForBooking ? /* @__PURE__ */ jsx13(
4373
- BookingCard,
4374
- {
4375
- offer: { type: "booking_offer", eventTypes: [], slots: [] }
4376
- }
4377
- ) : null,
4378
- state.error ? /* @__PURE__ */ jsxs12("section", { className: "agent-rail__error", role: "alert", children: [
4379
- /* @__PURE__ */ jsxs12("div", { children: [
4380
- /* @__PURE__ */ jsx13("strong", { children: "Something went wrong" }),
4381
- /* @__PURE__ */ jsx13("p", { children: state.error })
4881
+ waitingForBooking ? /* @__PURE__ */ jsx14(BookingCardLoader, {}) : null,
4882
+ state.error ? /* @__PURE__ */ jsxs13("section", { className: "agent-rail__error", role: "alert", children: [
4883
+ /* @__PURE__ */ jsxs13("div", { children: [
4884
+ /* @__PURE__ */ jsx14("strong", { children: "Something went wrong" }),
4885
+ /* @__PURE__ */ jsx14("p", { children: state.error })
4382
4886
  ] }),
4383
- onRetry ? /* @__PURE__ */ jsx13("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
4887
+ onRetry ? /* @__PURE__ */ jsx14("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
4384
4888
  ] }) : null
4385
4889
  ] }) }),
4386
- /* @__PURE__ */ jsxs12("div", { className: "agent-rail__composer-wrap", children: [
4387
- /* @__PURE__ */ jsx13(
4890
+ /* @__PURE__ */ jsxs13("div", { className: "agent-rail__composer-wrap", children: [
4891
+ /* @__PURE__ */ jsx14(
4388
4892
  Composer,
4389
4893
  {
4390
4894
  variant: expanded || mobileFullscreen ? "dock" : "default",
@@ -4394,9 +4898,9 @@ function AgentRail({
4394
4898
  onSubmit
4395
4899
  }
4396
4900
  ),
4397
- /* @__PURE__ */ jsx13("div", { className: "agent-rail__footer", children: /* @__PURE__ */ jsxs12("p", { children: [
4398
- /* @__PURE__ */ jsx13("span", { children: "AI can make mistakes. Check important info." }),
4399
- /* @__PURE__ */ jsx13("span", { children: poweredByLabel })
4901
+ /* @__PURE__ */ jsx14("div", { className: "agent-rail__footer", children: /* @__PURE__ */ jsxs13("p", { children: [
4902
+ /* @__PURE__ */ jsx14("span", { children: "AI can make mistakes. Check important info." }),
4903
+ /* @__PURE__ */ jsx14("span", { children: poweredByLabel })
4400
4904
  ] }) })
4401
4905
  ] })
4402
4906
  ]
@@ -4405,9 +4909,9 @@ function AgentRail({
4405
4909
  }
4406
4910
 
4407
4911
  // src/react/components/AssistEdgeTab/AssistEdgeTab.tsx
4408
- import { Fragment as Fragment2, jsx as jsx14, jsxs as jsxs13 } from "react/jsx-runtime";
4912
+ import { Fragment as Fragment2, jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
4409
4913
  function SparklesIcon() {
4410
- return /* @__PURE__ */ jsxs13(
4914
+ return /* @__PURE__ */ jsxs14(
4411
4915
  "svg",
4412
4916
  {
4413
4917
  className: "assist-edge-tab__sparkles",
@@ -4415,21 +4919,21 @@ function SparklesIcon() {
4415
4919
  fill: "none",
4416
4920
  "aria-hidden": "true",
4417
4921
  children: [
4418
- /* @__PURE__ */ jsx14(
4922
+ /* @__PURE__ */ jsx15(
4419
4923
  "path",
4420
4924
  {
4421
4925
  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",
4422
4926
  fill: "currentColor"
4423
4927
  }
4424
4928
  ),
4425
- /* @__PURE__ */ jsx14(
4929
+ /* @__PURE__ */ jsx15(
4426
4930
  "path",
4427
4931
  {
4428
4932
  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",
4429
4933
  fill: "currentColor"
4430
4934
  }
4431
4935
  ),
4432
- /* @__PURE__ */ jsx14(
4936
+ /* @__PURE__ */ jsx15(
4433
4937
  "path",
4434
4938
  {
4435
4939
  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",
@@ -4443,7 +4947,7 @@ function SparklesIcon() {
4443
4947
  function TabMarkIcon({ customIconUrl }) {
4444
4948
  const url = customIconUrl?.trim();
4445
4949
  if (url) {
4446
- return /* @__PURE__ */ jsx14(
4950
+ return /* @__PURE__ */ jsx15(
4447
4951
  "img",
4448
4952
  {
4449
4953
  alt: "",
@@ -4453,10 +4957,10 @@ function TabMarkIcon({ customIconUrl }) {
4453
4957
  }
4454
4958
  );
4455
4959
  }
4456
- return /* @__PURE__ */ jsx14(SparklesIcon, {});
4960
+ return /* @__PURE__ */ jsx15(SparklesIcon, {});
4457
4961
  }
4458
4962
  function ChevronLeftIcon() {
4459
- return /* @__PURE__ */ jsx14("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx14(
4963
+ return /* @__PURE__ */ jsx15("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx15(
4460
4964
  "path",
4461
4965
  {
4462
4966
  d: "M10 4L6 8l4 4",
@@ -4468,7 +4972,7 @@ function ChevronLeftIcon() {
4468
4972
  ) });
4469
4973
  }
4470
4974
  function ChevronDownIcon() {
4471
- return /* @__PURE__ */ jsx14("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx14(
4975
+ return /* @__PURE__ */ jsx15("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx15(
4472
4976
  "path",
4473
4977
  {
4474
4978
  d: "M4 6l4 4 4-4",
@@ -4480,7 +4984,7 @@ function ChevronDownIcon() {
4480
4984
  ) });
4481
4985
  }
4482
4986
  function DragDots() {
4483
- return /* @__PURE__ */ jsx14("span", { className: "assist-edge-tab__dots", "aria-hidden": "true", children: Array.from({ length: 12 }, (_, index) => /* @__PURE__ */ jsx14("i", {}, index)) });
4987
+ return /* @__PURE__ */ jsx15("span", { className: "assist-edge-tab__dots", "aria-hidden": "true", children: Array.from({ length: 12 }, (_, index) => /* @__PURE__ */ jsx15("i", {}, index)) });
4484
4988
  }
4485
4989
  var VARIANT_COPY = {
4486
4990
  outline: { label: "Ask anything", aria: "Ask anything" },
@@ -4526,7 +5030,7 @@ function AssistEdgeTab({
4526
5030
  ...resolvedTextColor ? { "--as-text": resolvedTextColor } : {},
4527
5031
  colorScheme: resolvedColorScheme
4528
5032
  };
4529
- return /* @__PURE__ */ jsxs13(
5033
+ return /* @__PURE__ */ jsxs14(
4530
5034
  "button",
4531
5035
  {
4532
5036
  type: "button",
@@ -4538,15 +5042,15 @@ function AssistEdgeTab({
4538
5042
  tabIndex: visible ? 0 : -1,
4539
5043
  onClick: onOpen,
4540
5044
  children: [
4541
- mobile ? /* @__PURE__ */ jsxs13(Fragment2, { children: [
4542
- /* @__PURE__ */ jsxs13(
5045
+ mobile ? /* @__PURE__ */ jsxs14(Fragment2, { children: [
5046
+ /* @__PURE__ */ jsxs14(
4543
5047
  "span",
4544
5048
  {
4545
5049
  className: "assist-edge-tab__mark assist-edge-tab__mark--mobile",
4546
5050
  "aria-hidden": "true",
4547
5051
  children: [
4548
- /* @__PURE__ */ jsx14(TabMarkIcon, { customIconUrl }),
4549
- showLogo ? /* @__PURE__ */ jsx14(
5052
+ /* @__PURE__ */ jsx15(TabMarkIcon, { customIconUrl }),
5053
+ showLogo ? /* @__PURE__ */ jsx15(
4550
5054
  "img",
4551
5055
  {
4552
5056
  className: "assist-edge-tab__logo",
@@ -4560,11 +5064,11 @@ function AssistEdgeTab({
4560
5064
  ]
4561
5065
  }
4562
5066
  ),
4563
- /* @__PURE__ */ jsx14("span", { className: "assist-edge-tab__label", children: visibleLabel })
4564
- ] }) : variant === "outline" ? /* @__PURE__ */ jsxs13(Fragment2, { children: [
4565
- /* @__PURE__ */ jsxs13("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
4566
- /* @__PURE__ */ jsx14(TabMarkIcon, { customIconUrl }),
4567
- showLogo ? /* @__PURE__ */ jsx14(
5067
+ /* @__PURE__ */ jsx15("span", { className: "assist-edge-tab__label", children: visibleLabel })
5068
+ ] }) : variant === "outline" ? /* @__PURE__ */ jsxs14(Fragment2, { children: [
5069
+ /* @__PURE__ */ jsxs14("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
5070
+ /* @__PURE__ */ jsx15(TabMarkIcon, { customIconUrl }),
5071
+ showLogo ? /* @__PURE__ */ jsx15(
4568
5072
  "img",
4569
5073
  {
4570
5074
  className: "assist-edge-tab__logo",
@@ -4576,18 +5080,18 @@ function AssistEdgeTab({
4576
5080
  }
4577
5081
  ) : null
4578
5082
  ] }),
4579
- /* @__PURE__ */ jsx14("span", { className: "assist-edge-tab__label", children: visibleLabel }),
4580
- /* @__PURE__ */ jsx14(ChevronDownIcon, {})
5083
+ /* @__PURE__ */ jsx15("span", { className: "assist-edge-tab__label", children: visibleLabel }),
5084
+ /* @__PURE__ */ jsx15(ChevronDownIcon, {})
4581
5085
  ] }) : null,
4582
- variant === "ask" ? /* @__PURE__ */ jsxs13(Fragment2, { children: [
4583
- /* @__PURE__ */ jsx14(ChevronLeftIcon, {}),
4584
- /* @__PURE__ */ jsx14("span", { className: "assist-edge-tab__label", children: visibleLabel }),
4585
- /* @__PURE__ */ jsx14(DragDots, {})
5086
+ variant === "ask" ? /* @__PURE__ */ jsxs14(Fragment2, { children: [
5087
+ /* @__PURE__ */ jsx15(ChevronLeftIcon, {}),
5088
+ /* @__PURE__ */ jsx15("span", { className: "assist-edge-tab__label", children: visibleLabel }),
5089
+ /* @__PURE__ */ jsx15(DragDots, {})
4586
5090
  ] }) : null,
4587
- variant === "fill" ? /* @__PURE__ */ jsxs13(Fragment2, { children: [
4588
- /* @__PURE__ */ jsxs13("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
4589
- /* @__PURE__ */ jsx14(TabMarkIcon, { customIconUrl }),
4590
- showLogo ? /* @__PURE__ */ jsx14(
5091
+ variant === "fill" ? /* @__PURE__ */ jsxs14(Fragment2, { children: [
5092
+ /* @__PURE__ */ jsxs14("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
5093
+ /* @__PURE__ */ jsx15(TabMarkIcon, { customIconUrl }),
5094
+ showLogo ? /* @__PURE__ */ jsx15(
4591
5095
  "img",
4592
5096
  {
4593
5097
  className: "assist-edge-tab__logo",
@@ -4599,8 +5103,8 @@ function AssistEdgeTab({
4599
5103
  }
4600
5104
  ) : null
4601
5105
  ] }),
4602
- /* @__PURE__ */ jsx14("span", { className: "assist-edge-tab__label", children: visibleLabel }),
4603
- /* @__PURE__ */ jsx14(ChevronLeftIcon, {})
5106
+ /* @__PURE__ */ jsx15("span", { className: "assist-edge-tab__label", children: visibleLabel }),
5107
+ /* @__PURE__ */ jsx15(ChevronLeftIcon, {})
4604
5108
  ] }) : null
4605
5109
  ]
4606
5110
  }
@@ -4608,7 +5112,7 @@ function AssistEdgeTab({
4608
5112
  }
4609
5113
 
4610
5114
  // src/react/components/AgentWidget/AgentWidget.tsx
4611
- import { useEffect as useEffect6, useRef as useRef4, useState as useState9 } from "react";
5115
+ import { useEffect as useEffect6, useRef as useRef4, useState as useState10 } from "react";
4612
5116
 
4613
5117
  // src/react/page-shift.ts
4614
5118
  import { useEffect as useEffect4 } from "react";
@@ -4691,9 +5195,9 @@ function usePageShift(input) {
4691
5195
  }
4692
5196
 
4693
5197
  // src/react/hooks/useIsMobile.ts
4694
- import { useEffect as useEffect5, useState as useState8 } from "react";
5198
+ import { useEffect as useEffect5, useState as useState9 } from "react";
4695
5199
  function useIsMobile(breakpoint = 767) {
4696
- const [isMobile, setIsMobile] = useState8(
5200
+ const [isMobile, setIsMobile] = useState9(
4697
5201
  () => typeof window !== "undefined" && window.matchMedia(`(max-width: ${breakpoint}px)`).matches
4698
5202
  );
4699
5203
  useEffect5(() => {
@@ -4707,7 +5211,7 @@ function useIsMobile(breakpoint = 767) {
4707
5211
  }
4708
5212
 
4709
5213
  // src/react/components/AgentWidget/AgentWidget.tsx
4710
- import { jsx as jsx15, jsxs as jsxs14 } from "react/jsx-runtime";
5214
+ import { jsx as jsx16, jsxs as jsxs15 } from "react/jsx-runtime";
4711
5215
  function AgentWidget({
4712
5216
  indexId,
4713
5217
  customerId,
@@ -4726,8 +5230,8 @@ function AgentWidget({
4726
5230
  const isMobile = useIsMobile();
4727
5231
  const placement = normalizeAgentPlacement(placementInput);
4728
5232
  const railSlotRef = useRef4(null);
4729
- const [railCollapsed, setRailCollapsed] = useState9(defaultCollapsed);
4730
- const [railExpanded, setRailExpanded] = useState9(false);
5233
+ const [railCollapsed, setRailCollapsed] = useState10(defaultCollapsed);
5234
+ const [railExpanded, setRailExpanded] = useState10(false);
4731
5235
  const pageShiftActive = shouldApplyPageShift({
4732
5236
  pageShift,
4733
5237
  isMobile,
@@ -4757,7 +5261,10 @@ function AgentWidget({
4757
5261
  visitorBubble: branding.colors.primary
4758
5262
  } : {},
4759
5263
  ...branding?.colors?.primarySoft ? { brandSoft: branding.colors.primarySoft } : {},
4760
- ...branding?.colors?.primaryForeground ? { visitorText: branding.colors.primaryForeground } : {},
5264
+ ...branding?.colors?.primaryForeground ? {
5265
+ onBrand: branding.colors.primaryForeground,
5266
+ visitorText: branding.colors.primaryForeground
5267
+ } : {},
4761
5268
  ...branding?.colors?.surface ? { surface: branding.colors.surface } : {},
4762
5269
  ...branding?.colors?.surfaceMuted ? { surfaceMuted: branding.colors.surfaceMuted } : {},
4763
5270
  ...branding?.colors?.text ? { text: branding.colors.text } : {},
@@ -4818,19 +5325,19 @@ function AgentWidget({
4818
5325
  window.addEventListener("keydown", handleKeyDown);
4819
5326
  return () => window.removeEventListener("keydown", handleKeyDown);
4820
5327
  }, [isMobile, railCollapsed, railExpanded]);
4821
- return /* @__PURE__ */ jsxs14("div", { className: "webless-agent-root", children: [
4822
- /* @__PURE__ */ jsx15(
5328
+ return /* @__PURE__ */ jsxs15("div", { className: "webless-agent-root", children: [
5329
+ /* @__PURE__ */ jsx16(
4823
5330
  "div",
4824
5331
  {
4825
5332
  className: `webless-agent-root__shell${railCollapsed ? " webless-agent-root__shell--collapsed" : ""}${railExpanded ? " webless-agent-root__shell--expanded" : ""}`,
4826
- children: /* @__PURE__ */ jsx15(
5333
+ children: /* @__PURE__ */ jsx16(
4827
5334
  "div",
4828
5335
  {
4829
5336
  ref: railSlotRef,
4830
5337
  className: "webless-agent-root__rail-slot",
4831
5338
  inert: railCollapsed || void 0,
4832
5339
  "aria-hidden": railCollapsed,
4833
- children: /* @__PURE__ */ jsx15(
5340
+ children: /* @__PURE__ */ jsx16(
4834
5341
  AgentRail,
4835
5342
  {
4836
5343
  theme,
@@ -4858,7 +5365,7 @@ function AgentWidget({
4858
5365
  )
4859
5366
  }
4860
5367
  ),
4861
- railCollapsed ? /* @__PURE__ */ jsx15(
5368
+ railCollapsed ? /* @__PURE__ */ jsx16(
4862
5369
  AssistEdgeTab,
4863
5370
  {
4864
5371
  variant: placement.variant,
@@ -4886,6 +5393,9 @@ function AgentWidget({
4886
5393
  export {
4887
5394
  DEFAULT_RUNTIME_ORIGIN,
4888
5395
  resolveAgentRuntimeConfig,
5396
+ AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION,
5397
+ AGENT_STRUCTURED_TOOL_INPUT_HEADER,
5398
+ formatAgentStructuredToolInput,
4889
5399
  builtInVisitorToolResultRegistry,
4890
5400
  presentVisitorToolResult,
4891
5401
  useAgentChat,
@@ -4904,4 +5414,4 @@ export {
4904
5414
  AssistEdgeTab,
4905
5415
  AgentWidget
4906
5416
  };
4907
- //# sourceMappingURL=chunk-Y4DCEJDC.js.map
5417
+ //# sourceMappingURL=chunk-UR5QZZ2F.js.map