@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/react.cjs CHANGED
@@ -20,6 +20,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/react/index.ts
21
21
  var react_exports = {};
22
22
  __export(react_exports, {
23
+ AGENT_STRUCTURED_TOOL_INPUT_HEADER: () => AGENT_STRUCTURED_TOOL_INPUT_HEADER,
24
+ AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION: () => AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION,
23
25
  AgentRail: () => AgentRail,
24
26
  AgentWidget: () => AgentWidget,
25
27
  AssistEdgeTab: () => AssistEdgeTab,
@@ -28,6 +30,7 @@ __export(react_exports, {
28
30
  createIdleSuggestions: () => createIdleSuggestions,
29
31
  defaultAgentRailTheme: () => defaultAgentRailTheme,
30
32
  defaultDarkAgentRailTheme: () => defaultDarkAgentRailTheme,
33
+ formatAgentStructuredToolInput: () => formatAgentStructuredToolInput,
31
34
  hasVisitorMessages: () => hasVisitorMessages,
32
35
  isAgentBusy: () => isAgentBusy,
33
36
  normalizeAgentPlacement: () => normalizeAgentPlacement,
@@ -37,7 +40,7 @@ __export(react_exports, {
37
40
  module.exports = __toCommonJS(react_exports);
38
41
 
39
42
  // src/react/components/AgentWidget/AgentWidget.tsx
40
- var import_react11 = require("react");
43
+ var import_react12 = require("react");
41
44
 
42
45
  // src/react/page-shift.ts
43
46
  var import_react = require("react");
@@ -382,6 +385,17 @@ function clearPersistedAgentSession(visitorSessionId, options) {
382
385
 
383
386
  // src/runtime/tool-ui.ts
384
387
  var AGENT_TOOL_UI_SCHEMA_VERSION = "webless.tool-ui.v1";
388
+ var AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION = "webless.structured-tool-input.v1";
389
+ var AGENT_STRUCTURED_TOOL_INPUT_HEADER = "Webless-Structured-Tool-Input-JSON:";
390
+ function formatAgentStructuredToolInput(surface, values) {
391
+ const payload = {
392
+ schemaVersion: AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION,
393
+ toolSlug: surface.toolSlug,
394
+ ...surface.operationId ? { operationId: surface.operationId } : {},
395
+ values
396
+ };
397
+ return `${AGENT_STRUCTURED_TOOL_INPUT_HEADER} ${JSON.stringify(payload)}`;
398
+ }
385
399
  function isRecord2(value) {
386
400
  return value !== null && typeof value === "object" && !Array.isArray(value);
387
401
  }
@@ -1166,11 +1180,11 @@ function createAgentClient(options) {
1166
1180
 
1167
1181
  // src/runtime/errors.ts
1168
1182
  var import_client3 = require("eve/client");
1169
- var TRANSIENT_AGENT_ERROR_MESSAGE = "I couldn\u2019t finish that answer. Please try again.";
1183
+ var TRANSIENT_AGENT_ERROR_MESSAGE = "The agent run stopped before the action finished. Please try again.";
1170
1184
  var PREVIEW_AUTHORIZATION_ERROR_MESSAGE = "This preview could not be authorized. Open the latest preview from Webless.";
1171
1185
  function isTransientRuntimeMessage(message) {
1172
1186
  const normalized = message.trim().toLowerCase();
1173
- return normalized.includes("empty response from runtime") || normalized.includes("failed to fetch") || normalized.includes("networkerror") || normalized.includes("load failed");
1187
+ 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");
1174
1188
  }
1175
1189
  function isPreviewAuthorizationMessage(message) {
1176
1190
  const normalized = message.trim().toLowerCase();
@@ -1326,21 +1340,46 @@ function looksLikeBookingCopy(text) {
1326
1340
  text
1327
1341
  );
1328
1342
  }
1329
- function inferComposerForm(text) {
1330
- const cleaned = text.trim();
1331
- if (!cleaned || looksLikeBookingCopy(cleaned) || !looksLikeFieldCollection(cleaned)) {
1332
- return null;
1333
- }
1334
- const fields = FIELD_LIBRARY.flatMap((field) => {
1335
- if (field.exclude?.test(cleaned)) {
1336
- const leftover = cleaned.replace(field.exclude, " ");
1343
+ function echoedLabeledFieldIds(text) {
1344
+ const ids = /* @__PURE__ */ new Set();
1345
+ if (/\bname\s*:\s+\S+/i.test(text)) ids.add("name");
1346
+ if (/\be-?mail\s*:\s+\S+/i.test(text)) ids.add("email");
1347
+ if (/\bphone\s*:\s+\S+/i.test(text)) ids.add("phone");
1348
+ if (/\bcompany\s*:\s+\S+/i.test(text)) ids.add("company");
1349
+ return ids;
1350
+ }
1351
+ function matchLibraryFields(text) {
1352
+ return FIELD_LIBRARY.flatMap((field) => {
1353
+ if (field.exclude?.test(text)) {
1354
+ const leftover = text.replace(field.exclude, " ");
1337
1355
  if (!field.patterns.some((pattern) => pattern.test(leftover))) return [];
1338
- } else if (!field.patterns.some((pattern) => pattern.test(cleaned))) {
1356
+ } else if (!field.patterns.some((pattern) => pattern.test(text))) {
1339
1357
  return [];
1340
1358
  }
1341
1359
  const { patterns: _patterns, exclude: _exclude, ...next } = field;
1342
1360
  return [next];
1343
1361
  }).slice(0, MAX_FORM_FIELDS);
1362
+ }
1363
+ function looksLikeCompletedActionRecap(text) {
1364
+ const confirmingCreate = /\bshould i create this\b/i.test(text);
1365
+ const echoingFilledFields = /\b(?:name|email|phone|company)\s*:\s+\S+/i.test(text) && /[^\s@]+@[^\s@]+\.[^\s@]+/i.test(text);
1366
+ if (echoingFilledFields) {
1367
+ if (looksLikeFieldCollection(text)) {
1368
+ const echoed = echoedLabeledFieldIds(text);
1369
+ if (matchLibraryFields(text).some((field) => !echoed.has(field.id))) {
1370
+ return false;
1371
+ }
1372
+ }
1373
+ return true;
1374
+ }
1375
+ return confirmingCreate && !looksLikeFieldCollection(text);
1376
+ }
1377
+ function inferComposerForm(text) {
1378
+ const cleaned = text.trim();
1379
+ if (!cleaned || looksLikeBookingCopy(cleaned) || looksLikeCompletedActionRecap(cleaned) || !looksLikeFieldCollection(cleaned)) {
1380
+ return null;
1381
+ }
1382
+ const fields = matchLibraryFields(cleaned);
1344
1383
  if (fields.length < MIN_FORM_FIELDS) return null;
1345
1384
  return {
1346
1385
  id: `inferred:${fields.map((field) => field.id).join("+")}`,
@@ -1348,7 +1387,9 @@ function inferComposerForm(text) {
1348
1387
  };
1349
1388
  }
1350
1389
  function resolveComposerForm(input) {
1351
- if (input.enabled === false || input.hasBookingOffer) return null;
1390
+ if (input.enabled === false || input.hasBookingOffer || input.hasPendingConfirmation) {
1391
+ return null;
1392
+ }
1352
1393
  const text = input.agentText.trim();
1353
1394
  if (!text) return null;
1354
1395
  const card = input.cards?.find((item) => item.type === "visitor_form");
@@ -1373,7 +1414,7 @@ function preferBookingOffer(current, next) {
1373
1414
  return next;
1374
1415
  }
1375
1416
  function looksLikeBookingReady(text) {
1376
- return /demo option|options are ready|pick a (date|time)|available (times|slots)|book(ing)? (card|the demo)|schedule/i.test(
1417
+ return /demo option|options are ready|pick a (date|time)|available (times|slots)|book(ing)? (card|the demo)|\bschedule\b/i.test(
1377
1418
  text
1378
1419
  );
1379
1420
  }
@@ -2185,7 +2226,8 @@ function presentVisitorToolResult(result, registry = []) {
2185
2226
  id: result.callId,
2186
2227
  toolName: result.toolName,
2187
2228
  status: result.status,
2188
- kind: "hidden"
2229
+ kind: "input",
2230
+ surface: envelope.ui
2189
2231
  };
2190
2232
  }
2191
2233
  if (!proposed) {
@@ -2242,6 +2284,7 @@ function legacyBookingEnvelope(output) {
2242
2284
 
2243
2285
  // src/react/lib/visitor-input.ts
2244
2286
  function shouldRenderVisitorInputCard(request) {
2287
+ if (request.ui) return true;
2245
2288
  if (request.kind === "tool-approval" || request.kind === "session-limit") {
2246
2289
  return true;
2247
2290
  }
@@ -2575,7 +2618,6 @@ function useAgentChat({
2575
2618
  }
2576
2619
  if (!isActiveRun()) return;
2577
2620
  if (presentation.kind === "hidden") return;
2578
- if (presentation.kind === "input") return;
2579
2621
  setState((prev) => ({
2580
2622
  ...prev,
2581
2623
  toolResults: [
@@ -2853,14 +2895,13 @@ ${outgoing}` : outgoing;
2853
2895
  }, [runTurn, state.messages]);
2854
2896
  const respondToToolInput = (0, import_react2.useCallback)(
2855
2897
  async (surface, values) => {
2856
- const details = JSON.stringify(values);
2857
- await submit(`${surface.title} details provided`, {
2898
+ await submit(`${surface.title} submitted`, {
2858
2899
  runtimeText: [
2859
- `Structured input provided for ${surface.toolSlug}.`,
2860
- surface.operationId ? `Operation: ${surface.operationId}.` : "",
2861
- `Use these exact values and retry the action: ${details}`,
2900
+ formatAgentStructuredToolInput(surface, values),
2901
+ "Use these exact structured values to retry the requested action.",
2902
+ "Reuse the operationId from the structured payload.",
2862
2903
  "Do not invent or alter any values."
2863
- ].filter(Boolean).join("\n")
2904
+ ].join("\n")
2864
2905
  });
2865
2906
  },
2866
2907
  [submit]
@@ -2994,7 +3035,7 @@ function unregisterAgentPanelController(customerId) {
2994
3035
  }
2995
3036
 
2996
3037
  // src/react/components/AgentRail/AgentRail.tsx
2997
- var import_react10 = require("react");
3038
+ var import_react11 = require("react");
2998
3039
 
2999
3040
  // src/react/types/conversation.ts
3000
3041
  var defaultAgentRailTheme = {
@@ -3010,6 +3051,7 @@ var defaultAgentRailTheme = {
3010
3051
  border: "rgb(42 51 70 / 0.1)",
3011
3052
  visitorBubble: "#f3edff",
3012
3053
  visitorText: "#171b2a",
3054
+ onBrand: "#ffffff",
3013
3055
  success: "#18794e",
3014
3056
  danger: "#c94b63",
3015
3057
  fontBody: '"Mulish", "Avenir Next", "Segoe UI", sans-serif',
@@ -3028,6 +3070,7 @@ var defaultDarkAgentRailTheme = {
3028
3070
  border: "rgb(226 232 240 / 0.16)",
3029
3071
  visitorBubble: "#2b2140",
3030
3072
  visitorText: "#f5f7fb",
3073
+ onBrand: "#171b2a",
3031
3074
  success: "#55cf91",
3032
3075
  danger: "#ff8da1"
3033
3076
  };
@@ -3145,7 +3188,7 @@ function AgentActivityBubble({
3145
3188
  workSummary(steps, failed, brandLabel)
3146
3189
  ] }),
3147
3190
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "agent-activity-bubble__details", children: [
3148
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
3191
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
3149
3192
  "button",
3150
3193
  {
3151
3194
  type: "button",
@@ -3157,10 +3200,7 @@ function AgentActivityBubble({
3157
3200
  (current) => current === receiptId ? null : receiptId
3158
3201
  );
3159
3202
  },
3160
- children: [
3161
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "agent-activity-bubble__summary-title", children: "How this answer was made" }),
3162
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "agent-activity-bubble__summary-toggle", children: detailsOpen ? "Hide work" : "Show work" })
3163
- ]
3203
+ children: "How this answer was made"
3164
3204
  }
3165
3205
  ),
3166
3206
  detailsOpen ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("ol", { className: "agent-activity-bubble__steps", children: visibleSteps.map((step) => {
@@ -3472,6 +3512,9 @@ function calendarCells(year, month) {
3472
3512
  while (cells.length < 42) cells.push(null);
3473
3513
  return cells;
3474
3514
  }
3515
+ function BookingCardLoader() {
3516
+ 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" }) });
3517
+ }
3475
3518
  function BookingCard({
3476
3519
  offer,
3477
3520
  onBook
@@ -3891,7 +3934,7 @@ function MessageBubble({
3891
3934
  }
3892
3935
 
3893
3936
  // src/react/components/HumanInputCard/HumanInputCard.tsx
3894
- var import_react9 = require("react");
3937
+ var import_react10 = require("react");
3895
3938
 
3896
3939
  // src/react/components/ConfirmationCard/ConfirmationCard.tsx
3897
3940
  var import_jsx_runtime6 = require("react/jsx-runtime");
@@ -3932,18 +3975,450 @@ function ConfirmationCard({
3932
3975
  );
3933
3976
  }
3934
3977
 
3935
- // src/react/components/HumanInputCard/HumanInputCard.tsx
3978
+ // src/react/components/ToolInputCard/ToolInputCard.tsx
3979
+ var import_react9 = require("react");
3936
3980
  var import_jsx_runtime7 = require("react/jsx-runtime");
3981
+ function isRecord4(value) {
3982
+ return value !== null && typeof value === "object" && !Array.isArray(value);
3983
+ }
3984
+ function pathSegments(path) {
3985
+ return path.replace(/\[(\d+)\]/gu, ".$1").split(".").filter(Boolean);
3986
+ }
3987
+ function valueAtPath(root, path) {
3988
+ let current = root;
3989
+ for (const segment of pathSegments(path)) {
3990
+ if (Array.isArray(current)) {
3991
+ const index = Number(segment);
3992
+ current = Number.isInteger(index) ? current[index] : void 0;
3993
+ continue;
3994
+ }
3995
+ current = isRecord4(current) ? current[segment] : void 0;
3996
+ }
3997
+ return current;
3998
+ }
3999
+ function initialFieldValue(field, surface) {
4000
+ const supplied = valueAtPath(surface.values, field.path);
4001
+ if (supplied !== void 0) return supplied;
4002
+ if (field.defaultValue !== void 0) return field.defaultValue;
4003
+ if (field.kind === "checkbox" || field.kind === "confirmation") return false;
4004
+ if (field.kind === "multi-select") return [];
4005
+ if (field.kind === "range") return field.min ?? 0;
4006
+ return "";
4007
+ }
4008
+ function initialValues(surface) {
4009
+ return Object.fromEntries(
4010
+ surface.fields.map((field) => [
4011
+ field.path,
4012
+ initialFieldValue(field, surface)
4013
+ ])
4014
+ );
4015
+ }
4016
+ function cloneJsonValue(value) {
4017
+ if (Array.isArray(value)) return value.map(cloneJsonValue);
4018
+ if (isRecord4(value)) {
4019
+ return Object.fromEntries(
4020
+ Object.entries(value).map(([key, item]) => [key, cloneJsonValue(item)])
4021
+ );
4022
+ }
4023
+ return value;
4024
+ }
4025
+ function assignPath(target, path, value) {
4026
+ const segments = pathSegments(path);
4027
+ let current = target;
4028
+ segments.forEach((segment, index) => {
4029
+ if (index === segments.length - 1) {
4030
+ current[segment] = value;
4031
+ return;
4032
+ }
4033
+ const existing = current[segment];
4034
+ if (!isRecord4(existing)) current[segment] = {};
4035
+ current = current[segment];
4036
+ });
4037
+ }
4038
+ function isJsonValue3(value, seen = /* @__PURE__ */ new Set()) {
4039
+ if (value === null || typeof value === "string" || typeof value === "boolean") {
4040
+ return true;
4041
+ }
4042
+ if (typeof value === "number") return Number.isFinite(value);
4043
+ if (typeof value !== "object" || seen.has(value)) return false;
4044
+ seen.add(value);
4045
+ const valid = Array.isArray(value) ? value.every((item) => isJsonValue3(item, seen)) : Object.values(value).every((item) => isJsonValue3(item, seen));
4046
+ seen.delete(value);
4047
+ return valid;
4048
+ }
4049
+ function parsedFieldValue(field, value) {
4050
+ if (field.kind !== "json" || typeof value !== "string") return value;
4051
+ try {
4052
+ const parsed = JSON.parse(value);
4053
+ return isJsonValue3(parsed) ? parsed : void 0;
4054
+ } catch {
4055
+ return void 0;
4056
+ }
4057
+ }
4058
+ function isEmpty(value) {
4059
+ if (typeof value === "string") return value.trim().length === 0;
4060
+ if (Array.isArray(value)) return value.length === 0;
4061
+ return value === null || value === false;
4062
+ }
4063
+ function validateField(field, value) {
4064
+ if (field.required && isEmpty(value))
4065
+ return `Enter ${field.label.toLowerCase()}.`;
4066
+ if (typeof value === "string" && value.trim().length === 0) return "";
4067
+ if (field.kind === "email" && (typeof value !== "string" || !/^[^\s@]+@[^\s@]+\.[^\s@]+$/u.test(value))) {
4068
+ return "Enter a valid email address.";
4069
+ }
4070
+ if (typeof value === "string") {
4071
+ if (field.minLength !== void 0 && value.length < field.minLength) {
4072
+ return `Use at least ${field.minLength} characters.`;
4073
+ }
4074
+ if (field.maxLength !== void 0 && value.length > field.maxLength) {
4075
+ return `Use no more than ${field.maxLength} characters.`;
4076
+ }
4077
+ }
4078
+ if (typeof value === "number") {
4079
+ if (field.min !== void 0 && value < field.min) {
4080
+ return `Choose ${field.min} or higher.`;
4081
+ }
4082
+ if (field.max !== void 0 && value > field.max) {
4083
+ return `Choose ${field.max} or lower.`;
4084
+ }
4085
+ }
4086
+ if (field.maxItems !== void 0 && Array.isArray(value) && value.length > field.maxItems) {
4087
+ return `Choose no more than ${field.maxItems}.`;
4088
+ }
4089
+ if (field.kind === "json" && parsedFieldValue(field, value) === void 0) {
4090
+ return "Enter valid JSON.";
4091
+ }
4092
+ return "";
4093
+ }
4094
+ function optionKey(option) {
4095
+ return JSON.stringify(option.value);
4096
+ }
4097
+ function valuesMatch(left, right) {
4098
+ return JSON.stringify(left) === JSON.stringify(right);
4099
+ }
4100
+ function FieldDescription({
4101
+ field,
4102
+ id
4103
+ }) {
4104
+ return field.description ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { id, className: "tool-input-card__description", children: field.description }) : null;
4105
+ }
4106
+ function ChoiceField({
4107
+ field,
4108
+ id,
4109
+ value,
4110
+ disabled,
4111
+ describedBy,
4112
+ error,
4113
+ onBlur,
4114
+ onChange
4115
+ }) {
4116
+ const options = field.options ?? [];
4117
+ const multiple = field.kind === "multi-select";
4118
+ const selected = Array.isArray(value) ? value : [];
4119
+ if (field.kind === "select") {
4120
+ const selectedIndex = options.findIndex(
4121
+ (option) => valuesMatch(option.value, value)
4122
+ );
4123
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
4124
+ "select",
4125
+ {
4126
+ id,
4127
+ value: selectedIndex >= 0 ? String(selectedIndex) : "",
4128
+ disabled,
4129
+ required: field.required,
4130
+ "aria-describedby": describedBy,
4131
+ "aria-invalid": Boolean(error),
4132
+ onBlur,
4133
+ onChange: (event) => {
4134
+ const option = options[Number(event.target.value)];
4135
+ if (option) onChange(option.value);
4136
+ },
4137
+ children: [
4138
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: "", disabled: field.required, children: "Choose an option" }),
4139
+ options.map((option, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("option", { value: index, children: option.label }, optionKey(option)))
4140
+ ]
4141
+ }
4142
+ );
4143
+ }
4144
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4145
+ "div",
4146
+ {
4147
+ className: "tool-input-card__choices",
4148
+ role: multiple ? "group" : "radiogroup",
4149
+ "aria-labelledby": `${id}-label`,
4150
+ "aria-describedby": describedBy,
4151
+ "aria-invalid": Boolean(error),
4152
+ "aria-required": field.required,
4153
+ children: options.map((option, index) => {
4154
+ const checked = multiple ? selected.some((item) => valuesMatch(item, option.value)) : valuesMatch(value, option.value);
4155
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "tool-input-card__choice", children: [
4156
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4157
+ "input",
4158
+ {
4159
+ type: multiple ? "checkbox" : "radio",
4160
+ name: id,
4161
+ value: String(index),
4162
+ checked,
4163
+ disabled,
4164
+ onBlur,
4165
+ onChange: () => {
4166
+ if (!multiple) {
4167
+ onChange(option.value);
4168
+ return;
4169
+ }
4170
+ onChange(
4171
+ checked ? selected.filter(
4172
+ (item) => !valuesMatch(item, option.value)
4173
+ ) : [...selected, option.value]
4174
+ );
4175
+ }
4176
+ }
4177
+ ),
4178
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { children: option.label })
4179
+ ] }, optionKey(option));
4180
+ })
4181
+ }
4182
+ );
4183
+ }
4184
+ function ToolField({
4185
+ disabled,
4186
+ error,
4187
+ field,
4188
+ id,
4189
+ value,
4190
+ onBlur,
4191
+ onChange
4192
+ }) {
4193
+ const describedBy = [
4194
+ field.description ? `${id}-description` : "",
4195
+ error ? `${id}-error` : ""
4196
+ ].filter(Boolean).join(" ");
4197
+ if (field.kind === "checkbox" || field.kind === "confirmation") {
4198
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "tool-input-card__field", children: [
4199
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: "tool-input-card__check", htmlFor: id, children: [
4200
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4201
+ "input",
4202
+ {
4203
+ id,
4204
+ type: "checkbox",
4205
+ checked: value === true,
4206
+ disabled,
4207
+ "aria-describedby": describedBy || void 0,
4208
+ "aria-invalid": Boolean(error),
4209
+ onBlur,
4210
+ onChange: (event) => onChange(event.target.checked)
4211
+ }
4212
+ ),
4213
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("span", { children: [
4214
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("strong", { children: field.label }),
4215
+ field.description ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { id: `${id}-description`, children: field.description }) : null
4216
+ ] })
4217
+ ] }),
4218
+ error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
4219
+ ] });
4220
+ }
4221
+ const label = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { id: `${id}-label`, htmlFor: id, children: [
4222
+ field.label,
4223
+ field.required ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { "aria-hidden": "true", children: " *" }) : null
4224
+ ] });
4225
+ const common = {
4226
+ id,
4227
+ disabled,
4228
+ required: field.required,
4229
+ "aria-describedby": describedBy || void 0,
4230
+ "aria-invalid": Boolean(error),
4231
+ onBlur
4232
+ };
4233
+ let control;
4234
+ if (field.kind === "select" || field.kind === "radio" || field.kind === "multi-select") {
4235
+ control = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4236
+ ChoiceField,
4237
+ {
4238
+ field,
4239
+ id,
4240
+ value,
4241
+ disabled,
4242
+ describedBy: describedBy || void 0,
4243
+ error,
4244
+ onBlur,
4245
+ onChange
4246
+ }
4247
+ );
4248
+ } else if (field.kind === "textarea" || field.kind === "json") {
4249
+ control = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4250
+ "textarea",
4251
+ {
4252
+ ...common,
4253
+ rows: field.kind === "json" ? 4 : 3,
4254
+ maxLength: field.maxLength,
4255
+ minLength: field.minLength,
4256
+ placeholder: field.placeholder,
4257
+ value: typeof value === "string" ? value : JSON.stringify(value),
4258
+ onChange: (event) => onChange(event.target.value)
4259
+ }
4260
+ );
4261
+ } else if (field.kind === "range") {
4262
+ const numericValue = typeof value === "number" ? value : field.min ?? 0;
4263
+ control = /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "tool-input-card__range", children: [
4264
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4265
+ "input",
4266
+ {
4267
+ ...common,
4268
+ type: "range",
4269
+ min: field.min,
4270
+ max: field.max,
4271
+ step: field.step,
4272
+ value: numericValue,
4273
+ onChange: (event) => onChange(Number(event.target.value))
4274
+ }
4275
+ ),
4276
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("output", { htmlFor: id, children: numericValue })
4277
+ ] });
4278
+ } else {
4279
+ const type = field.kind === "date-time" ? "datetime-local" : field.kind === "calendar" ? "date" : field.kind;
4280
+ control = /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4281
+ "input",
4282
+ {
4283
+ ...common,
4284
+ type,
4285
+ min: field.min,
4286
+ max: field.max,
4287
+ step: field.step,
4288
+ minLength: field.minLength,
4289
+ maxLength: field.maxLength,
4290
+ placeholder: field.placeholder,
4291
+ value: typeof value === "number" || typeof value === "string" ? value : "",
4292
+ onChange: (event) => onChange(
4293
+ field.kind === "number" && event.target.value !== "" ? Number(event.target.value) : event.target.value
4294
+ )
4295
+ }
4296
+ );
4297
+ }
4298
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "tool-input-card__field", children: [
4299
+ label,
4300
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(FieldDescription, { field, id: `${id}-description` }),
4301
+ control,
4302
+ error ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { id: `${id}-error`, className: "tool-input-card__error", children: error }) : null
4303
+ ] });
4304
+ }
4305
+ function ToolInputCard({
4306
+ disabled = false,
4307
+ surface,
4308
+ onSubmit
4309
+ }) {
4310
+ const [values, setValues] = (0, import_react9.useState)(
4311
+ () => initialValues(surface)
4312
+ );
4313
+ const [touched, setTouched] = (0, import_react9.useState)(() => /* @__PURE__ */ new Set());
4314
+ const [submitted, setSubmitted] = (0, import_react9.useState)(false);
4315
+ const errors = Object.fromEntries(
4316
+ surface.fields.map((field) => [
4317
+ field.path,
4318
+ touched.has(field.path) ? validateField(field, values[field.path] ?? "") : ""
4319
+ ])
4320
+ );
4321
+ function submit(event) {
4322
+ event.preventDefault();
4323
+ if (disabled || submitted) return;
4324
+ const allTouched = new Set(surface.fields.map((field) => field.path));
4325
+ setTouched(allTouched);
4326
+ const nextErrors = surface.fields.map(
4327
+ (field) => validateField(field, values[field.path] ?? "")
4328
+ );
4329
+ if (nextErrors.some(Boolean)) return;
4330
+ const result = isRecord4(surface.values) ? cloneJsonValue(surface.values) : {};
4331
+ for (const field of surface.fields) {
4332
+ const parsed = parsedFieldValue(field, values[field.path] ?? "");
4333
+ if (parsed !== void 0) assignPath(result, field.path, parsed);
4334
+ }
4335
+ setSubmitted(true);
4336
+ onSubmit?.(surface, result);
4337
+ }
4338
+ if (submitted) {
4339
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
4340
+ "section",
4341
+ {
4342
+ className: "tool-input-card tool-input-card--submitted",
4343
+ role: "status",
4344
+ children: [
4345
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { "aria-hidden": "true", children: "\u2713" }),
4346
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("strong", { children: [
4347
+ surface.title,
4348
+ " submitted"
4349
+ ] })
4350
+ ]
4351
+ }
4352
+ );
4353
+ }
4354
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
4355
+ "section",
4356
+ {
4357
+ className: "tool-input-card",
4358
+ "aria-labelledby": `tool-input-${surface.id}`,
4359
+ children: [
4360
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "tool-input-card__heading", children: [
4361
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("strong", { id: `tool-input-${surface.id}`, children: surface.title }),
4362
+ surface.description ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { children: surface.description }) : null
4363
+ ] }),
4364
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("form", { noValidate: true, onSubmit: submit, children: [
4365
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "tool-input-card__fields", children: surface.fields.map((field, index) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4366
+ ToolField,
4367
+ {
4368
+ disabled,
4369
+ error: errors[field.path] ?? "",
4370
+ field,
4371
+ id: `tool-input-${surface.id}-${index}`,
4372
+ value: values[field.path] ?? "",
4373
+ onBlur: () => setTouched((current) => /* @__PURE__ */ new Set([...current, field.path])),
4374
+ onChange: (value) => setValues((current) => ({ ...current, [field.path]: value }))
4375
+ },
4376
+ field.path
4377
+ )) }),
4378
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "tool-input-card__actions", children: [
4379
+ surface.actions?.some((action) => action.id === "reset") ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4380
+ "button",
4381
+ {
4382
+ type: "button",
4383
+ className: "tool-input-card__secondary",
4384
+ disabled,
4385
+ onClick: () => {
4386
+ setValues(initialValues(surface));
4387
+ setTouched(/* @__PURE__ */ new Set());
4388
+ },
4389
+ children: surface.actions.find((action) => action.id === "reset")?.label ?? "Clear"
4390
+ }
4391
+ ) : null,
4392
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "submit", disabled, children: surface.submitLabel ?? surface.actions?.find((action) => action.id === "submit")?.label ?? "Continue" })
4393
+ ] })
4394
+ ] })
4395
+ ]
4396
+ }
4397
+ );
4398
+ }
4399
+
4400
+ // src/react/components/HumanInputCard/HumanInputCard.tsx
4401
+ var import_jsx_runtime8 = require("react/jsx-runtime");
3937
4402
  function HumanInputCard({
3938
4403
  disabled = false,
3939
4404
  request,
3940
4405
  onRespond
3941
4406
  }) {
3942
- const [text, setText] = (0, import_react9.useState)("");
4407
+ const [text, setText] = (0, import_react10.useState)("");
3943
4408
  const options = request.options ?? [];
3944
4409
  const showText = request.display === "text" || request.allowFreeform && options.length === 0;
4410
+ if (request.ui) {
4411
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
4412
+ ToolInputCard,
4413
+ {
4414
+ disabled,
4415
+ surface: request.ui,
4416
+ onSubmit: (_, value) => onRespond?.({ requestId: request.requestId, value })
4417
+ }
4418
+ );
4419
+ }
3945
4420
  if (options.length > 0) {
3946
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4421
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3947
4422
  ConfirmationCard,
3948
4423
  {
3949
4424
  disabled,
@@ -3958,17 +4433,17 @@ function HumanInputCard({
3958
4433
  if (!value || disabled) return;
3959
4434
  onRespond?.({ requestId: request.requestId, text: value });
3960
4435
  }
3961
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
4436
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
3962
4437
  "section",
3963
4438
  {
3964
4439
  className: "human-input-card",
3965
4440
  "aria-labelledby": `human-input-${request.requestId}`,
3966
4441
  children: [
3967
- /* @__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 }) }),
3968
- showText ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("form", { onSubmit: submitText, children: [
3969
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("label", { htmlFor: `human-input-text-${request.requestId}`, children: "Response" }),
3970
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
3971
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4442
+ /* @__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 }) }),
4443
+ showText ? /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("form", { onSubmit: submitText, children: [
4444
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("label", { htmlFor: `human-input-text-${request.requestId}`, children: "Response" }),
4445
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
4446
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3972
4447
  "input",
3973
4448
  {
3974
4449
  id: `human-input-text-${request.requestId}`,
@@ -3977,39 +4452,39 @@ function HumanInputCard({
3977
4452
  onChange: (event) => setText(event.target.value)
3978
4453
  }
3979
4454
  ),
3980
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("button", { type: "submit", disabled: disabled || !text.trim(), children: "Send" })
4455
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("button", { type: "submit", disabled: disabled || !text.trim(), children: "Send" })
3981
4456
  ] })
3982
4457
  ] }) : null,
3983
- !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
4458
+ !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
3984
4459
  ]
3985
4460
  }
3986
4461
  );
3987
4462
  }
3988
4463
 
3989
4464
  // src/react/components/CollectionResultCard/CollectionResultCard.tsx
3990
- var import_jsx_runtime8 = require("react/jsx-runtime");
4465
+ var import_jsx_runtime9 = require("react/jsx-runtime");
3991
4466
  function CollectionResultCard({
3992
4467
  result
3993
4468
  }) {
3994
4469
  const empty = result.items.length === 0;
3995
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
4470
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
3996
4471
  "section",
3997
4472
  {
3998
4473
  className: `collection-result-card tool-result-card tool-result-card--${result.status}`,
3999
4474
  "aria-label": result.title,
4000
4475
  children: [
4001
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "tool-result-card__heading", children: [
4002
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4003
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("strong", { children: result.title })
4476
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "tool-result-card__heading", children: [
4477
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4478
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { children: result.title })
4004
4479
  ] }),
4005
- 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: [
4006
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "collection-result-card__item-title", children: item.title }),
4007
- item.description ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { children: item.description }) : null,
4008
- item.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dl", { children: item.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
4009
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dt", { children: detail.label }),
4010
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dd", { children: detail.value })
4480
+ 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: [
4481
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("div", { className: "collection-result-card__item-title", children: item.title }),
4482
+ item.description ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: item.description }) : null,
4483
+ item.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dl", { children: item.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
4484
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dt", { children: detail.label }),
4485
+ /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dd", { children: detail.value })
4011
4486
  ] }, `${detail.label}:${detail.value}`)) }) : null,
4012
- item.href ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
4487
+ item.href ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
4013
4488
  ] }, item.title)) })
4014
4489
  ]
4015
4490
  }
@@ -4017,26 +4492,26 @@ function CollectionResultCard({
4017
4492
  }
4018
4493
 
4019
4494
  // src/react/components/EntityResultCard/EntityResultCard.tsx
4020
- var import_jsx_runtime9 = require("react/jsx-runtime");
4495
+ var import_jsx_runtime10 = require("react/jsx-runtime");
4021
4496
  function EntityResultCard({
4022
4497
  result
4023
4498
  }) {
4024
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
4499
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4025
4500
  "section",
4026
4501
  {
4027
4502
  className: `entity-result-card tool-result-card tool-result-card--${result.status}`,
4028
4503
  "aria-label": result.title,
4029
4504
  children: [
4030
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "tool-result-card__heading", children: [
4031
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4032
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("strong", { children: result.title })
4505
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-result-card__heading", children: [
4506
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4507
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: result.title })
4033
4508
  ] }),
4034
- result.description ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: result.description }) : null,
4035
- result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
4036
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dt", { children: detail.label }),
4037
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dd", { children: detail.value })
4509
+ result.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: result.description }) : null,
4510
+ result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { children: [
4511
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("dt", { children: detail.label }),
4512
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("dd", { children: detail.value })
4038
4513
  ] }, `${detail.label}:${detail.value}`)) }) : null,
4039
- 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)(
4514
+ 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)(
4040
4515
  "a",
4041
4516
  {
4042
4517
  href: link.href,
@@ -4052,24 +4527,24 @@ function EntityResultCard({
4052
4527
  }
4053
4528
 
4054
4529
  // src/react/components/SignatureResultCard/SignatureResultCard.tsx
4055
- var import_jsx_runtime10 = require("react/jsx-runtime");
4530
+ var import_jsx_runtime11 = require("react/jsx-runtime");
4056
4531
  function SignatureResultCard({
4057
4532
  result
4058
4533
  }) {
4059
4534
  const primaryLink = result.links?.[0];
4060
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4535
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4061
4536
  "section",
4062
4537
  {
4063
4538
  className: `signature-result-card tool-result-card tool-result-card--${result.status}`,
4064
4539
  "aria-label": result.title,
4065
4540
  children: [
4066
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-result-card__heading", children: [
4067
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4068
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("strong", { children: result.title })
4541
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "tool-result-card__heading", children: [
4542
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4543
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { children: result.title })
4069
4544
  ] }),
4070
- result.statusLabel ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
4071
- result.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: result.description }) : null,
4072
- primaryLink ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
4545
+ result.statusLabel ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
4546
+ result.description ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: result.description }) : null,
4547
+ primaryLink ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
4073
4548
  "a",
4074
4549
  {
4075
4550
  className: "signature-result-card__cta",
@@ -4085,26 +4560,26 @@ function SignatureResultCard({
4085
4560
  }
4086
4561
 
4087
4562
  // src/react/components/ToolResultCard/ToolResultCard.tsx
4088
- var import_jsx_runtime11 = require("react/jsx-runtime");
4563
+ var import_jsx_runtime12 = require("react/jsx-runtime");
4089
4564
  function ToolResultCard({
4090
4565
  result
4091
4566
  }) {
4092
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4567
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4093
4568
  "section",
4094
4569
  {
4095
4570
  className: `tool-result-card tool-result-card--${result.status}`,
4096
4571
  "aria-label": result.title,
4097
4572
  children: [
4098
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "tool-result-card__heading", children: [
4099
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4100
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("strong", { children: result.title })
4573
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { className: "tool-result-card__heading", children: [
4574
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4575
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("strong", { children: result.title })
4101
4576
  ] }),
4102
- result.description ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: result.description }) : null,
4103
- result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
4104
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dt", { children: detail.label }),
4105
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dd", { children: detail.value })
4577
+ result.description ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("p", { children: result.description }) : null,
4578
+ result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)("div", { children: [
4579
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dt", { children: detail.label }),
4580
+ /* @__PURE__ */ (0, import_jsx_runtime12.jsx)("dd", { children: detail.value })
4106
4581
  ] }, `${detail.label}:${detail.value}`)) }) : null,
4107
- 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)(
4582
+ 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)(
4108
4583
  "a",
4109
4584
  {
4110
4585
  href: link.href,
@@ -4120,32 +4595,44 @@ function ToolResultCard({
4120
4595
  }
4121
4596
 
4122
4597
  // src/react/components/VisitorToolResultView/VisitorToolResultView.tsx
4123
- var import_jsx_runtime12 = require("react/jsx-runtime");
4598
+ var import_jsx_runtime13 = require("react/jsx-runtime");
4124
4599
  function VisitorToolResultView({
4600
+ disabled = false,
4601
+ onToolInput,
4125
4602
  result
4126
4603
  }) {
4604
+ if (result.kind === "input") {
4605
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4606
+ ToolInputCard,
4607
+ {
4608
+ disabled,
4609
+ surface: result.surface,
4610
+ onSubmit: onToolInput
4611
+ }
4612
+ );
4613
+ }
4127
4614
  if (result.kind === "entity") {
4128
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(EntityResultCard, { result });
4615
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EntityResultCard, { result });
4129
4616
  }
4130
4617
  if (result.kind === "collection") {
4131
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CollectionResultCard, { result });
4618
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CollectionResultCard, { result });
4132
4619
  }
4133
4620
  if (result.kind === "signature") {
4134
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SignatureResultCard, { result });
4621
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SignatureResultCard, { result });
4135
4622
  }
4136
4623
  if (result.kind === "summary") {
4137
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ToolResultCard, { result });
4624
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolResultCard, { result });
4138
4625
  }
4139
4626
  return null;
4140
4627
  }
4141
4628
  function isRenderableVisitorToolResult(result) {
4142
- return result.kind === "summary" || result.kind === "entity" || result.kind === "collection" || result.kind === "signature";
4629
+ return result.kind === "summary" || result.kind === "input" || result.kind === "entity" || result.kind === "collection" || result.kind === "signature";
4143
4630
  }
4144
4631
 
4145
4632
  // src/react/components/AgentRail/AgentRail.tsx
4146
- var import_jsx_runtime13 = require("react/jsx-runtime");
4633
+ var import_jsx_runtime14 = require("react/jsx-runtime");
4147
4634
  function MinimizeIcon() {
4148
- 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)(
4635
+ 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)(
4149
4636
  "path",
4150
4637
  {
4151
4638
  d: "M3.5 8h9",
@@ -4156,7 +4643,7 @@ function MinimizeIcon() {
4156
4643
  ) });
4157
4644
  }
4158
4645
  function CloseIcon() {
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)(
4646
+ 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
4647
  "path",
4161
4648
  {
4162
4649
  d: "M4 4l8 8M12 4l-8 8",
@@ -4167,7 +4654,7 @@ function CloseIcon() {
4167
4654
  ) });
4168
4655
  }
4169
4656
  function NewChatIcon() {
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)(
4657
+ 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
4658
  "path",
4172
4659
  {
4173
4660
  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",
@@ -4179,7 +4666,7 @@ function NewChatIcon() {
4179
4666
  ) });
4180
4667
  }
4181
4668
  function ExpandIcon() {
4182
- 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)(
4669
+ 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)(
4183
4670
  "path",
4184
4671
  {
4185
4672
  d: "M6 3.5H3.5V6M10 3.5h2.5V6M10 12.5h2.5V10M6 12.5H3.5V10",
@@ -4191,7 +4678,7 @@ function ExpandIcon() {
4191
4678
  ) });
4192
4679
  }
4193
4680
  function RestoreIcon() {
4194
- 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)(
4681
+ 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)(
4195
4682
  "path",
4196
4683
  {
4197
4684
  d: "M5.5 5.5H3.5V7.5M10.5 5.5h2V7.5M10.5 10.5h2V8.5M5.5 10.5H3.5V8.5",
@@ -4220,12 +4707,13 @@ function AgentRail({
4220
4707
  onSubmit,
4221
4708
  onFollowUpSelect,
4222
4709
  onBook,
4223
- onInputResponse
4710
+ onInputResponse,
4711
+ onToolInput
4224
4712
  }) {
4225
- const transcriptRef = (0, import_react10.useRef)(null);
4713
+ const transcriptRef = (0, import_react11.useRef)(null);
4226
4714
  const resolvedBrandLabel = brandLabel.trim();
4227
4715
  const resolvedBrandLogoUrl = brandLogoUrl?.trim();
4228
- const [failedLogoUrl, setFailedLogoUrl] = (0, import_react10.useState)(null);
4716
+ const [failedLogoUrl, setFailedLogoUrl] = (0, import_react11.useState)(null);
4229
4717
  const showBrandLogo = Boolean(resolvedBrandLogoUrl) && failedLogoUrl !== resolvedBrandLogoUrl;
4230
4718
  const resolvedColorScheme = useAgentColorScheme(colorScheme);
4231
4719
  const brandedTheme = { ...defaultAgentRailTheme, ...theme };
@@ -4236,6 +4724,7 @@ function AgentRail({
4236
4724
  brandSoft: theme?.brandSoft ?? `color-mix(in srgb, ${theme?.brand ?? defaultDarkAgentRailTheme.brand} 18%, ${defaultDarkAgentRailTheme.surface})`,
4237
4725
  border: theme?.border ?? defaultDarkAgentRailTheme.border,
4238
4726
  danger: theme?.danger ?? defaultDarkAgentRailTheme.danger,
4727
+ onBrand: theme?.onBrand ?? defaultDarkAgentRailTheme.onBrand,
4239
4728
  success: theme?.success ?? defaultDarkAgentRailTheme.success,
4240
4729
  surface: theme?.surface ?? defaultDarkAgentRailTheme.surface,
4241
4730
  surfaceMuted: theme?.surfaceMuted ?? defaultDarkAgentRailTheme.surfaceMuted,
@@ -4258,6 +4747,7 @@ function AgentRail({
4258
4747
  "--as-border": resolvedTheme.border,
4259
4748
  "--as-visitor-bubble": resolvedTheme.visitorBubble,
4260
4749
  "--as-visitor-text": resolvedTheme.visitorText,
4750
+ "--as-on-brand": resolvedTheme.onBrand,
4261
4751
  "--as-success": resolvedTheme.success,
4262
4752
  "--as-danger": resolvedTheme.danger,
4263
4753
  "--as-font-body": resolvedTheme.fontBody,
@@ -4269,10 +4759,12 @@ function AgentRail({
4269
4759
  );
4270
4760
  const isBusy = state.phase === "thinking" || state.phase === "running-tools" || state.phase === "streaming" || state.phase === "waiting-input" && pendingInputRequests.length > 0;
4271
4761
  const semanticSurfaceDisabled = isBusy && state.phase !== "waiting-input";
4272
- const showActivity = state.toolSteps.length > 0;
4273
4762
  const visitorToolResults = (state.toolResults ?? []).filter(
4274
4763
  isRenderableVisitorToolResult
4275
4764
  );
4765
+ const activeVisitorToolInput = [...visitorToolResults].reverse().find((result) => result.kind === "input");
4766
+ const visibleVisitorToolResults = activeVisitorToolInput ? [activeVisitorToolInput] : visitorToolResults;
4767
+ const showActivity = state.toolSteps.length > 0 && visibleVisitorToolResults.length === 0 && pendingInputRequests.length === 0 && !state.pendingOffer;
4276
4768
  const hasVisitorMessages2 = state.messages.some(
4277
4769
  (message) => message.role === "visitor"
4278
4770
  );
@@ -4313,13 +4805,17 @@ function AgentRail({
4313
4805
  const bookingReadyText = state.streamingText || (lastIsAgent && lastMessage?.role === "agent" ? lastMessage.text : "");
4314
4806
  const waitingForBooking = !state.pendingOffer && looksLikeBookingReady(bookingReadyText) && (state.phase === "thinking" || state.phase === "running-tools" || state.phase === "streaming");
4315
4807
  const lastAgentText = lastIsAgent && lastMessage?.role === "agent" ? lastMessage.text : "";
4808
+ const hasPendingConfirmation = pendingInputRequests.some(
4809
+ (request) => request.kind === "tool-approval" || request.kind === "question" && (request.options?.length ?? 0) > 0
4810
+ );
4316
4811
  const composerForm = resolveComposerForm({
4317
4812
  agentText: lastAgentText,
4318
4813
  cards: extractToolCards(lastAgentText),
4319
4814
  hasBookingOffer: Boolean(state.pendingOffer) || waitingForBooking,
4815
+ hasPendingConfirmation,
4320
4816
  enabled: lastIsAgent && !isBusy
4321
4817
  });
4322
- (0, import_react10.useEffect)(() => {
4818
+ (0, import_react11.useEffect)(() => {
4323
4819
  const node = transcriptRef.current;
4324
4820
  if (!node) return;
4325
4821
  node.scrollTop = node.scrollHeight;
@@ -4330,7 +4826,7 @@ function AgentRail({
4330
4826
  state.followUps,
4331
4827
  state.journey
4332
4828
  ]);
4333
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4829
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
4334
4830
  "aside",
4335
4831
  {
4336
4832
  className: `agent-rail not-typeset${mobileFullscreen ? " agent-rail--mobile-fullscreen" : ""}${expanded ? " agent-rail--expanded" : ""}`,
@@ -4344,28 +4840,28 @@ function AgentRail({
4344
4840
  role: mobileFullscreen || expanded ? "dialog" : void 0,
4345
4841
  tabIndex: mobileFullscreen || expanded ? -1 : void 0,
4346
4842
  children: [
4347
- /* @__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: [
4348
- onCollapse ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4843
+ /* @__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: [
4844
+ onCollapse ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4349
4845
  "button",
4350
4846
  {
4351
4847
  type: "button",
4352
4848
  className: "agent-rail__collapse",
4353
4849
  "aria-label": "Collapse assist",
4354
4850
  onClick: onCollapse,
4355
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MinimizeIcon, {})
4851
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MinimizeIcon, {})
4356
4852
  }
4357
- ) : onClose ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4853
+ ) : onClose ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4358
4854
  "button",
4359
4855
  {
4360
4856
  type: "button",
4361
4857
  className: "agent-rail__close",
4362
4858
  "aria-label": "Close agent",
4363
4859
  onClick: onClose,
4364
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CloseIcon, {})
4860
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CloseIcon, {})
4365
4861
  }
4366
- ) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
4367
- resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "agent-rail__identity", children: [
4368
- showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "agent-rail__brand-mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4862
+ ) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
4863
+ resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "agent-rail__identity", children: [
4864
+ showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "agent-rail__brand-mark", "aria-hidden": "true", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4369
4865
  "img",
4370
4866
  {
4371
4867
  className: "agent-rail__brand-logo",
@@ -4376,10 +4872,10 @@ function AgentRail({
4376
4872
  }
4377
4873
  }
4378
4874
  ) }) : null,
4379
- resolvedBrandLabel ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
4875
+ resolvedBrandLabel ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
4380
4876
  ] }) : null,
4381
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "agent-rail__actions", children: [
4382
- onReset ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4877
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "agent-rail__actions", children: [
4878
+ onReset ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4383
4879
  "button",
4384
4880
  {
4385
4881
  type: "button",
@@ -4387,24 +4883,24 @@ function AgentRail({
4387
4883
  "aria-label": "Start a new conversation",
4388
4884
  disabled: !hasVisitorMessages2,
4389
4885
  onClick: onReset,
4390
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(NewChatIcon, {})
4886
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(NewChatIcon, {})
4391
4887
  }
4392
4888
  ) : null,
4393
- onExpandToggle ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4889
+ onExpandToggle ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4394
4890
  "button",
4395
4891
  {
4396
4892
  type: "button",
4397
4893
  className: "agent-rail__expand",
4398
4894
  "aria-label": expanded ? "Exit full screen" : "Open full screen",
4399
4895
  onClick: onExpandToggle,
4400
- children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(RestoreIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ExpandIcon, {})
4896
+ children: expanded ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(RestoreIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ExpandIcon, {})
4401
4897
  }
4402
4898
  ) : null
4403
4899
  ] })
4404
4900
  ] }) }),
4405
- /* @__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: [
4406
- !hasVisitorMessages2 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
4407
- greeting?.role === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4901
+ /* @__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: [
4902
+ !hasVisitorMessages2 ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
4903
+ greeting?.role === "agent" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4408
4904
  MessageBubble,
4409
4905
  {
4410
4906
  message: greeting,
@@ -4412,7 +4908,7 @@ function AgentRail({
4412
4908
  onBook
4413
4909
  }
4414
4910
  ) : null,
4415
- showIdleFollowUps ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4911
+ showIdleFollowUps ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4416
4912
  FollowUpChips,
4417
4913
  {
4418
4914
  suggestions: state.followUps,
@@ -4421,7 +4917,7 @@ function AgentRail({
4421
4917
  onSelect: (suggestion) => onFollowUpSelect?.(suggestion.label)
4422
4918
  }
4423
4919
  ) }) : null,
4424
- showActivity ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4920
+ showActivity ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4425
4921
  AgentActivityBubble,
4426
4922
  {
4427
4923
  brandLabel: resolvedBrandLabel,
@@ -4430,8 +4926,16 @@ function AgentRail({
4430
4926
  steps: state.toolSteps
4431
4927
  }
4432
4928
  ) : null,
4433
- visitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(VisitorToolResultView, { result }, result.id)),
4434
- pendingInputRequests.map((request) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4929
+ visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4930
+ VisitorToolResultView,
4931
+ {
4932
+ result,
4933
+ disabled: semanticSurfaceDisabled,
4934
+ onToolInput
4935
+ },
4936
+ result.id
4937
+ )),
4938
+ pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4435
4939
  HumanInputCard,
4436
4940
  {
4437
4941
  request,
@@ -4440,8 +4944,8 @@ function AgentRail({
4440
4944
  request.requestId
4441
4945
  ))
4442
4946
  ] }) : null,
4443
- visibleMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "agent-rail__turn-block", children: [
4444
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4947
+ visibleMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "agent-rail__turn-block", children: [
4948
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4445
4949
  MessageBubble,
4446
4950
  {
4447
4951
  message,
@@ -4450,8 +4954,8 @@ function AgentRail({
4450
4954
  onBook
4451
4955
  }
4452
4956
  ),
4453
- index === lastVisitorIndex ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
4454
- showActivity ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4957
+ index === lastVisitorIndex ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
4958
+ showActivity ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4455
4959
  AgentActivityBubble,
4456
4960
  {
4457
4961
  brandLabel: resolvedBrandLabel,
@@ -4460,8 +4964,16 @@ function AgentRail({
4460
4964
  steps: state.toolSteps
4461
4965
  }
4462
4966
  ) : null,
4463
- visitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(VisitorToolResultView, { result }, result.id)),
4464
- pendingInputRequests.map((request) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4967
+ visibleVisitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4968
+ VisitorToolResultView,
4969
+ {
4970
+ result,
4971
+ disabled: semanticSurfaceDisabled,
4972
+ onToolInput
4973
+ },
4974
+ result.id
4975
+ )),
4976
+ pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4465
4977
  HumanInputCard,
4466
4978
  {
4467
4979
  request,
@@ -4471,7 +4983,7 @@ function AgentRail({
4471
4983
  ))
4472
4984
  ] }) : null
4473
4985
  ] }, message.id)),
4474
- streamingMessage ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4986
+ streamingMessage ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4475
4987
  MessageBubble,
4476
4988
  {
4477
4989
  message: streamingMessage,
@@ -4480,22 +4992,17 @@ function AgentRail({
4480
4992
  onBook
4481
4993
  }
4482
4994
  ) : null,
4483
- waitingForBooking ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4484
- BookingCard,
4485
- {
4486
- offer: { type: "booking_offer", eventTypes: [], slots: [] }
4487
- }
4488
- ) : null,
4489
- state.error ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: "agent-rail__error", role: "alert", children: [
4490
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { children: [
4491
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: "Something went wrong" }),
4492
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("p", { children: state.error })
4995
+ waitingForBooking ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(BookingCardLoader, {}) : null,
4996
+ state.error ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("section", { className: "agent-rail__error", role: "alert", children: [
4997
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { children: [
4998
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("strong", { children: "Something went wrong" }),
4999
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("p", { children: state.error })
4493
5000
  ] }),
4494
- onRetry ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
5001
+ onRetry ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
4495
5002
  ] }) : null
4496
5003
  ] }) }),
4497
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "agent-rail__composer-wrap", children: [
4498
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
5004
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("div", { className: "agent-rail__composer-wrap", children: [
5005
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4499
5006
  Composer,
4500
5007
  {
4501
5008
  variant: expanded || mobileFullscreen ? "dock" : "default",
@@ -4505,9 +5012,9 @@ function AgentRail({
4505
5012
  onSubmit
4506
5013
  }
4507
5014
  ),
4508
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "agent-rail__footer", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { children: [
4509
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "AI can make mistakes. Check important info." }),
4510
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: poweredByLabel })
5015
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "agent-rail__footer", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("p", { children: [
5016
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: "AI can make mistakes. Check important info." }),
5017
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { children: poweredByLabel })
4511
5018
  ] }) })
4512
5019
  ] })
4513
5020
  ]
@@ -4516,9 +5023,9 @@ function AgentRail({
4516
5023
  }
4517
5024
 
4518
5025
  // src/react/components/AssistEdgeTab/AssistEdgeTab.tsx
4519
- var import_jsx_runtime14 = require("react/jsx-runtime");
5026
+ var import_jsx_runtime15 = require("react/jsx-runtime");
4520
5027
  function SparklesIcon() {
4521
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
5028
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
4522
5029
  "svg",
4523
5030
  {
4524
5031
  className: "assist-edge-tab__sparkles",
@@ -4526,21 +5033,21 @@ function SparklesIcon() {
4526
5033
  fill: "none",
4527
5034
  "aria-hidden": "true",
4528
5035
  children: [
4529
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5036
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4530
5037
  "path",
4531
5038
  {
4532
5039
  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",
4533
5040
  fill: "currentColor"
4534
5041
  }
4535
5042
  ),
4536
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5043
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4537
5044
  "path",
4538
5045
  {
4539
5046
  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",
4540
5047
  fill: "currentColor"
4541
5048
  }
4542
5049
  ),
4543
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5050
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4544
5051
  "path",
4545
5052
  {
4546
5053
  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",
@@ -4554,7 +5061,7 @@ function SparklesIcon() {
4554
5061
  function TabMarkIcon({ customIconUrl }) {
4555
5062
  const url = customIconUrl?.trim();
4556
5063
  if (url) {
4557
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5064
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4558
5065
  "img",
4559
5066
  {
4560
5067
  alt: "",
@@ -4564,10 +5071,10 @@ function TabMarkIcon({ customIconUrl }) {
4564
5071
  }
4565
5072
  );
4566
5073
  }
4567
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SparklesIcon, {});
5074
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SparklesIcon, {});
4568
5075
  }
4569
5076
  function ChevronLeftIcon() {
4570
- 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)(
5077
+ 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)(
4571
5078
  "path",
4572
5079
  {
4573
5080
  d: "M10 4L6 8l4 4",
@@ -4579,7 +5086,7 @@ function ChevronLeftIcon() {
4579
5086
  ) });
4580
5087
  }
4581
5088
  function ChevronDownIcon() {
4582
- 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)(
5089
+ 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)(
4583
5090
  "path",
4584
5091
  {
4585
5092
  d: "M4 6l4 4 4-4",
@@ -4591,7 +5098,7 @@ function ChevronDownIcon() {
4591
5098
  ) });
4592
5099
  }
4593
5100
  function DragDots() {
4594
- 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)) });
5101
+ 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)) });
4595
5102
  }
4596
5103
  var VARIANT_COPY = {
4597
5104
  outline: { label: "Ask anything", aria: "Ask anything" },
@@ -4637,7 +5144,7 @@ function AssistEdgeTab({
4637
5144
  ...resolvedTextColor ? { "--as-text": resolvedTextColor } : {},
4638
5145
  colorScheme: resolvedColorScheme
4639
5146
  };
4640
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
5147
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
4641
5148
  "button",
4642
5149
  {
4643
5150
  type: "button",
@@ -4649,15 +5156,15 @@ function AssistEdgeTab({
4649
5156
  tabIndex: visible ? 0 : -1,
4650
5157
  onClick: onOpen,
4651
5158
  children: [
4652
- mobile ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
4653
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
5159
+ mobile ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
5160
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
4654
5161
  "span",
4655
5162
  {
4656
5163
  className: "assist-edge-tab__mark assist-edge-tab__mark--mobile",
4657
5164
  "aria-hidden": "true",
4658
5165
  children: [
4659
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TabMarkIcon, { customIconUrl }),
4660
- showLogo ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5166
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TabMarkIcon, { customIconUrl }),
5167
+ showLogo ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4661
5168
  "img",
4662
5169
  {
4663
5170
  className: "assist-edge-tab__logo",
@@ -4671,11 +5178,11 @@ function AssistEdgeTab({
4671
5178
  ]
4672
5179
  }
4673
5180
  ),
4674
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel })
4675
- ] }) : variant === "outline" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
4676
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
4677
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TabMarkIcon, { customIconUrl }),
4678
- showLogo ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5181
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel })
5182
+ ] }) : variant === "outline" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
5183
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
5184
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TabMarkIcon, { customIconUrl }),
5185
+ showLogo ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4679
5186
  "img",
4680
5187
  {
4681
5188
  className: "assist-edge-tab__logo",
@@ -4687,18 +5194,18 @@ function AssistEdgeTab({
4687
5194
  }
4688
5195
  ) : null
4689
5196
  ] }),
4690
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
4691
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ChevronDownIcon, {})
5197
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
5198
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronDownIcon, {})
4692
5199
  ] }) : null,
4693
- variant === "ask" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
4694
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ChevronLeftIcon, {}),
4695
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
4696
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(DragDots, {})
5200
+ variant === "ask" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
5201
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronLeftIcon, {}),
5202
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
5203
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(DragDots, {})
4697
5204
  ] }) : null,
4698
- variant === "fill" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
4699
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
4700
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TabMarkIcon, { customIconUrl }),
4701
- showLogo ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5205
+ variant === "fill" ? /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(import_jsx_runtime15.Fragment, { children: [
5206
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
5207
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TabMarkIcon, { customIconUrl }),
5208
+ showLogo ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4702
5209
  "img",
4703
5210
  {
4704
5211
  className: "assist-edge-tab__logo",
@@ -4710,8 +5217,8 @@ function AssistEdgeTab({
4710
5217
  }
4711
5218
  ) : null
4712
5219
  ] }),
4713
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
4714
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ChevronLeftIcon, {})
5220
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
5221
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ChevronLeftIcon, {})
4715
5222
  ] }) : null
4716
5223
  ]
4717
5224
  }
@@ -4719,7 +5226,7 @@ function AssistEdgeTab({
4719
5226
  }
4720
5227
 
4721
5228
  // src/react/components/AgentWidget/AgentWidget.tsx
4722
- var import_jsx_runtime15 = require("react/jsx-runtime");
5229
+ var import_jsx_runtime16 = require("react/jsx-runtime");
4723
5230
  function AgentWidget({
4724
5231
  indexId,
4725
5232
  customerId,
@@ -4737,9 +5244,9 @@ function AgentWidget({
4737
5244
  }) {
4738
5245
  const isMobile = useIsMobile();
4739
5246
  const placement = normalizeAgentPlacement(placementInput);
4740
- const railSlotRef = (0, import_react11.useRef)(null);
4741
- const [railCollapsed, setRailCollapsed] = (0, import_react11.useState)(defaultCollapsed);
4742
- const [railExpanded, setRailExpanded] = (0, import_react11.useState)(false);
5247
+ const railSlotRef = (0, import_react12.useRef)(null);
5248
+ const [railCollapsed, setRailCollapsed] = (0, import_react12.useState)(defaultCollapsed);
5249
+ const [railExpanded, setRailExpanded] = (0, import_react12.useState)(false);
4743
5250
  const pageShiftActive = shouldApplyPageShift({
4744
5251
  pageShift,
4745
5252
  isMobile,
@@ -4769,7 +5276,10 @@ function AgentWidget({
4769
5276
  visitorBubble: branding.colors.primary
4770
5277
  } : {},
4771
5278
  ...branding?.colors?.primarySoft ? { brandSoft: branding.colors.primarySoft } : {},
4772
- ...branding?.colors?.primaryForeground ? { visitorText: branding.colors.primaryForeground } : {},
5279
+ ...branding?.colors?.primaryForeground ? {
5280
+ onBrand: branding.colors.primaryForeground,
5281
+ visitorText: branding.colors.primaryForeground
5282
+ } : {},
4773
5283
  ...branding?.colors?.surface ? { surface: branding.colors.surface } : {},
4774
5284
  ...branding?.colors?.surfaceMuted ? { surfaceMuted: branding.colors.surfaceMuted } : {},
4775
5285
  ...branding?.colors?.text ? { text: branding.colors.text } : {},
@@ -4779,7 +5289,7 @@ function AgentWidget({
4779
5289
  } : {},
4780
5290
  ...branding?.colors?.border ? { border: branding.colors.border } : {}
4781
5291
  };
4782
- (0, import_react11.useEffect)(() => {
5292
+ (0, import_react12.useEffect)(() => {
4783
5293
  if (!registerPanelController) return;
4784
5294
  registerAgentPanelController(customerId, {
4785
5295
  open: () => setRailCollapsed(false),
@@ -4796,7 +5306,7 @@ function AgentWidget({
4796
5306
  if (isMobile) setRailCollapsed(false);
4797
5307
  await submit(message);
4798
5308
  }
4799
- (0, import_react11.useEffect)(() => {
5309
+ (0, import_react12.useEffect)(() => {
4800
5310
  if (railCollapsed) return;
4801
5311
  const handleKeyDown = (event) => {
4802
5312
  if (event.key === "Tab" && (isMobile || railExpanded)) {
@@ -4830,19 +5340,19 @@ function AgentWidget({
4830
5340
  window.addEventListener("keydown", handleKeyDown);
4831
5341
  return () => window.removeEventListener("keydown", handleKeyDown);
4832
5342
  }, [isMobile, railCollapsed, railExpanded]);
4833
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "webless-agent-root", children: [
4834
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5343
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("div", { className: "webless-agent-root", children: [
5344
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4835
5345
  "div",
4836
5346
  {
4837
5347
  className: `webless-agent-root__shell${railCollapsed ? " webless-agent-root__shell--collapsed" : ""}${railExpanded ? " webless-agent-root__shell--expanded" : ""}`,
4838
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5348
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4839
5349
  "div",
4840
5350
  {
4841
5351
  ref: railSlotRef,
4842
5352
  className: "webless-agent-root__rail-slot",
4843
5353
  inert: railCollapsed || void 0,
4844
5354
  "aria-hidden": railCollapsed,
4845
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5355
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4846
5356
  AgentRail,
4847
5357
  {
4848
5358
  theme,
@@ -4870,7 +5380,7 @@ function AgentWidget({
4870
5380
  )
4871
5381
  }
4872
5382
  ),
4873
- railCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5383
+ railCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4874
5384
  AssistEdgeTab,
4875
5385
  {
4876
5386
  variant: placement.variant,
@@ -4896,6 +5406,8 @@ function AgentWidget({
4896
5406
  }
4897
5407
  // Annotate the CommonJS export names for ESM import in node:
4898
5408
  0 && (module.exports = {
5409
+ AGENT_STRUCTURED_TOOL_INPUT_HEADER,
5410
+ AGENT_STRUCTURED_TOOL_INPUT_SCHEMA_VERSION,
4899
5411
  AgentRail,
4900
5412
  AgentWidget,
4901
5413
  AssistEdgeTab,
@@ -4904,6 +5416,7 @@ function AgentWidget({
4904
5416
  createIdleSuggestions,
4905
5417
  defaultAgentRailTheme,
4906
5418
  defaultDarkAgentRailTheme,
5419
+ formatAgentStructuredToolInput,
4907
5420
  hasVisitorMessages,
4908
5421
  isAgentBusy,
4909
5422
  normalizeAgentPlacement,