@webless/agent 0.6.5 → 0.6.7

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
  }
@@ -1508,7 +1546,7 @@ function formatBookingOfferFence(offer) {
1508
1546
  }
1509
1547
  function bookingCardFromActionOutput(output) {
1510
1548
  const record = asRecord2(output);
1511
- const data = asRecord2(record?.data) ?? record;
1549
+ const data = asRecord2(record?.output) ?? asRecord2(record?.data) ?? record;
1512
1550
  return parseToolCard(data);
1513
1551
  }
1514
1552
  function ensureBookingOfferText(text, offer) {
@@ -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
  };
@@ -3480,6 +3520,9 @@ function calendarCells(year, month) {
3480
3520
  while (cells.length < 42) cells.push(null);
3481
3521
  return cells;
3482
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
+ }
3483
3526
  function BookingCard({
3484
3527
  offer,
3485
3528
  onBook
@@ -3899,7 +3942,7 @@ function MessageBubble({
3899
3942
  }
3900
3943
 
3901
3944
  // src/react/components/HumanInputCard/HumanInputCard.tsx
3902
- var import_react9 = require("react");
3945
+ var import_react10 = require("react");
3903
3946
 
3904
3947
  // src/react/components/ConfirmationCard/ConfirmationCard.tsx
3905
3948
  var import_jsx_runtime6 = require("react/jsx-runtime");
@@ -3940,18 +3983,450 @@ function ConfirmationCard({
3940
3983
  );
3941
3984
  }
3942
3985
 
3943
- // src/react/components/HumanInputCard/HumanInputCard.tsx
3986
+ // src/react/components/ToolInputCard/ToolInputCard.tsx
3987
+ var import_react9 = require("react");
3944
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");
3945
4410
  function HumanInputCard({
3946
4411
  disabled = false,
3947
4412
  request,
3948
4413
  onRespond
3949
4414
  }) {
3950
- const [text, setText] = (0, import_react9.useState)("");
4415
+ const [text, setText] = (0, import_react10.useState)("");
3951
4416
  const options = request.options ?? [];
3952
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
+ }
3953
4428
  if (options.length > 0) {
3954
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
4429
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
3955
4430
  ConfirmationCard,
3956
4431
  {
3957
4432
  disabled,
@@ -3966,17 +4441,17 @@ function HumanInputCard({
3966
4441
  if (!value || disabled) return;
3967
4442
  onRespond?.({ requestId: request.requestId, text: value });
3968
4443
  }
3969
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
4444
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
3970
4445
  "section",
3971
4446
  {
3972
4447
  className: "human-input-card",
3973
4448
  "aria-labelledby": `human-input-${request.requestId}`,
3974
4449
  children: [
3975
- /* @__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 }) }),
3976
- showText ? /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("form", { onSubmit: submitText, children: [
3977
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("label", { htmlFor: `human-input-text-${request.requestId}`, children: "Response" }),
3978
- /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { children: [
3979
- /* @__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)(
3980
4455
  "input",
3981
4456
  {
3982
4457
  id: `human-input-text-${request.requestId}`,
@@ -3985,39 +4460,39 @@ function HumanInputCard({
3985
4460
  onChange: (event) => setText(event.target.value)
3986
4461
  }
3987
4462
  ),
3988
- /* @__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" })
3989
4464
  ] })
3990
4465
  ] }) : null,
3991
- !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
3992
4467
  ]
3993
4468
  }
3994
4469
  );
3995
4470
  }
3996
4471
 
3997
4472
  // src/react/components/CollectionResultCard/CollectionResultCard.tsx
3998
- var import_jsx_runtime8 = require("react/jsx-runtime");
4473
+ var import_jsx_runtime9 = require("react/jsx-runtime");
3999
4474
  function CollectionResultCard({
4000
4475
  result
4001
4476
  }) {
4002
4477
  const empty = result.items.length === 0;
4003
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
4478
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
4004
4479
  "section",
4005
4480
  {
4006
4481
  className: `collection-result-card tool-result-card tool-result-card--${result.status}`,
4007
4482
  "aria-label": result.title,
4008
4483
  children: [
4009
- /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { className: "tool-result-card__heading", children: [
4010
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4011
- /* @__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 })
4012
4487
  ] }),
4013
- 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: [
4014
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { className: "collection-result-card__item-title", children: item.title }),
4015
- item.description ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("p", { children: item.description }) : null,
4016
- item.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dl", { children: item.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)("div", { children: [
4017
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("dt", { children: detail.label }),
4018
- /* @__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 })
4019
4494
  ] }, `${detail.label}:${detail.value}`)) }) : null,
4020
- 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
4021
4496
  ] }, item.title)) })
4022
4497
  ]
4023
4498
  }
@@ -4025,26 +4500,26 @@ function CollectionResultCard({
4025
4500
  }
4026
4501
 
4027
4502
  // src/react/components/EntityResultCard/EntityResultCard.tsx
4028
- var import_jsx_runtime9 = require("react/jsx-runtime");
4503
+ var import_jsx_runtime10 = require("react/jsx-runtime");
4029
4504
  function EntityResultCard({
4030
4505
  result
4031
4506
  }) {
4032
- return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
4507
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4033
4508
  "section",
4034
4509
  {
4035
4510
  className: `entity-result-card tool-result-card tool-result-card--${result.status}`,
4036
4511
  "aria-label": result.title,
4037
4512
  children: [
4038
- /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { className: "tool-result-card__heading", children: [
4039
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4040
- /* @__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 })
4041
4516
  ] }),
4042
- result.description ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("p", { children: result.description }) : null,
4043
- result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)("div", { children: [
4044
- /* @__PURE__ */ (0, import_jsx_runtime9.jsx)("dt", { children: detail.label }),
4045
- /* @__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 })
4046
4521
  ] }, `${detail.label}:${detail.value}`)) }) : null,
4047
- 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)(
4048
4523
  "a",
4049
4524
  {
4050
4525
  href: link.href,
@@ -4060,24 +4535,24 @@ function EntityResultCard({
4060
4535
  }
4061
4536
 
4062
4537
  // src/react/components/SignatureResultCard/SignatureResultCard.tsx
4063
- var import_jsx_runtime10 = require("react/jsx-runtime");
4538
+ var import_jsx_runtime11 = require("react/jsx-runtime");
4064
4539
  function SignatureResultCard({
4065
4540
  result
4066
4541
  }) {
4067
4542
  const primaryLink = result.links?.[0];
4068
- return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(
4543
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4069
4544
  "section",
4070
4545
  {
4071
4546
  className: `signature-result-card tool-result-card tool-result-card--${result.status}`,
4072
4547
  "aria-label": result.title,
4073
4548
  children: [
4074
- /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "tool-result-card__heading", children: [
4075
- /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4076
- /* @__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 })
4077
4552
  ] }),
4078
- result.statusLabel ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
4079
- result.description ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("p", { children: result.description }) : null,
4080
- 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)(
4081
4556
  "a",
4082
4557
  {
4083
4558
  className: "signature-result-card__cta",
@@ -4093,26 +4568,26 @@ function SignatureResultCard({
4093
4568
  }
4094
4569
 
4095
4570
  // src/react/components/ToolResultCard/ToolResultCard.tsx
4096
- var import_jsx_runtime11 = require("react/jsx-runtime");
4571
+ var import_jsx_runtime12 = require("react/jsx-runtime");
4097
4572
  function ToolResultCard({
4098
4573
  result
4099
4574
  }) {
4100
- return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
4575
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(
4101
4576
  "section",
4102
4577
  {
4103
4578
  className: `tool-result-card tool-result-card--${result.status}`,
4104
4579
  "aria-label": result.title,
4105
4580
  children: [
4106
- /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "tool-result-card__heading", children: [
4107
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
4108
- /* @__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 })
4109
4584
  ] }),
4110
- result.description ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("p", { children: result.description }) : null,
4111
- result.details?.length ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dl", { children: result.details.map((detail) => /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { children: [
4112
- /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("dt", { children: detail.label }),
4113
- /* @__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 })
4114
4589
  ] }, `${detail.label}:${detail.value}`)) }) : null,
4115
- 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)(
4116
4591
  "a",
4117
4592
  {
4118
4593
  href: link.href,
@@ -4128,32 +4603,44 @@ function ToolResultCard({
4128
4603
  }
4129
4604
 
4130
4605
  // src/react/components/VisitorToolResultView/VisitorToolResultView.tsx
4131
- var import_jsx_runtime12 = require("react/jsx-runtime");
4606
+ var import_jsx_runtime13 = require("react/jsx-runtime");
4132
4607
  function VisitorToolResultView({
4608
+ disabled = false,
4609
+ onToolInput,
4133
4610
  result
4134
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
+ }
4135
4622
  if (result.kind === "entity") {
4136
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(EntityResultCard, { result });
4623
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(EntityResultCard, { result });
4137
4624
  }
4138
4625
  if (result.kind === "collection") {
4139
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(CollectionResultCard, { result });
4626
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CollectionResultCard, { result });
4140
4627
  }
4141
4628
  if (result.kind === "signature") {
4142
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(SignatureResultCard, { result });
4629
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(SignatureResultCard, { result });
4143
4630
  }
4144
4631
  if (result.kind === "summary") {
4145
- return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ToolResultCard, { result });
4632
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(ToolResultCard, { result });
4146
4633
  }
4147
4634
  return null;
4148
4635
  }
4149
4636
  function isRenderableVisitorToolResult(result) {
4150
- 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";
4151
4638
  }
4152
4639
 
4153
4640
  // src/react/components/AgentRail/AgentRail.tsx
4154
- var import_jsx_runtime13 = require("react/jsx-runtime");
4641
+ var import_jsx_runtime14 = require("react/jsx-runtime");
4155
4642
  function MinimizeIcon() {
4156
- 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)(
4157
4644
  "path",
4158
4645
  {
4159
4646
  d: "M3.5 8h9",
@@ -4164,7 +4651,7 @@ function MinimizeIcon() {
4164
4651
  ) });
4165
4652
  }
4166
4653
  function CloseIcon() {
4167
- 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)(
4168
4655
  "path",
4169
4656
  {
4170
4657
  d: "M4 4l8 8M12 4l-8 8",
@@ -4175,7 +4662,7 @@ function CloseIcon() {
4175
4662
  ) });
4176
4663
  }
4177
4664
  function NewChatIcon() {
4178
- 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)(
4179
4666
  "path",
4180
4667
  {
4181
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",
@@ -4187,7 +4674,7 @@ function NewChatIcon() {
4187
4674
  ) });
4188
4675
  }
4189
4676
  function ExpandIcon() {
4190
- 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)(
4191
4678
  "path",
4192
4679
  {
4193
4680
  d: "M6 3.5H3.5V6M10 3.5h2.5V6M10 12.5h2.5V10M6 12.5H3.5V10",
@@ -4199,7 +4686,7 @@ function ExpandIcon() {
4199
4686
  ) });
4200
4687
  }
4201
4688
  function RestoreIcon() {
4202
- 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)(
4203
4690
  "path",
4204
4691
  {
4205
4692
  d: "M5.5 5.5H3.5V7.5M10.5 5.5h2V7.5M10.5 10.5h2V8.5M5.5 10.5H3.5V8.5",
@@ -4228,12 +4715,13 @@ function AgentRail({
4228
4715
  onSubmit,
4229
4716
  onFollowUpSelect,
4230
4717
  onBook,
4231
- onInputResponse
4718
+ onInputResponse,
4719
+ onToolInput
4232
4720
  }) {
4233
- const transcriptRef = (0, import_react10.useRef)(null);
4721
+ const transcriptRef = (0, import_react11.useRef)(null);
4234
4722
  const resolvedBrandLabel = brandLabel.trim();
4235
4723
  const resolvedBrandLogoUrl = brandLogoUrl?.trim();
4236
- const [failedLogoUrl, setFailedLogoUrl] = (0, import_react10.useState)(null);
4724
+ const [failedLogoUrl, setFailedLogoUrl] = (0, import_react11.useState)(null);
4237
4725
  const showBrandLogo = Boolean(resolvedBrandLogoUrl) && failedLogoUrl !== resolvedBrandLogoUrl;
4238
4726
  const resolvedColorScheme = useAgentColorScheme(colorScheme);
4239
4727
  const brandedTheme = { ...defaultAgentRailTheme, ...theme };
@@ -4244,6 +4732,7 @@ function AgentRail({
4244
4732
  brandSoft: theme?.brandSoft ?? `color-mix(in srgb, ${theme?.brand ?? defaultDarkAgentRailTheme.brand} 18%, ${defaultDarkAgentRailTheme.surface})`,
4245
4733
  border: theme?.border ?? defaultDarkAgentRailTheme.border,
4246
4734
  danger: theme?.danger ?? defaultDarkAgentRailTheme.danger,
4735
+ onBrand: theme?.onBrand ?? defaultDarkAgentRailTheme.onBrand,
4247
4736
  success: theme?.success ?? defaultDarkAgentRailTheme.success,
4248
4737
  surface: theme?.surface ?? defaultDarkAgentRailTheme.surface,
4249
4738
  surfaceMuted: theme?.surfaceMuted ?? defaultDarkAgentRailTheme.surfaceMuted,
@@ -4266,6 +4755,7 @@ function AgentRail({
4266
4755
  "--as-border": resolvedTheme.border,
4267
4756
  "--as-visitor-bubble": resolvedTheme.visitorBubble,
4268
4757
  "--as-visitor-text": resolvedTheme.visitorText,
4758
+ "--as-on-brand": resolvedTheme.onBrand,
4269
4759
  "--as-success": resolvedTheme.success,
4270
4760
  "--as-danger": resolvedTheme.danger,
4271
4761
  "--as-font-body": resolvedTheme.fontBody,
@@ -4277,10 +4767,12 @@ function AgentRail({
4277
4767
  );
4278
4768
  const isBusy = state.phase === "thinking" || state.phase === "running-tools" || state.phase === "streaming" || state.phase === "waiting-input" && pendingInputRequests.length > 0;
4279
4769
  const semanticSurfaceDisabled = isBusy && state.phase !== "waiting-input";
4280
- const showActivity = state.toolSteps.length > 0;
4281
4770
  const visitorToolResults = (state.toolResults ?? []).filter(
4282
4771
  isRenderableVisitorToolResult
4283
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;
4284
4776
  const hasVisitorMessages2 = state.messages.some(
4285
4777
  (message) => message.role === "visitor"
4286
4778
  );
@@ -4321,13 +4813,17 @@ function AgentRail({
4321
4813
  const bookingReadyText = state.streamingText || (lastIsAgent && lastMessage?.role === "agent" ? lastMessage.text : "");
4322
4814
  const waitingForBooking = !state.pendingOffer && looksLikeBookingReady(bookingReadyText) && (state.phase === "thinking" || state.phase === "running-tools" || state.phase === "streaming");
4323
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
+ );
4324
4819
  const composerForm = resolveComposerForm({
4325
4820
  agentText: lastAgentText,
4326
4821
  cards: extractToolCards(lastAgentText),
4327
4822
  hasBookingOffer: Boolean(state.pendingOffer) || waitingForBooking,
4823
+ hasPendingConfirmation,
4328
4824
  enabled: lastIsAgent && !isBusy
4329
4825
  });
4330
- (0, import_react10.useEffect)(() => {
4826
+ (0, import_react11.useEffect)(() => {
4331
4827
  const node = transcriptRef.current;
4332
4828
  if (!node) return;
4333
4829
  node.scrollTop = node.scrollHeight;
@@ -4338,7 +4834,7 @@ function AgentRail({
4338
4834
  state.followUps,
4339
4835
  state.journey
4340
4836
  ]);
4341
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
4837
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
4342
4838
  "aside",
4343
4839
  {
4344
4840
  className: `agent-rail not-typeset${mobileFullscreen ? " agent-rail--mobile-fullscreen" : ""}${expanded ? " agent-rail--expanded" : ""}`,
@@ -4352,28 +4848,28 @@ function AgentRail({
4352
4848
  role: mobileFullscreen || expanded ? "dialog" : void 0,
4353
4849
  tabIndex: mobileFullscreen || expanded ? -1 : void 0,
4354
4850
  children: [
4355
- /* @__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: [
4356
- 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)(
4357
4853
  "button",
4358
4854
  {
4359
4855
  type: "button",
4360
4856
  className: "agent-rail__collapse",
4361
4857
  "aria-label": "Collapse assist",
4362
4858
  onClick: onCollapse,
4363
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(MinimizeIcon, {})
4859
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(MinimizeIcon, {})
4364
4860
  }
4365
- ) : onClose ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4861
+ ) : onClose ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4366
4862
  "button",
4367
4863
  {
4368
4864
  type: "button",
4369
4865
  className: "agent-rail__close",
4370
4866
  "aria-label": "Close agent",
4371
4867
  onClick: onClose,
4372
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(CloseIcon, {})
4868
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(CloseIcon, {})
4373
4869
  }
4374
- ) : /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
4375
- resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "agent-rail__identity", children: [
4376
- 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)(
4377
4873
  "img",
4378
4874
  {
4379
4875
  className: "agent-rail__brand-logo",
@@ -4384,10 +4880,10 @@ function AgentRail({
4384
4880
  }
4385
4881
  }
4386
4882
  ) }) : null,
4387
- 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
4388
4884
  ] }) : null,
4389
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("span", { className: "agent-rail__actions", children: [
4390
- 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)(
4391
4887
  "button",
4392
4888
  {
4393
4889
  type: "button",
@@ -4395,24 +4891,24 @@ function AgentRail({
4395
4891
  "aria-label": "Start a new conversation",
4396
4892
  disabled: !hasVisitorMessages2,
4397
4893
  onClick: onReset,
4398
- children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(NewChatIcon, {})
4894
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(NewChatIcon, {})
4399
4895
  }
4400
4896
  ) : null,
4401
- onExpandToggle ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4897
+ onExpandToggle ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4402
4898
  "button",
4403
4899
  {
4404
4900
  type: "button",
4405
4901
  className: "agent-rail__expand",
4406
4902
  "aria-label": expanded ? "Exit full screen" : "Open full screen",
4407
4903
  onClick: onExpandToggle,
4408
- 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, {})
4409
4905
  }
4410
4906
  ) : null
4411
4907
  ] })
4412
4908
  ] }) }),
4413
- /* @__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: [
4414
- !hasVisitorMessages2 ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
4415
- 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)(
4416
4912
  MessageBubble,
4417
4913
  {
4418
4914
  message: greeting,
@@ -4420,7 +4916,7 @@ function AgentRail({
4420
4916
  onBook
4421
4917
  }
4422
4918
  ) : null,
4423
- 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)(
4424
4920
  FollowUpChips,
4425
4921
  {
4426
4922
  suggestions: state.followUps,
@@ -4429,7 +4925,7 @@ function AgentRail({
4429
4925
  onSelect: (suggestion) => onFollowUpSelect?.(suggestion.label)
4430
4926
  }
4431
4927
  ) }) : null,
4432
- showActivity ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4928
+ showActivity ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4433
4929
  AgentActivityBubble,
4434
4930
  {
4435
4931
  brandLabel: resolvedBrandLabel,
@@ -4438,8 +4934,16 @@ function AgentRail({
4438
4934
  steps: state.toolSteps
4439
4935
  }
4440
4936
  ) : null,
4441
- visitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(VisitorToolResultView, { result }, result.id)),
4442
- 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)(
4443
4947
  HumanInputCard,
4444
4948
  {
4445
4949
  request,
@@ -4448,8 +4952,8 @@ function AgentRail({
4448
4952
  request.requestId
4449
4953
  ))
4450
4954
  ] }) : null,
4451
- visibleMessages.map((message, index) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "agent-rail__turn-block", children: [
4452
- /* @__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)(
4453
4957
  MessageBubble,
4454
4958
  {
4455
4959
  message,
@@ -4458,8 +4962,8 @@ function AgentRail({
4458
4962
  onBook
4459
4963
  }
4460
4964
  ),
4461
- index === lastVisitorIndex ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(import_jsx_runtime13.Fragment, { children: [
4462
- 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)(
4463
4967
  AgentActivityBubble,
4464
4968
  {
4465
4969
  brandLabel: resolvedBrandLabel,
@@ -4468,8 +4972,16 @@ function AgentRail({
4468
4972
  steps: state.toolSteps
4469
4973
  }
4470
4974
  ) : null,
4471
- visitorToolResults.map((result) => /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(VisitorToolResultView, { result }, result.id)),
4472
- 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)(
4473
4985
  HumanInputCard,
4474
4986
  {
4475
4987
  request,
@@ -4479,7 +4991,7 @@ function AgentRail({
4479
4991
  ))
4480
4992
  ] }) : null
4481
4993
  ] }, message.id)),
4482
- streamingMessage ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4994
+ streamingMessage ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
4483
4995
  MessageBubble,
4484
4996
  {
4485
4997
  message: streamingMessage,
@@ -4488,22 +5000,17 @@ function AgentRail({
4488
5000
  onBook
4489
5001
  }
4490
5002
  ) : null,
4491
- waitingForBooking ? /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
4492
- BookingCard,
4493
- {
4494
- offer: { type: "booking_offer", eventTypes: [], slots: [] }
4495
- }
4496
- ) : null,
4497
- state.error ? /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("section", { className: "agent-rail__error", role: "alert", children: [
4498
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { children: [
4499
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("strong", { children: "Something went wrong" }),
4500
- /* @__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 })
4501
5008
  ] }),
4502
- 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
4503
5010
  ] }) : null
4504
5011
  ] }) }),
4505
- /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("div", { className: "agent-rail__composer-wrap", children: [
4506
- /* @__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)(
4507
5014
  Composer,
4508
5015
  {
4509
5016
  variant: expanded || mobileFullscreen ? "dock" : "default",
@@ -4513,9 +5020,9 @@ function AgentRail({
4513
5020
  onSubmit
4514
5021
  }
4515
5022
  ),
4516
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("div", { className: "agent-rail__footer", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("p", { children: [
4517
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("span", { children: "AI can make mistakes. Check important info." }),
4518
- /* @__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 })
4519
5026
  ] }) })
4520
5027
  ] })
4521
5028
  ]
@@ -4524,9 +5031,9 @@ function AgentRail({
4524
5031
  }
4525
5032
 
4526
5033
  // src/react/components/AssistEdgeTab/AssistEdgeTab.tsx
4527
- var import_jsx_runtime14 = require("react/jsx-runtime");
5034
+ var import_jsx_runtime15 = require("react/jsx-runtime");
4528
5035
  function SparklesIcon() {
4529
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
5036
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
4530
5037
  "svg",
4531
5038
  {
4532
5039
  className: "assist-edge-tab__sparkles",
@@ -4534,21 +5041,21 @@ function SparklesIcon() {
4534
5041
  fill: "none",
4535
5042
  "aria-hidden": "true",
4536
5043
  children: [
4537
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5044
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4538
5045
  "path",
4539
5046
  {
4540
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",
4541
5048
  fill: "currentColor"
4542
5049
  }
4543
5050
  ),
4544
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5051
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4545
5052
  "path",
4546
5053
  {
4547
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",
4548
5055
  fill: "currentColor"
4549
5056
  }
4550
5057
  ),
4551
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5058
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4552
5059
  "path",
4553
5060
  {
4554
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",
@@ -4562,7 +5069,7 @@ function SparklesIcon() {
4562
5069
  function TabMarkIcon({ customIconUrl }) {
4563
5070
  const url = customIconUrl?.trim();
4564
5071
  if (url) {
4565
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5072
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4566
5073
  "img",
4567
5074
  {
4568
5075
  alt: "",
@@ -4572,10 +5079,10 @@ function TabMarkIcon({ customIconUrl }) {
4572
5079
  }
4573
5080
  );
4574
5081
  }
4575
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(SparklesIcon, {});
5082
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(SparklesIcon, {});
4576
5083
  }
4577
5084
  function ChevronLeftIcon() {
4578
- 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)(
4579
5086
  "path",
4580
5087
  {
4581
5088
  d: "M10 4L6 8l4 4",
@@ -4587,7 +5094,7 @@ function ChevronLeftIcon() {
4587
5094
  ) });
4588
5095
  }
4589
5096
  function ChevronDownIcon() {
4590
- 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)(
4591
5098
  "path",
4592
5099
  {
4593
5100
  d: "M4 6l4 4 4-4",
@@ -4599,7 +5106,7 @@ function ChevronDownIcon() {
4599
5106
  ) });
4600
5107
  }
4601
5108
  function DragDots() {
4602
- 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)) });
4603
5110
  }
4604
5111
  var VARIANT_COPY = {
4605
5112
  outline: { label: "Ask anything", aria: "Ask anything" },
@@ -4645,7 +5152,7 @@ function AssistEdgeTab({
4645
5152
  ...resolvedTextColor ? { "--as-text": resolvedTextColor } : {},
4646
5153
  colorScheme: resolvedColorScheme
4647
5154
  };
4648
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(
5155
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
4649
5156
  "button",
4650
5157
  {
4651
5158
  type: "button",
@@ -4657,15 +5164,15 @@ function AssistEdgeTab({
4657
5164
  tabIndex: visible ? 0 : -1,
4658
5165
  onClick: onOpen,
4659
5166
  children: [
4660
- mobile ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
4661
- /* @__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)(
4662
5169
  "span",
4663
5170
  {
4664
5171
  className: "assist-edge-tab__mark assist-edge-tab__mark--mobile",
4665
5172
  "aria-hidden": "true",
4666
5173
  children: [
4667
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TabMarkIcon, { customIconUrl }),
4668
- showLogo ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
5174
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(TabMarkIcon, { customIconUrl }),
5175
+ showLogo ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
4669
5176
  "img",
4670
5177
  {
4671
5178
  className: "assist-edge-tab__logo",
@@ -4679,11 +5186,11 @@ function AssistEdgeTab({
4679
5186
  ]
4680
5187
  }
4681
5188
  ),
4682
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel })
4683
- ] }) : variant === "outline" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
4684
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
4685
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TabMarkIcon, { customIconUrl }),
4686
- 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)(
4687
5194
  "img",
4688
5195
  {
4689
5196
  className: "assist-edge-tab__logo",
@@ -4695,18 +5202,18 @@ function AssistEdgeTab({
4695
5202
  }
4696
5203
  ) : null
4697
5204
  ] }),
4698
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
4699
- /* @__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, {})
4700
5207
  ] }) : null,
4701
- variant === "ask" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
4702
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ChevronLeftIcon, {}),
4703
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
4704
- /* @__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, {})
4705
5212
  ] }) : null,
4706
- variant === "fill" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)(import_jsx_runtime14.Fragment, { children: [
4707
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: [
4708
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(TabMarkIcon, { customIconUrl }),
4709
- 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)(
4710
5217
  "img",
4711
5218
  {
4712
5219
  className: "assist-edge-tab__logo",
@@ -4718,8 +5225,8 @@ function AssistEdgeTab({
4718
5225
  }
4719
5226
  ) : null
4720
5227
  ] }),
4721
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("span", { className: "assist-edge-tab__label", children: visibleLabel }),
4722
- /* @__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, {})
4723
5230
  ] }) : null
4724
5231
  ]
4725
5232
  }
@@ -4727,7 +5234,7 @@ function AssistEdgeTab({
4727
5234
  }
4728
5235
 
4729
5236
  // src/react/components/AgentWidget/AgentWidget.tsx
4730
- var import_jsx_runtime15 = require("react/jsx-runtime");
5237
+ var import_jsx_runtime16 = require("react/jsx-runtime");
4731
5238
  function AgentWidget({
4732
5239
  indexId,
4733
5240
  customerId,
@@ -4745,9 +5252,9 @@ function AgentWidget({
4745
5252
  }) {
4746
5253
  const isMobile = useIsMobile();
4747
5254
  const placement = normalizeAgentPlacement(placementInput);
4748
- const railSlotRef = (0, import_react11.useRef)(null);
4749
- const [railCollapsed, setRailCollapsed] = (0, import_react11.useState)(defaultCollapsed);
4750
- 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);
4751
5258
  const pageShiftActive = shouldApplyPageShift({
4752
5259
  pageShift,
4753
5260
  isMobile,
@@ -4777,7 +5284,10 @@ function AgentWidget({
4777
5284
  visitorBubble: branding.colors.primary
4778
5285
  } : {},
4779
5286
  ...branding?.colors?.primarySoft ? { brandSoft: branding.colors.primarySoft } : {},
4780
- ...branding?.colors?.primaryForeground ? { visitorText: branding.colors.primaryForeground } : {},
5287
+ ...branding?.colors?.primaryForeground ? {
5288
+ onBrand: branding.colors.primaryForeground,
5289
+ visitorText: branding.colors.primaryForeground
5290
+ } : {},
4781
5291
  ...branding?.colors?.surface ? { surface: branding.colors.surface } : {},
4782
5292
  ...branding?.colors?.surfaceMuted ? { surfaceMuted: branding.colors.surfaceMuted } : {},
4783
5293
  ...branding?.colors?.text ? { text: branding.colors.text } : {},
@@ -4787,7 +5297,7 @@ function AgentWidget({
4787
5297
  } : {},
4788
5298
  ...branding?.colors?.border ? { border: branding.colors.border } : {}
4789
5299
  };
4790
- (0, import_react11.useEffect)(() => {
5300
+ (0, import_react12.useEffect)(() => {
4791
5301
  if (!registerPanelController) return;
4792
5302
  registerAgentPanelController(customerId, {
4793
5303
  open: () => setRailCollapsed(false),
@@ -4804,7 +5314,7 @@ function AgentWidget({
4804
5314
  if (isMobile) setRailCollapsed(false);
4805
5315
  await submit(message);
4806
5316
  }
4807
- (0, import_react11.useEffect)(() => {
5317
+ (0, import_react12.useEffect)(() => {
4808
5318
  if (railCollapsed) return;
4809
5319
  const handleKeyDown = (event) => {
4810
5320
  if (event.key === "Tab" && (isMobile || railExpanded)) {
@@ -4838,19 +5348,19 @@ function AgentWidget({
4838
5348
  window.addEventListener("keydown", handleKeyDown);
4839
5349
  return () => window.removeEventListener("keydown", handleKeyDown);
4840
5350
  }, [isMobile, railCollapsed, railExpanded]);
4841
- return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("div", { className: "webless-agent-root", children: [
4842
- /* @__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)(
4843
5353
  "div",
4844
5354
  {
4845
5355
  className: `webless-agent-root__shell${railCollapsed ? " webless-agent-root__shell--collapsed" : ""}${railExpanded ? " webless-agent-root__shell--expanded" : ""}`,
4846
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5356
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4847
5357
  "div",
4848
5358
  {
4849
5359
  ref: railSlotRef,
4850
5360
  className: "webless-agent-root__rail-slot",
4851
5361
  inert: railCollapsed || void 0,
4852
5362
  "aria-hidden": railCollapsed,
4853
- children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5363
+ children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4854
5364
  AgentRail,
4855
5365
  {
4856
5366
  theme,
@@ -4878,7 +5388,7 @@ function AgentWidget({
4878
5388
  )
4879
5389
  }
4880
5390
  ),
4881
- railCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
5391
+ railCollapsed ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
4882
5392
  AssistEdgeTab,
4883
5393
  {
4884
5394
  variant: placement.variant,
@@ -4917,12 +5427,12 @@ function readUnpublishedPreviewBuildId(href) {
4917
5427
  }
4918
5428
 
4919
5429
  // src/embed/AgentWidget.tsx
4920
- var import_jsx_runtime16 = require("react/jsx-runtime");
5430
+ var import_jsx_runtime17 = require("react/jsx-runtime");
4921
5431
  function AgentWidget2({
4922
5432
  manifest
4923
5433
  }) {
4924
5434
  const defaultCollapsed = manifest.version !== "unpublished";
4925
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
5435
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
4926
5436
  AgentWidget,
4927
5437
  {
4928
5438
  indexId: manifest.indexId,
@@ -5006,7 +5516,7 @@ function normalizeAgentBranding(branding) {
5006
5516
  }
5007
5517
 
5008
5518
  // src/embed/mount.tsx
5009
- var import_jsx_runtime17 = require("react/jsx-runtime");
5519
+ var import_jsx_runtime18 = require("react/jsx-runtime");
5010
5520
  var mountedHandles = /* @__PURE__ */ new Map();
5011
5521
  var latestCustomerId = null;
5012
5522
  function resolveMountHost(manifest, script) {
@@ -5036,7 +5546,7 @@ function mountAgent(input) {
5036
5546
  const host = createHost(manifest.customerId);
5037
5547
  mountTarget.append(host);
5038
5548
  const root = (0, import_client5.createRoot)(host);
5039
- root.render(/* @__PURE__ */ (0, import_jsx_runtime17.jsx)(AgentWidget2, { manifest }));
5549
+ root.render(/* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AgentWidget2, { manifest }));
5040
5550
  const handle = {
5041
5551
  customerId: manifest.customerId,
5042
5552
  manifest,