@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.
package/dist/embed.cjs CHANGED
@@ -64,7 +64,7 @@ function submitAgentPanel(customerId, message, options) {
64
64
  }
65
65
 
66
66
  // src/react/components/AgentWidget/AgentWidget.tsx
67
- var import_react11 = require("react");
67
+ var import_react12 = require("react");
68
68
 
69
69
  // src/react/page-shift.ts
70
70
  var import_react = require("react");
@@ -409,6 +409,17 @@ function clearPersistedAgentSession(visitorSessionId, options) {
409
409
 
410
410
  // src/runtime/tool-ui.ts
411
411
  var AGENT_TOOL_UI_SCHEMA_VERSION = "webless.tool-ui.v1";
412
+ var AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION = "webless.structured-tool-input.v1";
413
+ var AGENT_STRUCTURED_TOOL_INPUT_HEADER = "Webless-Structured-Tool-Input-JSON:";
414
+ function formatAgentStructuredToolInput(surface, values) {
415
+ const payload = {
416
+ schemaVersion: AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION,
417
+ toolSlug: surface.toolSlug,
418
+ ...surface.operationId ? { operationId: surface.operationId } : {},
419
+ values
420
+ };
421
+ return `${AGENT_STRUCTURED_TOOL_INPUT_HEADER} ${JSON.stringify(payload)}`;
422
+ }
412
423
  function isRecord2(value) {
413
424
  return value !== null && typeof value === "object" && !Array.isArray(value);
414
425
  }
@@ -1193,11 +1204,11 @@ function createAgentClient(options) {
1193
1204
 
1194
1205
  // src/runtime/errors.ts
1195
1206
  var import_client3 = require("eve/client");
1196
- var TRANSIENT_AGENT_ERROR_MESSAGE = "I couldn\u2019t finish that answer. Please try again.";
1207
+ var TRANSIENT_AGENT_ERROR_MESSAGE = "The agent run stopped before the action finished. Please try again.";
1197
1208
  var PREVIEW_AUTHORIZATION_ERROR_MESSAGE = "This preview could not be authorized. Open the latest preview from Webless.";
1198
1209
  function isTransientRuntimeMessage(message) {
1199
1210
  const normalized = message.trim().toLowerCase();
1200
- return normalized.includes("empty response from runtime") || normalized.includes("failed to fetch") || normalized.includes("networkerror") || normalized.includes("load failed");
1211
+ 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");
1201
1212
  }
1202
1213
  function isPreviewAuthorizationMessage(message) {
1203
1214
  const normalized = message.trim().toLowerCase();
@@ -1353,21 +1364,46 @@ function looksLikeBookingCopy(text) {
1353
1364
  text
1354
1365
  );
1355
1366
  }
1356
- function inferComposerForm(text) {
1357
- const cleaned = text.trim();
1358
- if (!cleaned || looksLikeBookingCopy(cleaned) || !looksLikeFieldCollection(cleaned)) {
1359
- return null;
1360
- }
1361
- const fields = FIELD_LIBRARY.flatMap((field) => {
1362
- if (field.exclude?.test(cleaned)) {
1363
- const leftover = cleaned.replace(field.exclude, " ");
1367
+ function echoedLabeledFieldIds(text) {
1368
+ const ids = /* @__PURE__ */ new Set();
1369
+ if (/\bname\s*:\s+\S+/i.test(text)) ids.add("name");
1370
+ if (/\be-?mail\s*:\s+\S+/i.test(text)) ids.add("email");
1371
+ if (/\bphone\s*:\s+\S+/i.test(text)) ids.add("phone");
1372
+ if (/\bcompany\s*:\s+\S+/i.test(text)) ids.add("company");
1373
+ return ids;
1374
+ }
1375
+ function matchLibraryFields(text) {
1376
+ return FIELD_LIBRARY.flatMap((field) => {
1377
+ if (field.exclude?.test(text)) {
1378
+ const leftover = text.replace(field.exclude, " ");
1364
1379
  if (!field.patterns.some((pattern) => pattern.test(leftover))) return [];
1365
- } else if (!field.patterns.some((pattern) => pattern.test(cleaned))) {
1380
+ } else if (!field.patterns.some((pattern) => pattern.test(text))) {
1366
1381
  return [];
1367
1382
  }
1368
1383
  const { patterns: _patterns, exclude: _exclude, ...next } = field;
1369
1384
  return [next];
1370
1385
  }).slice(0, MAX_FORM_FIELDS);
1386
+ }
1387
+ function looksLikeCompletedActionRecap(text) {
1388
+ const confirmingCreate = /\bshould i create this\b/i.test(text);
1389
+ const echoingFilledFields = /\b(?:name|email|phone|company)\s*:\s+\S+/i.test(text) && /[^\s@]+@[^\s@]+\.[^\s@]+/i.test(text);
1390
+ if (echoingFilledFields) {
1391
+ if (looksLikeFieldCollection(text)) {
1392
+ const echoed = echoedLabeledFieldIds(text);
1393
+ if (matchLibraryFields(text).some((field) => !echoed.has(field.id))) {
1394
+ return false;
1395
+ }
1396
+ }
1397
+ return true;
1398
+ }
1399
+ return confirmingCreate && !looksLikeFieldCollection(text);
1400
+ }
1401
+ function inferComposerForm(text) {
1402
+ const cleaned = text.trim();
1403
+ if (!cleaned || looksLikeBookingCopy(cleaned) || looksLikeCompletedActionRecap(cleaned) || !looksLikeFieldCollection(cleaned)) {
1404
+ return null;
1405
+ }
1406
+ const fields = matchLibraryFields(cleaned);
1371
1407
  if (fields.length < MIN_FORM_FIELDS) return null;
1372
1408
  return {
1373
1409
  id: `inferred:${fields.map((field) => field.id).join("+")}`,
@@ -1375,7 +1411,9 @@ function inferComposerForm(text) {
1375
1411
  };
1376
1412
  }
1377
1413
  function resolveComposerForm(input) {
1378
- if (input.enabled === false || input.hasBookingOffer) return null;
1414
+ if (input.enabled === false || input.hasBookingOffer || input.hasPendingConfirmation) {
1415
+ return null;
1416
+ }
1379
1417
  const text = input.agentText.trim();
1380
1418
  if (!text) return null;
1381
1419
  const card = input.cards?.find((item) => item.type === "visitor_form");
@@ -1400,7 +1438,7 @@ function preferBookingOffer(current, next) {
1400
1438
  return next;
1401
1439
  }
1402
1440
  function looksLikeBookingReady(text) {
1403
- return /demo option|options are ready|pick a (date|time)|available (times|slots)|book(ing)? (card|the demo)|schedule/i.test(
1441
+ return /demo option|options are ready|pick a (date|time)|available (times|slots)|book(ing)? (card|the demo)|\bschedule\b/i.test(
1404
1442
  text
1405
1443
  );
1406
1444
  }
@@ -2212,7 +2250,8 @@ function presentVisitorToolResult(result, registry = []) {
2212
2250
  id: result.callId,
2213
2251
  toolName: result.toolName,
2214
2252
  status: result.status,
2215
- kind: "hidden"
2253
+ kind: "input",
2254
+ surface: envelope.ui
2216
2255
  };
2217
2256
  }
2218
2257
  if (!proposed) {
@@ -2269,6 +2308,7 @@ function legacyBookingEnvelope(output) {
2269
2308
 
2270
2309
  // src/react/lib/visitor-input.ts
2271
2310
  function shouldRenderVisitorInputCard(request) {
2311
+ if (request.ui) return true;
2272
2312
  if (request.kind === "tool-approval" || request.kind === "session-limit") {
2273
2313
  return true;
2274
2314
  }
@@ -2602,7 +2642,6 @@ function useAgentChat({
2602
2642
  }
2603
2643
  if (!isActiveRun()) return;
2604
2644
  if (presentation.kind === "hidden") return;
2605
- if (presentation.kind === "input") return;
2606
2645
  setState((prev) => ({
2607
2646
  ...prev,
2608
2647
  toolResults: [
@@ -2880,14 +2919,13 @@ ${outgoing}` : outgoing;
2880
2919
  }, [runTurn, state.messages]);
2881
2920
  const respondToToolInput = (0, import_react2.useCallback)(
2882
2921
  async (surface, values) => {
2883
- const details = JSON.stringify(values);
2884
- await submit(`${surface.title} details provided`, {
2922
+ await submit(`${surface.title} submitted`, {
2885
2923
  runtimeText: [
2886
- `Structured input provided for ${surface.toolSlug}.`,
2887
- surface.operationId ? `Operation: ${surface.operationId}.` : "",
2888
- `Use these exact values and retry the action: ${details}`,
2924
+ formatAgentStructuredToolInput(surface, values),
2925
+ "Use these exact structured values to retry the requested action.",
2926
+ "Reuse the operationId from the structured payload.",
2889
2927
  "Do not invent or alter any values."
2890
- ].filter(Boolean).join("\n")
2928
+ ].join("\n")
2891
2929
  });
2892
2930
  },
2893
2931
  [submit]
@@ -3005,7 +3043,7 @@ function normalizeAgentPlacement(placement) {
3005
3043
  }
3006
3044
 
3007
3045
  // src/react/components/AgentRail/AgentRail.tsx
3008
- var import_react10 = require("react");
3046
+ var import_react11 = require("react");
3009
3047
 
3010
3048
  // src/react/types/conversation.ts
3011
3049
  var defaultAgentRailTheme = {
@@ -3021,6 +3059,7 @@ var defaultAgentRailTheme = {
3021
3059
  border: "rgb(42 51 70 / 0.1)",
3022
3060
  visitorBubble: "#f3edff",
3023
3061
  visitorText: "#171b2a",
3062
+ onBrand: "#ffffff",
3024
3063
  success: "#18794e",
3025
3064
  danger: "#c94b63",
3026
3065
  fontBody: '"Mulish", "Avenir Next", "Segoe UI", sans-serif',
@@ -3039,6 +3078,7 @@ var defaultDarkAgentRailTheme = {
3039
3078
  border: "rgb(226 232 240 / 0.16)",
3040
3079
  visitorBubble: "#2b2140",
3041
3080
  visitorText: "#f5f7fb",
3081
+ onBrand: "#171b2a",
3042
3082
  success: "#55cf91",
3043
3083
  danger: "#ff8da1"
3044
3084
  };
@@ -3156,7 +3196,7 @@ function AgentActivityBubble({
3156
3196
  workSummary(steps, failed, brandLabel)
3157
3197
  ] }),
3158
3198
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "agent-activity-bubble__details", children: [
3159
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
3199
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
3160
3200
  "button",
3161
3201
  {
3162
3202
  type: "button",
@@ -3168,10 +3208,7 @@ function AgentActivityBubble({
3168
3208
  (current) => current === receiptId ? null : receiptId
3169
3209
  );
3170
3210
  },
3171
- children: [
3172
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "agent-activity-bubble__summary-title", children: "How this answer was made" }),
3173
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "agent-activity-bubble__summary-toggle", children: detailsOpen ? "Hide work" : "Show work" })
3174
- ]
3211
+ children: "How this answer was made"
3175
3212
  }
3176
3213
  ),
3177
3214
  detailsOpen ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", { className: "agent-activity-bubble__steps", children: visibleSteps.map((step) => {
@@ -3483,6 +3520,9 @@ function calendarCells(year, month) {
3483
3520
  while (cells.length < 42) cells.push(null);
3484
3521
  return cells;
3485
3522
  }
3523
+ function BookingCardLoader() {
3524
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("section", { className: "booking-card", "aria-label": "Book a meeting", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("p", { className: "booking-card__loading", role: "status", children: "Finding available times\u2026" }) });
3525
+ }
3486
3526
  function BookingCard({
3487
3527
  offer,
3488
3528
  onBook
@@ -3902,7 +3942,7 @@ function MessageBubble({
3902
3942
  }
3903
3943
 
3904
3944
  // src/react/components/HumanInputCard/HumanInputCard.tsx
3905
- var import_react9 = require("react");
3945
+ var import_react10 = require("react");
3906
3946
 
3907
3947
  // src/react/components/ConfirmationCard/ConfirmationCard.tsx
3908
3948
  var import_jsx_runtime6 = require("react/jsx-runtime");
@@ -3943,18 +3983,450 @@ function ConfirmationCard({
3943
3983
  );
3944
3984
  }
3945
3985
 
3946
- // src/react/components/HumanInputCard/HumanInputCard.tsx
3986
+ // src/react/components/ToolInputCard/ToolInputCard.tsx
3987
+ var import_react9 = require("react");
3947
3988
  var import_jsx_runtime7 = require("react/jsx-runtime");
3989
+ function isRecord4(value) {
3990
+ return value !== null && typeof value === "object" && !Array.isArray(value);
3991
+ }
3992
+ function pathSegments(path) {
3993
+ return path.replace(/\[(\d+)\]/gu, ".$1").split(".").filter(Boolean);
3994
+ }
3995
+ function valueAtPath(root, path) {
3996
+ let current = root;
3997
+ for (const segment of pathSegments(path)) {
3998
+ if (Array.isArray(current)) {
3999
+ const index = Number(segment);
4000
+ current = Number.isInteger(index) ? current[index] : void 0;
4001
+ continue;
4002
+ }
4003
+ current = isRecord4(current) ? current[segment] : void 0;
4004
+ }
4005
+ return current;
4006
+ }
4007
+ function initialFieldValue(field, surface) {
4008
+ const supplied = valueAtPath(surface.values, field.path);
4009
+ if (supplied !== void 0) return supplied;
4010
+ if (field.defaultValue !== void 0) return field.defaultValue;
4011
+ if (field.kind === "checkbox" || field.kind === "confirmation") return false;
4012
+ if (field.kind === "multi-select") return [];
4013
+ if (field.kind === "range") return field.min ?? 0;
4014
+ return "";
4015
+ }
4016
+ function initialValues(surface) {
4017
+ return Object.fromEntries(
4018
+ surface.fields.map((field) => [
4019
+ field.path,
4020
+ initialFieldValue(field, surface)
4021
+ ])
4022
+ );
4023
+ }
4024
+ function cloneJsonValue(value) {
4025
+ if (Array.isArray(value)) return value.map(cloneJsonValue);
4026
+ if (isRecord4(value)) {
4027
+ return Object.fromEntries(
4028
+ Object.entries(value).map(([key, item]) => [key, cloneJsonValue(item)])
4029
+ );
4030
+ }
4031
+ return value;
4032
+ }
4033
+ function assignPath(target, path, value) {
4034
+ const segments = pathSegments(path);
4035
+ let current = target;
4036
+ segments.forEach((segment, index) => {
4037
+ if (index === segments.length - 1) {
4038
+ current[segment] = value;
4039
+ return;
4040
+ }
4041
+ const existing = current[segment];
4042
+ if (!isRecord4(existing)) current[segment] = {};
4043
+ current = current[segment];
4044
+ });
4045
+ }
4046
+ function isJsonValue3(value, seen = /* @__PURE__ */ new Set()) {
4047
+ if (value === null || typeof value === "string" || typeof value === "boolean") {
4048
+ return true;
4049
+ }
4050
+ if (typeof value === "number") return Number.isFinite(value);
4051
+ if (typeof value !== "object" || seen.has(value)) return false;
4052
+ seen.add(value);
4053
+ const valid = Array.isArray(value) ? value.every((item) => isJsonValue3(item, seen)) : Object.values(value).every((item) => isJsonValue3(item, seen));
4054
+ seen.delete(value);
4055
+ return valid;
4056
+ }
4057
+ function parsedFieldValue(field, value) {
4058
+ if (field.kind !== "json" || typeof value !== "string") return value;
4059
+ try {
4060
+ const parsed = JSON.parse(value);
4061
+ return isJsonValue3(parsed) ? parsed : void 0;
4062
+ } catch {
4063
+ return void 0;
4064
+ }
4065
+ }
4066
+ function isEmpty(value) {
4067
+ if (typeof value === "string") return value.trim().length === 0;
4068
+ if (Array.isArray(value)) return value.length === 0;
4069
+ return value === null || value === false;
4070
+ }
4071
+ function validateField(field, value) {
4072
+ if (field.required && isEmpty(value))
4073
+ return `Enter ${field.label.toLowerCase()}.`;
4074
+ if (typeof value === "string" && value.trim().length === 0) return "";
4075
+ if (field.kind === "email" && (typeof value !== "string" || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/u.test(value))) {
4076
+ return "Enter a valid email address.";
4077
+ }
4078
+ if (typeof value === "string") {
4079
+ if (field.minLength !== void 0 && value.length < field.minLength) {
4080
+ return `Use at least ${field.minLength} characters.`;
4081
+ }
4082
+ if (field.maxLength !== void 0 && value.length > field.maxLength) {
4083
+ return `Use no more than ${field.maxLength} characters.`;
4084
+ }
4085
+ }
4086
+ if (typeof value === "number") {
4087
+ if (field.min !== void 0 && value < field.min) {
4088
+ return `Choose ${field.min} or higher.`;
4089
+ }
4090
+ if (field.max !== void 0 && value > field.max) {
4091
+ return `Choose ${field.max} or lower.`;
4092
+ }
4093
+ }
4094
+ if (field.maxItems !== void 0 && Array.isArray(value) && value.length > field.maxItems) {
4095
+ return `Choose no more than ${field.maxItems}.`;
4096
+ }
4097
+ if (field.kind === "json" && parsedFieldValue(field, value) === void 0) {
4098
+ return "Enter valid JSON.";
4099
+ }
4100
+ return "";
4101
+ }
4102
+ function optionKey(option) {
4103
+ return JSON.stringify(option.value);
4104
+ }
4105
+ function valuesMatch(left, right) {
4106
+ return JSON.stringify(left) === JSON.stringify(right);
4107
+ }
4108
+ function FieldDescription({
4109
+ field,
4110
+ id
4111
+ }) {
4112
+ return field.description ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { id, className: "tool-input-card__description", children: field.description }) : null;
4113
+ }
4114
+ function ChoiceField({
4115
+ field,
4116
+ id,
4117
+ value,
4118
+ disabled,
4119
+ describedBy,
4120
+ error,
4121
+ onBlur,
4122
+ onChange
4123
+ }) {
4124
+ const options = field.options ?? [];
4125
+ const multiple = field.kind === "multi-select";
4126
+ const selected = Array.isArray(value) ? value : [];
4127
+ if (field.kind === "select") {
4128
+ const selectedIndex = options.findIndex(
4129
+ (option) => valuesMatch(option.value, value)
4130
+ );
4131
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
4132
+ "select",
4133
+ {
4134
+ id,
4135
+ value: selectedIndex >= 0 ? String(selectedIndex) : "",
4136
+ disabled,
4137
+ required: field.required,
4138
+ "aria-describedby": describedBy,
4139
+ "aria-invalid": Boolean(error),
4140
+ onBlur,
4141
+ onChange: (event) => {
4142
+ const option = options[Number(event.target.value)];
4143
+ if (option) onChange(option.value);
4144
+ },
4145
+ children: [
4146
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "", disabled: field.required, children: "Choose an option" }),
4147
+ options.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: index, children: option.label }, optionKey(option)))
4148
+ ]
4149
+ }
4150
+ );
4151
+ }
4152
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4153
+ "div",
4154
+ {
4155
+ className: "tool-input-card__choices",
4156
+ role: multiple ? "group" : "radiogroup",
4157
+ "aria-labelledby": `${id}-label`,
4158
+ "aria-describedby": describedBy,
4159
+ "aria-invalid": Boolean(error),
4160
+ "aria-required": field.required,
4161
+ children: options.map((option, index) => {
4162
+ const checked = multiple ? selected.some((item) => valuesMatch(item, option.value)) : valuesMatch(value, option.value);
4163
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "tool-input-card__choice", children: [
4164
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4165
+ "input",
4166
+ {
4167
+ type: multiple ? "checkbox" : "radio",
4168
+ name: id,
4169
+ value: String(index),
4170
+ checked,
4171
+ disabled,
4172
+ onBlur,
4173
+ onChange: () => {
4174
+ if (!multiple) {
4175
+ onChange(option.value);
4176
+ return;
4177
+ }
4178
+ onChange(
4179
+ checked ? selected.filter(
4180
+ (item) => !valuesMatch(item, option.value)
4181
+ ) : [...selected, option.value]
4182
+ );
4183
+ }
4184
+ }
4185
+ ),
4186
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: option.label })
4187
+ ] }, optionKey(option));
4188
+ })
4189
+ }
4190
+ );
4191
+ }
4192
+ function ToolField({
4193
+ disabled,
4194
+ error,
4195
+ field,
4196
+ id,
4197
+ value,
4198
+ onBlur,
4199
+ onChange
4200
+ }) {
4201
+ const describedBy = [
4202
+ field.description ? `${id}-description` : "",
4203
+ error ? `${id}-error` : ""
4204
+ ].filter(Boolean).join(" ");
4205
+ if (field.kind === "checkbox" || field.kind === "confirmation") {
4206
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "tool-input-card__field", children: [
4207
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "tool-input-card__check", htmlFor: id, children: [
4208
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4209
+ "input",
4210
+ {
4211
+ id,
4212
+ type: "checkbox",
4213
+ checked: value === true,
4214
+ disabled,
4215
+ "aria-describedby": describedBy || void 0,
4216
+ "aria-invalid": Boolean(error),
4217
+ onBlur,
4218
+ onChange: (event) => onChange(event.target.checked)
4219
+ }
4220
+ ),
4221
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
4222
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("strong", { children: field.label }),
4223
+ field.description ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { id: `${id}-description`, children: field.description }) : null
4224
+ ] })
4225
+ ] }),
4226
+ error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
4227
+ ] });
4228
+ }
4229
+ const label = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { id: `${id}-label`, htmlFor: id, children: [
4230
+ field.label,
4231
+ field.required ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { "aria-hidden": "true", children: " *" }) : null
4232
+ ] });
4233
+ const common = {
4234
+ id,
4235
+ disabled,
4236
+ required: field.required,
4237
+ "aria-describedby": describedBy || void 0,
4238
+ "aria-invalid": Boolean(error),
4239
+ onBlur
4240
+ };
4241
+ let control;
4242
+ if (field.kind === "select" || field.kind === "radio" || field.kind === "multi-select") {
4243
+ control = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4244
+ ChoiceField,
4245
+ {
4246
+ field,
4247
+ id,
4248
+ value,
4249
+ disabled,
4250
+ describedBy: describedBy || void 0,
4251
+ error,
4252
+ onBlur,
4253
+ onChange
4254
+ }
4255
+ );
4256
+ } else if (field.kind === "textarea" || field.kind === "json") {
4257
+ control = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4258
+ "textarea",
4259
+ {
4260
+ ...common,
4261
+ rows: field.kind === "json" ? 4 : 3,
4262
+ maxLength: field.maxLength,
4263
+ minLength: field.minLength,
4264
+ placeholder: field.placeholder,
4265
+ value: typeof value === "string" ? value : JSON.stringify(value),
4266
+ onChange: (event) => onChange(event.target.value)
4267
+ }
4268
+ );
4269
+ } else if (field.kind === "range") {
4270
+ const numericValue = typeof value === "number" ? value : field.min ?? 0;
4271
+ control = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "tool-input-card__range", children: [
4272
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4273
+ "input",
4274
+ {
4275
+ ...common,
4276
+ type: "range",
4277
+ min: field.min,
4278
+ max: field.max,
4279
+ step: field.step,
4280
+ value: numericValue,
4281
+ onChange: (event) => onChange(Number(event.target.value))
4282
+ }
4283
+ ),
4284
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("output", { htmlFor: id, children: numericValue })
4285
+ ] });
4286
+ } else {
4287
+ const type = field.kind === "date-time" ? "datetime-local" : field.kind === "calendar" ? "date" : field.kind;
4288
+ control = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4289
+ "input",
4290
+ {
4291
+ ...common,
4292
+ type,
4293
+ min: field.min,
4294
+ max: field.max,
4295
+ step: field.step,
4296
+ minLength: field.minLength,
4297
+ maxLength: field.maxLength,
4298
+ placeholder: field.placeholder,
4299
+ value: typeof value === "number" || typeof value === "string" ? value : "",
4300
+ onChange: (event) => onChange(
4301
+ field.kind === "number" && event.target.value !== "" ? Number(event.target.value) : event.target.value
4302
+ )
4303
+ }
4304
+ );
4305
+ }
4306
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "tool-input-card__field", children: [
4307
+ label,
4308
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FieldDescription, { field, id: `${id}-description` }),
4309
+ control,
4310
+ error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
4311
+ ] });
4312
+ }
4313
+ function ToolInputCard({
4314
+ disabled = false,
4315
+ surface,
4316
+ onSubmit
4317
+ }) {
4318
+ const [values, setValues] = (0, import_react9.useState)(
4319
+ () => initialValues(surface)
4320
+ );
4321
+ const [touched, setTouched] = (0, import_react9.useState)(() => /* @__PURE__ */ new Set());
4322
+ const [submitted, setSubmitted] = (0, import_react9.useState)(false);
4323
+ const errors = Object.fromEntries(
4324
+ surface.fields.map((field) => [
4325
+ field.path,
4326
+ touched.has(field.path) ? validateField(field, values[field.path] ?? "") : ""
4327
+ ])
4328
+ );
4329
+ function submit(event) {
4330
+ event.preventDefault();
4331
+ if (disabled || submitted) return;
4332
+ const allTouched = new Set(surface.fields.map((field) => field.path));
4333
+ setTouched(allTouched);
4334
+ const nextErrors = surface.fields.map(
4335
+ (field) => validateField(field, values[field.path] ?? "")
4336
+ );
4337
+ if (nextErrors.some(Boolean)) return;
4338
+ const result = isRecord4(surface.values) ? cloneJsonValue(surface.values) : {};
4339
+ for (const field of surface.fields) {
4340
+ const parsed = parsedFieldValue(field, values[field.path] ?? "");
4341
+ if (parsed !== void 0) assignPath(result, field.path, parsed);
4342
+ }
4343
+ setSubmitted(true);
4344
+ onSubmit?.(surface, result);
4345
+ }
4346
+ if (submitted) {
4347
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
4348
+ "section",
4349
+ {
4350
+ className: "tool-input-card tool-input-card--submitted",
4351
+ role: "status",
4352
+ children: [
4353
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { "aria-hidden": "true", children: "\u2713" }),
4354
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("strong", { children: [
4355
+ surface.title,
4356
+ " submitted"
4357
+ ] })
4358
+ ]
4359
+ }
4360
+ );
4361
+ }
4362
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
4363
+ "section",
4364
+ {
4365
+ className: "tool-input-card",
4366
+ "aria-labelledby": `tool-input-${surface.id}`,
4367
+ children: [
4368
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "tool-input-card__heading", children: [
4369
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("strong", { id: `tool-input-${surface.id}`, children: surface.title }),
4370
+ surface.description ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: surface.description }) : null
4371
+ ] }),
4372
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("form", { noValidate: true, onSubmit: submit, children: [
4373
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "tool-input-card__fields", children: surface.fields.map((field, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4374
+ ToolField,
4375
+ {
4376
+ disabled,
4377
+ error: errors[field.path] ?? "",
4378
+ field,
4379
+ id: `tool-input-${surface.id}-${index}`,
4380
+ value: values[field.path] ?? "",
4381
+ onBlur: () => setTouched((current) => /* @__PURE__ */ new Set([...current, field.path])),
4382
+ onChange: (value) => setValues((current) => ({ ...current, [field.path]: value }))
4383
+ },
4384
+ field.path
4385
+ )) }),
4386
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "tool-input-card__actions", children: [
4387
+ surface.actions?.some((action) => action.id === "reset") ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4388
+ "button",
4389
+ {
4390
+ type: "button",
4391
+ className: "tool-input-card__secondary",
4392
+ disabled,
4393
+ onClick: () => {
4394
+ setValues(initialValues(surface));
4395
+ setTouched(/* @__PURE__ */ new Set());
4396
+ },
4397
+ children: surface.actions.find((action) => action.id === "reset")?.label ?? "Clear"
4398
+ }
4399
+ ) : null,
4400
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "submit", disabled, children: surface.submitLabel ?? surface.actions?.find((action) => action.id === "submit")?.label ?? "Continue" })
4401
+ ] })
4402
+ ] })
4403
+ ]
4404
+ }
4405
+ );
4406
+ }
4407
+
4408
+ // src/react/components/HumanInputCard/HumanInputCard.tsx
4409
+ var import_jsx_runtime8 = require("react/jsx-runtime");
3948
4410
  function HumanInputCard({
3949
4411
  disabled = false,
3950
4412
  request,
3951
4413
  onRespond
3952
4414
  }) {
3953
- const [text, setText] = (0, import_react9.useState)("");
4415
+ const [text, setText] = (0, import_react10.useState)("");
3954
4416
  const options = request.options ?? [];
3955
4417
  const showText = request.display === "text" || request.allowFreeform && options.length === 0;
4418
+ if (request.ui) {
4419
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4420
+ ToolInputCard,
4421
+ {
4422
+ disabled,
4423
+ surface: request.ui,
4424
+ onSubmit: (_, value) => onRespond?.({ requestId: request.requestId, value })
4425
+ }
4426
+ );
4427
+ }
3956
4428
  if (options.length > 0) {
3957
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4429
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3958
4430
  ConfirmationCard,
3959
4431
  {
3960
4432
  disabled,
@@ -3969,17 +4441,17 @@ function HumanInputCard({
3969
4441
  if (!value || disabled) return;
3970
4442
  onRespond?.({ requestId: request.requestId, text: value });
3971
4443
  }
3972
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
4444
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
3973
4445
  "section",
3974
4446
  {
3975
4447
  className: "human-input-card",
3976
4448
  "aria-labelledby": `human-input-${request.requestId}`,
3977
4449
  children: [
3978
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "human-input-card__heading", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("strong", { id: `human-input-${request.requestId}`, children: request.prompt }) }),
3979
- showText ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("form", { onSubmit: submitText, children: [
3980
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("label", { htmlFor: `human-input-text-${request.requestId}`, children: "Response" }),
3981
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
3982
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4450
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "human-input-card__heading", children: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("strong", { id: `human-input-${request.requestId}`, children: request.prompt }) }),
4451
+ showText ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("form", { onSubmit: submitText, children: [
4452
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { htmlFor: `human-input-text-${request.requestId}`, children: "Response" }),
4453
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
4454
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3983
4455
  "input",
3984
4456
  {
3985
4457
  id: `human-input-text-${request.requestId}`,
@@ -3988,39 +4460,39 @@ function HumanInputCard({
3988
4460
  onChange: (event) => setText(event.target.value)
3989
4461
  }
3990
4462
  ),
3991
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "submit", disabled: disabled || !text.trim(), children: "Send" })
4463
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "submit", disabled: disabled || !text.trim(), children: "Send" })
3992
4464
  ] })
3993
4465
  ] }) : null,
3994
- !showText && options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: "human-input-card__unavailable", role: "status", children: "This request can\u2019t be answered here." }) : null
4466
+ !showText && options.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "human-input-card__unavailable", role: "status", children: "This request can\u2019t be answered here." }) : null
3995
4467
  ]
3996
4468
  }
3997
4469
  );
3998
4470
  }
3999
4471
 
4000
4472
  // src/react/components/CollectionResultCard/CollectionResultCard.tsx
4001
- var import_jsx_runtime8 = require("react/jsx-runtime");
4473
+ var import_jsx_runtime9 = require("react/jsx-runtime");
4002
4474
  function CollectionResultCard({
4003
4475
  result
4004
4476
  }) {
4005
4477
  const empty = result.items.length === 0;
4006
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
4478
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
4007
4479
  "section",
4008
4480
  {
4009
4481
  className: `collection-result-card tool-result-card tool-result-card--${result.status}`,
4010
4482
  "aria-label": result.title,
4011
4483
  children: [
4012
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "tool-result-card__heading", children: [
4013
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4014
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("strong", { children: result.title })
4484
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "tool-result-card__heading", children: [
4485
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4486
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { children: result.title })
4015
4487
  ] }),
4016
- empty ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { className: "collection-result-card__empty", children: "No matching record for the email you shared." }) : /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("ul", { className: "collection-result-card__list", children: result.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("li", { children: [
4017
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "collection-result-card__item-title", children: item.title }),
4018
- item.description ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { children: item.description }) : null,
4019
- item.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dl", { children: item.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
4020
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dt", { children: detail.label }),
4021
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dd", { children: detail.value })
4488
+ empty ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { className: "collection-result-card__empty", children: "No matching record for the email you shared." }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("ul", { className: "collection-result-card__list", children: result.items.map((item) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("li", { children: [
4489
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "collection-result-card__item-title", children: item.title }),
4490
+ item.description ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: item.description }) : null,
4491
+ item.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dl", { children: item.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
4492
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dt", { children: detail.label }),
4493
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dd", { children: detail.value })
4022
4494
  ] }, `${detail.label}:${detail.value}`)) }) : null,
4023
- item.href ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
4495
+ item.href ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
4024
4496
  ] }, item.title)) })
4025
4497
  ]
4026
4498
  }
@@ -4028,26 +4500,26 @@ function CollectionResultCard({
4028
4500
  }
4029
4501
 
4030
4502
  // src/react/components/EntityResultCard/EntityResultCard.tsx
4031
- var import_jsx_runtime9 = require("react/jsx-runtime");
4503
+ var import_jsx_runtime10 = require("react/jsx-runtime");
4032
4504
  function EntityResultCard({
4033
4505
  result
4034
4506
  }) {
4035
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
4507
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4036
4508
  "section",
4037
4509
  {
4038
4510
  className: `entity-result-card tool-result-card tool-result-card--${result.status}`,
4039
4511
  "aria-label": result.title,
4040
4512
  children: [
4041
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "tool-result-card__heading", children: [
4042
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4043
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { children: result.title })
4513
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-result-card__heading", children: [
4514
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4515
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: result.title })
4044
4516
  ] }),
4045
- result.description ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: result.description }) : null,
4046
- result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
4047
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dt", { children: detail.label }),
4048
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dd", { children: detail.value })
4517
+ result.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: result.description }) : null,
4518
+ result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4519
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("dt", { children: detail.label }),
4520
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("dd", { children: detail.value })
4049
4521
  ] }, `${detail.label}:${detail.value}`)) }) : null,
4050
- result.links?.length ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
4522
+ result.links?.length ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4051
4523
  "a",
4052
4524
  {
4053
4525
  href: link.href,
@@ -4063,24 +4535,24 @@ function EntityResultCard({
4063
4535
  }
4064
4536
 
4065
4537
  // src/react/components/SignatureResultCard/SignatureResultCard.tsx
4066
- var import_jsx_runtime10 = require("react/jsx-runtime");
4538
+ var import_jsx_runtime11 = require("react/jsx-runtime");
4067
4539
  function SignatureResultCard({
4068
4540
  result
4069
4541
  }) {
4070
4542
  const primaryLink = result.links?.[0];
4071
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4543
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4072
4544
  "section",
4073
4545
  {
4074
4546
  className: `signature-result-card tool-result-card tool-result-card--${result.status}`,
4075
4547
  "aria-label": result.title,
4076
4548
  children: [
4077
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-result-card__heading", children: [
4078
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4079
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: result.title })
4549
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "tool-result-card__heading", children: [
4550
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4551
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { children: result.title })
4080
4552
  ] }),
4081
- result.statusLabel ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
4082
- result.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: result.description }) : null,
4083
- primaryLink ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4553
+ result.statusLabel ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
4554
+ result.description ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: result.description }) : null,
4555
+ primaryLink ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
4084
4556
  "a",
4085
4557
  {
4086
4558
  className: "signature-result-card__cta",
@@ -4096,26 +4568,26 @@ function SignatureResultCard({
4096
4568
  }
4097
4569
 
4098
4570
  // src/react/components/ToolResultCard/ToolResultCard.tsx
4099
- var import_jsx_runtime11 = require("react/jsx-runtime");
4571
+ var import_jsx_runtime12 = require("react/jsx-runtime");
4100
4572
  function ToolResultCard({
4101
4573
  result
4102
4574
  }) {
4103
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4575
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4104
4576
  "section",
4105
4577
  {
4106
4578
  className: `tool-result-card tool-result-card--${result.status}`,
4107
4579
  "aria-label": result.title,
4108
4580
  children: [
4109
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "tool-result-card__heading", children: [
4110
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4111
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { children: result.title })
4581
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "tool-result-card__heading", children: [
4582
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4583
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: result.title })
4112
4584
  ] }),
4113
- result.description ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: result.description }) : null,
4114
- result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
4115
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dt", { children: detail.label }),
4116
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dd", { children: detail.value })
4585
+ result.description ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { children: result.description }) : null,
4586
+ result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
4587
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dt", { children: detail.label }),
4588
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dd", { children: detail.value })
4117
4589
  ] }, `${detail.label}:${detail.value}`)) }) : null,
4118
- result.links?.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
4590
+ result.links?.length ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
4119
4591
  "a",
4120
4592
  {
4121
4593
  href: link.href,
@@ -4131,32 +4603,44 @@ function ToolResultCard({
4131
4603
  }
4132
4604
 
4133
4605
  // src/react/components/VisitorToolResultView/VisitorToolResultView.tsx
4134
- var import_jsx_runtime12 = require("react/jsx-runtime");
4606
+ var import_jsx_runtime13 = require("react/jsx-runtime");
4135
4607
  function VisitorToolResultView({
4608
+ disabled = false,
4609
+ onToolInput,
4136
4610
  result
4137
4611
  }) {
4612
+ if (result.kind === "input") {
4613
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4614
+ ToolInputCard,
4615
+ {
4616
+ disabled,
4617
+ surface: result.surface,
4618
+ onSubmit: onToolInput
4619
+ }
4620
+ );
4621
+ }
4138
4622
  if (result.kind === "entity") {
4139
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(EntityResultCard, { result });
4623
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EntityResultCard, { result });
4140
4624
  }
4141
4625
  if (result.kind === "collection") {
4142
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CollectionResultCard, { result });
4626
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CollectionResultCard, { result });
4143
4627
  }
4144
4628
  if (result.kind === "signature") {
4145
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SignatureResultCard, { result });
4629
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SignatureResultCard, { result });
4146
4630
  }
4147
4631
  if (result.kind === "summary") {
4148
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ToolResultCard, { result });
4632
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolResultCard, { result });
4149
4633
  }
4150
4634
  return null;
4151
4635
  }
4152
4636
  function isRenderableVisitorToolResult(result) {
4153
- return result.kind === "summary" || result.kind === "entity" || result.kind === "collection" || result.kind === "signature";
4637
+ return result.kind === "summary" || result.kind === "input" || result.kind === "entity" || result.kind === "collection" || result.kind === "signature";
4154
4638
  }
4155
4639
 
4156
4640
  // src/react/components/AgentRail/AgentRail.tsx
4157
- var import_jsx_runtime13 = require("react/jsx-runtime");
4641
+ var import_jsx_runtime14 = require("react/jsx-runtime");
4158
4642
  function MinimizeIcon() {
4159
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4643
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4160
4644
  "path",
4161
4645
  {
4162
4646
  d: "M3.5 8h9",
@@ -4167,7 +4651,7 @@ function MinimizeIcon() {
4167
4651
  ) });
4168
4652
  }
4169
4653
  function CloseIcon() {
4170
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4654
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4171
4655
  "path",
4172
4656
  {
4173
4657
  d: "M4 4l8 8M12 4l-8 8",
@@ -4178,7 +4662,7 @@ function CloseIcon() {
4178
4662
  ) });
4179
4663
  }
4180
4664
  function NewChatIcon() {
4181
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4665
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4182
4666
  "path",
4183
4667
  {
4184
4668
  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",
@@ -4190,7 +4674,7 @@ function NewChatIcon() {
4190
4674
  ) });
4191
4675
  }
4192
4676
  function ExpandIcon() {
4193
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4677
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4194
4678
  "path",
4195
4679
  {
4196
4680
  d: "M6 3.5H3.5V6M10 3.5h2.5V6M10 12.5h2.5V10M6 12.5H3.5V10",
@@ -4202,7 +4686,7 @@ function ExpandIcon() {
4202
4686
  ) });
4203
4687
  }
4204
4688
  function RestoreIcon() {
4205
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4689
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4206
4690
  "path",
4207
4691
  {
4208
4692
  d: "M5.5 5.5H3.5V7.5M10.5 5.5h2V7.5M10.5 10.5h2V8.5M5.5 10.5H3.5V8.5",
@@ -4231,12 +4715,13 @@ function AgentRail({
4231
4715
  onSubmit,
4232
4716
  onFollowUpSelect,
4233
4717
  onBook,
4234
- onInputResponse
4718
+ onInputResponse,
4719
+ onToolInput
4235
4720
  }) {
4236
- const transcriptRef = (0, import_react10.useRef)(null);
4721
+ const transcriptRef = (0, import_react11.useRef)(null);
4237
4722
  const resolvedBrandLabel = brandLabel.trim();
4238
4723
  const resolvedBrandLogoUrl = brandLogoUrl?.trim();
4239
- const [failedLogoUrl, setFailedLogoUrl] = (0, import_react10.useState)(null);
4724
+ const [failedLogoUrl, setFailedLogoUrl] = (0, import_react11.useState)(null);
4240
4725
  const showBrandLogo = Boolean(resolvedBrandLogoUrl) && failedLogoUrl !== resolvedBrandLogoUrl;
4241
4726
  const resolvedColorScheme = useAgentColorScheme(colorScheme);
4242
4727
  const brandedTheme = { ...defaultAgentRailTheme, ...theme };
@@ -4247,6 +4732,7 @@ function AgentRail({
4247
4732
  brandSoft: theme?.brandSoft ?? `color-mix(in srgb, ${theme?.brand ?? defaultDarkAgentRailTheme.brand} 18%, ${defaultDarkAgentRailTheme.surface})`,
4248
4733
  border: theme?.border ?? defaultDarkAgentRailTheme.border,
4249
4734
  danger: theme?.danger ?? defaultDarkAgentRailTheme.danger,
4735
+ onBrand: theme?.onBrand ?? defaultDarkAgentRailTheme.onBrand,
4250
4736
  success: theme?.success ?? defaultDarkAgentRailTheme.success,
4251
4737
  surface: theme?.surface ?? defaultDarkAgentRailTheme.surface,
4252
4738
  surfaceMuted: theme?.surfaceMuted ?? defaultDarkAgentRailTheme.surfaceMuted,
@@ -4269,6 +4755,7 @@ function AgentRail({
4269
4755
  "--as-border": resolvedTheme.border,
4270
4756
  "--as-visitor-bubble": resolvedTheme.visitorBubble,
4271
4757
  "--as-visitor-text": resolvedTheme.visitorText,
4758
+ "--as-on-brand": resolvedTheme.onBrand,
4272
4759
  "--as-success": resolvedTheme.success,
4273
4760
  "--as-danger": resolvedTheme.danger,
4274
4761
  "--as-font-body": resolvedTheme.fontBody,
@@ -4280,10 +4767,12 @@ function AgentRail({
4280
4767
  );
4281
4768
  const isBusy = state.phase === "thinking" || state.phase === "running-tools" || state.phase === "streaming" || state.phase === "waiting-input" && pendingInputRequests.length > 0;
4282
4769
  const semanticSurfaceDisabled = isBusy && state.phase !== "waiting-input";
4283
- const showActivity = state.toolSteps.length > 0;
4284
4770
  const visitorToolResults = (state.toolResults ?? []).filter(
4285
4771
  isRenderableVisitorToolResult
4286
4772
  );
4773
+ const activeVisitorToolInput = [...visitorToolResults].reverse().find((result) => result.kind === "input");
4774
+ const visibleVisitorToolResults = activeVisitorToolInput ? [activeVisitorToolInput] : visitorToolResults;
4775
+ const showActivity = state.toolSteps.length > 0 && visibleVisitorToolResults.length === 0 && pendingInputRequests.length === 0 && !state.pendingOffer;
4287
4776
  const hasVisitorMessages2 = state.messages.some(
4288
4777
  (message) => message.role === "visitor"
4289
4778
  );
@@ -4324,13 +4813,17 @@ function AgentRail({
4324
4813
  const bookingReadyText = state.streamingText || (lastIsAgent && lastMessage?.role === "agent" ? lastMessage.text : "");
4325
4814
  const waitingForBooking = !state.pendingOffer && looksLikeBookingReady(bookingReadyText) && (state.phase === "thinking" || state.phase === "running-tools" || state.phase === "streaming");
4326
4815
  const lastAgentText = lastIsAgent && lastMessage?.role === "agent" ? lastMessage.text : "";
4816
+ const hasPendingConfirmation = pendingInputRequests.some(
4817
+ (request) => request.kind === "tool-approval" || request.kind === "question" && (request.options?.length ?? 0) > 0
4818
+ );
4327
4819
  const composerForm = resolveComposerForm({
4328
4820
  agentText: lastAgentText,
4329
4821
  cards: extractToolCards(lastAgentText),
4330
4822
  hasBookingOffer: Boolean(state.pendingOffer) || waitingForBooking,
4823
+ hasPendingConfirmation,
4331
4824
  enabled: lastIsAgent && !isBusy
4332
4825
  });
4333
- (0, import_react10.useEffect)(() => {
4826
+ (0, import_react11.useEffect)(() => {
4334
4827
  const node = transcriptRef.current;
4335
4828
  if (!node) return;
4336
4829
  node.scrollTop = node.scrollHeight;
@@ -4341,7 +4834,7 @@ function AgentRail({
4341
4834
  state.followUps,
4342
4835
  state.journey
4343
4836
  ]);
4344
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4837
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
4345
4838
  "aside",
4346
4839
  {
4347
4840
  className: `agent-rail not-typeset${mobileFullscreen ? " agent-rail--mobile-fullscreen" : ""}${expanded ? " agent-rail--expanded" : ""}`,
@@ -4355,28 +4848,28 @@ function AgentRail({
4355
4848
  role: mobileFullscreen || expanded ? "dialog" : void 0,
4356
4849
  tabIndex: mobileFullscreen || expanded ? -1 : void 0,
4357
4850
  children: [
4358
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("header", { className: "agent-rail__header", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "agent-rail__brand-row", children: [
4359
- onCollapse ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4851
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("header", { className: "agent-rail__header", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "agent-rail__brand-row", children: [
4852
+ onCollapse ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4360
4853
  "button",
4361
4854
  {
4362
4855
  type: "button",
4363
4856
  className: "agent-rail__collapse",
4364
4857
  "aria-label": "Collapse assist",
4365
4858
  onClick: onCollapse,
4366
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MinimizeIcon, {})
4859
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MinimizeIcon, {})
4367
4860
  }
4368
- ) : onClose ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4861
+ ) : onClose ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4369
4862
  "button",
4370
4863
  {
4371
4864
  type: "button",
4372
4865
  className: "agent-rail__close",
4373
4866
  "aria-label": "Close agent",
4374
4867
  onClick: onClose,
4375
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CloseIcon, {})
4868
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CloseIcon, {})
4376
4869
  }
4377
- ) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
4378
- resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "agent-rail__identity", children: [
4379
- showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "agent-rail__brand-mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4870
+ ) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
4871
+ resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "agent-rail__identity", children: [
4872
+ showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "agent-rail__brand-mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4380
4873
  "img",
4381
4874
  {
4382
4875
  className: "agent-rail__brand-logo",
@@ -4387,10 +4880,10 @@ function AgentRail({
4387
4880
  }
4388
4881
  }
4389
4882
  ) }) : null,
4390
- resolvedBrandLabel ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
4883
+ resolvedBrandLabel ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
4391
4884
  ] }) : null,
4392
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "agent-rail__actions", children: [
4393
- onReset ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4885
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "agent-rail__actions", children: [
4886
+ onReset ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4394
4887
  "button",
4395
4888
  {
4396
4889
  type: "button",
@@ -4398,24 +4891,24 @@ function AgentRail({
4398
4891
  "aria-label": "Start a new conversation",
4399
4892
  disabled: !hasVisitorMessages2,
4400
4893
  onClick: onReset,
4401
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(NewChatIcon, {})
4894
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(NewChatIcon, {})
4402
4895
  }
4403
4896
  ) : null,
4404
- onExpandToggle ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4897
+ onExpandToggle ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4405
4898
  "button",
4406
4899
  {
4407
4900
  type: "button",
4408
4901
  className: "agent-rail__expand",
4409
4902
  "aria-label": expanded ? "Exit full screen" : "Open full screen",
4410
4903
  onClick: onExpandToggle,
4411
- children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RestoreIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ExpandIcon, {})
4904
+ children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RestoreIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ExpandIcon, {})
4412
4905
  }
4413
4906
  ) : null
4414
4907
  ] })
4415
4908
  ] }) }),
4416
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { ref: transcriptRef, className: "agent-rail__transcript", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "agent-rail__thread", children: [
4417
- !hasVisitorMessages2 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
4418
- greeting?.role === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4909
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { ref: transcriptRef, className: "agent-rail__transcript", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "agent-rail__thread", children: [
4910
+ !hasVisitorMessages2 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
4911
+ greeting?.role === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4419
4912
  MessageBubble,
4420
4913
  {
4421
4914
  message: greeting,
@@ -4423,7 +4916,7 @@ function AgentRail({
4423
4916
  onBook
4424
4917
  }
4425
4918
  ) : null,
4426
- showIdleFollowUps ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4919
+ showIdleFollowUps ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4427
4920
  FollowUpChips,
4428
4921
  {
4429
4922
  suggestions: state.followUps,
@@ -4432,7 +4925,7 @@ function AgentRail({
4432
4925
  onSelect: (suggestion) => onFollowUpSelect?.(suggestion.label)
4433
4926
  }
4434
4927
  ) }) : null,
4435
- showActivity ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4928
+ showActivity ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4436
4929
  AgentActivityBubble,
4437
4930
  {
4438
4931
  brandLabel: resolvedBrandLabel,
@@ -4441,8 +4934,16 @@ function AgentRail({
4441
4934
  steps: state.toolSteps
4442
4935
  }
4443
4936
  ) : null,
4444
- visitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(VisitorToolResultView, { result }, result.id)),
4445
- pendingInputRequests.map((request) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4937
+ visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4938
+ VisitorToolResultView,
4939
+ {
4940
+ result,
4941
+ disabled: semanticSurfaceDisabled,
4942
+ onToolInput
4943
+ },
4944
+ result.id
4945
+ )),
4946
+ pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4446
4947
  HumanInputCard,
4447
4948
  {
4448
4949
  request,
@@ -4451,8 +4952,8 @@ function AgentRail({
4451
4952
  request.requestId
4452
4953
  ))
4453
4954
  ] }) : null,
4454
- visibleMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "agent-rail__turn-block", children: [
4455
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4955
+ visibleMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "agent-rail__turn-block", children: [
4956
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4456
4957
  MessageBubble,
4457
4958
  {
4458
4959
  message,
@@ -4461,8 +4962,8 @@ function AgentRail({
4461
4962
  onBook
4462
4963
  }
4463
4964
  ),
4464
- index === lastVisitorIndex ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
4465
- showActivity ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4965
+ index === lastVisitorIndex ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
4966
+ showActivity ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4466
4967
  AgentActivityBubble,
4467
4968
  {
4468
4969
  brandLabel: resolvedBrandLabel,
@@ -4471,8 +4972,16 @@ function AgentRail({
4471
4972
  steps: state.toolSteps
4472
4973
  }
4473
4974
  ) : null,
4474
- visitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(VisitorToolResultView, { result }, result.id)),
4475
- pendingInputRequests.map((request) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4975
+ visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4976
+ VisitorToolResultView,
4977
+ {
4978
+ result,
4979
+ disabled: semanticSurfaceDisabled,
4980
+ onToolInput
4981
+ },
4982
+ result.id
4983
+ )),
4984
+ pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4476
4985
  HumanInputCard,
4477
4986
  {
4478
4987
  request,
@@ -4482,7 +4991,7 @@ function AgentRail({
4482
4991
  ))
4483
4992
  ] }) : null
4484
4993
  ] }, message.id)),
4485
- streamingMessage ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4994
+ streamingMessage ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4486
4995
  MessageBubble,
4487
4996
  {
4488
4997
  message: streamingMessage,
@@ -4491,22 +5000,17 @@ function AgentRail({
4491
5000
  onBook
4492
5001
  }
4493
5002
  ) : null,
4494
- waitingForBooking ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4495
- BookingCard,
4496
- {
4497
- offer: { type: "booking_offer", eventTypes: [], slots: [] }
4498
- }
4499
- ) : null,
4500
- state.error ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: "agent-rail__error", role: "alert", children: [
4501
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { children: [
4502
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: "Something went wrong" }),
4503
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { children: state.error })
5003
+ waitingForBooking ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(BookingCardLoader, {}) : null,
5004
+ state.error ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { className: "agent-rail__error", role: "alert", children: [
5005
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
5006
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { children: "Something went wrong" }),
5007
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: state.error })
4504
5008
  ] }),
4505
- onRetry ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
5009
+ onRetry ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
4506
5010
  ] }) : null
4507
5011
  ] }) }),
4508
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "agent-rail__composer-wrap", children: [
4509
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
5012
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "agent-rail__composer-wrap", children: [
5013
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4510
5014
  Composer,
4511
5015
  {
4512
5016
  variant: expanded || mobileFullscreen ? "dock" : "default",
@@ -4516,9 +5020,9 @@ function AgentRail({
4516
5020
  onSubmit
4517
5021
  }
4518
5022
  ),
4519
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "agent-rail__footer", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { children: [
4520
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "AI can make mistakes. Check important info." }),
4521
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: poweredByLabel })
5023
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "agent-rail__footer", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { children: [
5024
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: "AI can make mistakes. Check important info." }),
5025
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: poweredByLabel })
4522
5026
  ] }) })
4523
5027
  ] })
4524
5028
  ]
@@ -4527,9 +5031,9 @@ function AgentRail({
4527
5031
  }
4528
5032
 
4529
5033
  // src/react/components/AssistEdgeTab/AssistEdgeTab.tsx
4530
- var import_jsx_runtime14 = require("react/jsx-runtime");
5034
+ var import_jsx_runtime15 = require("react/jsx-runtime");
4531
5035
  function SparklesIcon() {
4532
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
5036
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
4533
5037
  "svg",
4534
5038
  {
4535
5039
  className: "assist-edge-tab__sparkles",
@@ -4537,21 +5041,21 @@ function SparklesIcon() {
4537
5041
  fill: "none",
4538
5042
  "aria-hidden": "true",
4539
5043
  children: [
4540
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5044
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4541
5045
  "path",
4542
5046
  {
4543
5047
  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",
4544
5048
  fill: "currentColor"
4545
5049
  }
4546
5050
  ),
4547
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5051
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4548
5052
  "path",
4549
5053
  {
4550
5054
  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",
4551
5055
  fill: "currentColor"
4552
5056
  }
4553
5057
  ),
4554
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5058
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4555
5059
  "path",
4556
5060
  {
4557
5061
  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",
@@ -4565,7 +5069,7 @@ function SparklesIcon() {
4565
5069
  function TabMarkIcon({ customIconUrl }) {
4566
5070
  const url = customIconUrl?.trim();
4567
5071
  if (url) {
4568
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5072
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4569
5073
  "img",
4570
5074
  {
4571
5075
  alt: "",
@@ -4575,10 +5079,10 @@ function TabMarkIcon({ customIconUrl }) {
4575
5079
  }
4576
5080
  );
4577
5081
  }
4578
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SparklesIcon, {});
5082
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SparklesIcon, {});
4579
5083
  }
4580
5084
  function ChevronLeftIcon() {
4581
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5085
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4582
5086
  "path",
4583
5087
  {
4584
5088
  d: "M10 4L6 8l4 4",
@@ -4590,7 +5094,7 @@ function ChevronLeftIcon() {
4590
5094
  ) });
4591
5095
  }
4592
5096
  function ChevronDownIcon() {
4593
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5097
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4594
5098
  "path",
4595
5099
  {
4596
5100
  d: "M4 6l4 4 4-4",
@@ -4602,7 +5106,7 @@ function ChevronDownIcon() {
4602
5106
  ) });
4603
5107
  }
4604
5108
  function DragDots() {
4605
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "assist-edge-tab__dots", "aria-hidden": "true", children: Array.from({ length: 12 }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("i", {}, index)) });
5109
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "assist-edge-tab__dots", "aria-hidden": "true", children: Array.from({ length: 12 }, (_, index) => /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("i", {}, index)) });
4606
5110
  }
4607
5111
  var VARIANT_COPY = {
4608
5112
  outline: { label: "Ask anything", aria: "Ask anything" },
@@ -4648,7 +5152,7 @@ function AssistEdgeTab({
4648
5152
  ...resolvedTextColor ? { "--as-text": resolvedTextColor } : {},
4649
5153
  colorScheme: resolvedColorScheme
4650
5154
  };
4651
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
5155
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
4652
5156
  "button",
4653
5157
  {
4654
5158
  type: "button",
@@ -4660,15 +5164,15 @@ function AssistEdgeTab({
4660
5164
  tabIndex: visible ? 0 : -1,
4661
5165
  onClick: onOpen,
4662
5166
  children: [
4663
- mobile ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
4664
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
5167
+ mobile ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
5168
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
4665
5169
  "span",
4666
5170
  {
4667
5171
  className: "assist-edge-tab__mark assist-edge-tab__mark--mobile",
4668
5172
  "aria-hidden": "true",
4669
5173
  children: [
4670
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TabMarkIcon, { customIconUrl }),
4671
- showLogo ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5174
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TabMarkIcon, { customIconUrl }),
5175
+ showLogo ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4672
5176
  "img",
4673
5177
  {
4674
5178
  className: "assist-edge-tab__logo",
@@ -4682,11 +5186,11 @@ function AssistEdgeTab({
4682
5186
  ]
4683
5187
  }
4684
5188
  ),
4685
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel })
4686
- ] }) : variant === "outline" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
4687
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
4688
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TabMarkIcon, { customIconUrl }),
4689
- showLogo ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5189
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel })
5190
+ ] }) : variant === "outline" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
5191
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
5192
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TabMarkIcon, { customIconUrl }),
5193
+ showLogo ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4690
5194
  "img",
4691
5195
  {
4692
5196
  className: "assist-edge-tab__logo",
@@ -4698,18 +5202,18 @@ function AssistEdgeTab({
4698
5202
  }
4699
5203
  ) : null
4700
5204
  ] }),
4701
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
4702
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ChevronDownIcon, {})
5205
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
5206
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronDownIcon, {})
4703
5207
  ] }) : null,
4704
- variant === "ask" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
4705
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ChevronLeftIcon, {}),
4706
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
4707
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DragDots, {})
5208
+ variant === "ask" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
5209
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronLeftIcon, {}),
5210
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
5211
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DragDots, {})
4708
5212
  ] }) : null,
4709
- variant === "fill" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
4710
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
4711
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TabMarkIcon, { customIconUrl }),
4712
- showLogo ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5213
+ variant === "fill" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
5214
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
5215
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TabMarkIcon, { customIconUrl }),
5216
+ showLogo ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4713
5217
  "img",
4714
5218
  {
4715
5219
  className: "assist-edge-tab__logo",
@@ -4721,8 +5225,8 @@ function AssistEdgeTab({
4721
5225
  }
4722
5226
  ) : null
4723
5227
  ] }),
4724
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
4725
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ChevronLeftIcon, {})
5228
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
5229
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronLeftIcon, {})
4726
5230
  ] }) : null
4727
5231
  ]
4728
5232
  }
@@ -4730,7 +5234,7 @@ function AssistEdgeTab({
4730
5234
  }
4731
5235
 
4732
5236
  // src/react/components/AgentWidget/AgentWidget.tsx
4733
- var import_jsx_runtime15 = require("react/jsx-runtime");
5237
+ var import_jsx_runtime16 = require("react/jsx-runtime");
4734
5238
  function AgentWidget({
4735
5239
  indexId,
4736
5240
  customerId,
@@ -4748,9 +5252,9 @@ function AgentWidget({
4748
5252
  }) {
4749
5253
  const isMobile = useIsMobile();
4750
5254
  const placement = normalizeAgentPlacement(placementInput);
4751
- const railSlotRef = (0, import_react11.useRef)(null);
4752
- const [railCollapsed, setRailCollapsed] = (0, import_react11.useState)(defaultCollapsed);
4753
- const [railExpanded, setRailExpanded] = (0, import_react11.useState)(false);
5255
+ const railSlotRef = (0, import_react12.useRef)(null);
5256
+ const [railCollapsed, setRailCollapsed] = (0, import_react12.useState)(defaultCollapsed);
5257
+ const [railExpanded, setRailExpanded] = (0, import_react12.useState)(false);
4754
5258
  const pageShiftActive = shouldApplyPageShift({
4755
5259
  pageShift,
4756
5260
  isMobile,
@@ -4780,7 +5284,10 @@ function AgentWidget({
4780
5284
  visitorBubble: branding.colors.primary
4781
5285
  } : {},
4782
5286
  ...branding?.colors?.primarySoft ? { brandSoft: branding.colors.primarySoft } : {},
4783
- ...branding?.colors?.primaryForeground ? { visitorText: branding.colors.primaryForeground } : {},
5287
+ ...branding?.colors?.primaryForeground ? {
5288
+ onBrand: branding.colors.primaryForeground,
5289
+ visitorText: branding.colors.primaryForeground
5290
+ } : {},
4784
5291
  ...branding?.colors?.surface ? { surface: branding.colors.surface } : {},
4785
5292
  ...branding?.colors?.surfaceMuted ? { surfaceMuted: branding.colors.surfaceMuted } : {},
4786
5293
  ...branding?.colors?.text ? { text: branding.colors.text } : {},
@@ -4790,7 +5297,7 @@ function AgentWidget({
4790
5297
  } : {},
4791
5298
  ...branding?.colors?.border ? { border: branding.colors.border } : {}
4792
5299
  };
4793
- (0, import_react11.useEffect)(() => {
5300
+ (0, import_react12.useEffect)(() => {
4794
5301
  if (!registerPanelController) return;
4795
5302
  registerAgentPanelController(customerId, {
4796
5303
  open: () => setRailCollapsed(false),
@@ -4807,7 +5314,7 @@ function AgentWidget({
4807
5314
  if (isMobile) setRailCollapsed(false);
4808
5315
  await submit(message);
4809
5316
  }
4810
- (0, import_react11.useEffect)(() => {
5317
+ (0, import_react12.useEffect)(() => {
4811
5318
  if (railCollapsed) return;
4812
5319
  const handleKeyDown = (event) => {
4813
5320
  if (event.key === "Tab" && (isMobile || railExpanded)) {
@@ -4841,19 +5348,19 @@ function AgentWidget({
4841
5348
  window.addEventListener("keydown", handleKeyDown);
4842
5349
  return () => window.removeEventListener("keydown", handleKeyDown);
4843
5350
  }, [isMobile, railCollapsed, railExpanded]);
4844
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "webless-agent-root", children: [
4845
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5351
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "webless-agent-root", children: [
5352
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4846
5353
  "div",
4847
5354
  {
4848
5355
  className: `webless-agent-root__shell${railCollapsed ? " webless-agent-root__shell--collapsed" : ""}${railExpanded ? " webless-agent-root__shell--expanded" : ""}`,
4849
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5356
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4850
5357
  "div",
4851
5358
  {
4852
5359
  ref: railSlotRef,
4853
5360
  className: "webless-agent-root__rail-slot",
4854
5361
  inert: railCollapsed || void 0,
4855
5362
  "aria-hidden": railCollapsed,
4856
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5363
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4857
5364
  AgentRail,
4858
5365
  {
4859
5366
  theme,
@@ -4881,7 +5388,7 @@ function AgentWidget({
4881
5388
  )
4882
5389
  }
4883
5390
  ),
4884
- railCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5391
+ railCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4885
5392
  AssistEdgeTab,
4886
5393
  {
4887
5394
  variant: placement.variant,
@@ -4920,12 +5427,12 @@ function readUnpublishedPreviewBuildId(href) {
4920
5427
  }
4921
5428
 
4922
5429
  // src/embed/AgentWidget.tsx
4923
- var import_jsx_runtime16 = require("react/jsx-runtime");
5430
+ var import_jsx_runtime17 = require("react/jsx-runtime");
4924
5431
  function AgentWidget2({
4925
5432
  manifest
4926
5433
  }) {
4927
5434
  const defaultCollapsed = manifest.version !== "unpublished";
4928
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5435
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4929
5436
  AgentWidget,
4930
5437
  {
4931
5438
  indexId: manifest.indexId,
@@ -5009,7 +5516,7 @@ function normalizeAgentBranding(branding) {
5009
5516
  }
5010
5517
 
5011
5518
  // src/embed/mount.tsx
5012
- var import_jsx_runtime17 = require("react/jsx-runtime");
5519
+ var import_jsx_runtime18 = require("react/jsx-runtime");
5013
5520
  var mountedHandles = /* @__PURE__ */ new Map();
5014
5521
  var latestCustomerId = null;
5015
5522
  function resolveMountHost(manifest, script) {
@@ -5039,7 +5546,7 @@ function mountAgent(input) {
5039
5546
  const host = createHost(manifest.customerId);
5040
5547
  mountTarget.append(host);
5041
5548
  const root = (0, import_client5.createRoot)(host);
5042
- root.render(/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AgentWidget2, { manifest }));
5549
+ root.render(/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AgentWidget2, { manifest }));
5043
5550
  const handle = {
5044
5551
  customerId: manifest.customerId,
5045
5552
  manifest,