@webless/agent 0.10.3 → 0.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1099,6 +1099,9 @@ function finalizeSummaryPresentation(result, proposed) {
1099
1099
  };
1100
1100
  }
1101
1101
  function presentVisitorToolResult(result, registry = []) {
1102
+ if (result.toolName === "request_location") {
1103
+ return { id: result.callId, toolName: result.toolName, status: result.status, kind: "hidden" };
1104
+ }
1102
1105
  if (result.status === "completed" && toolResultFailed(result)) {
1103
1106
  result = { ...result, status: "failed" };
1104
1107
  }
@@ -1287,18 +1290,26 @@ function createAgentRuntimeCapability(options) {
1287
1290
  );
1288
1291
  }
1289
1292
  }
1290
- const bootstrapBody = JSON.stringify({
1293
+ const bootstrapBody = {
1291
1294
  clientSessionId: options.visitorSessionId,
1292
1295
  indexId: options.indexId,
1293
1296
  ...previewBuildId ? { previewBuildId } : {},
1294
1297
  ...previewGrant ? { previewGrant } : {},
1295
1298
  version: options.version
1296
- });
1297
- const postBootstrap = (origin) => fetchImplementation(`${origin}/webless/v1/bootstrap`, {
1298
- body: bootstrapBody,
1299
- headers: { "content-type": "application/json" },
1300
- method: "POST"
1301
- });
1299
+ };
1300
+ const postBootstrap = async (origin) => {
1301
+ const send = (advertiseLocation) => fetchImplementation(`${origin}/webless/v1/bootstrap`, {
1302
+ body: JSON.stringify({ ...bootstrapBody, ...advertiseLocation ? { locationConsent: "v1" } : {} }),
1303
+ headers: { "content-type": "application/json" },
1304
+ method: "POST"
1305
+ });
1306
+ const response2 = await send(Boolean(options.locationConsent));
1307
+ if (options.locationConsent && response2.status === 400) {
1308
+ const error = await response2.clone().json().catch(() => null);
1309
+ if (isRecord3(error) && error.code === "invalid_request") return send(false);
1310
+ }
1311
+ return response2;
1312
+ };
1302
1313
  let response;
1303
1314
  let lastError;
1304
1315
  for (const origin of localBootstrapOrigins(options.runtimeOrigin)) {
@@ -1833,6 +1844,7 @@ function specialistNameFromInput(input) {
1833
1844
  return match?.[1]?.trim() || void 0;
1834
1845
  }
1835
1846
  function requestedWorkItem(action) {
1847
+ if (action.kind === "tool-call" && action.toolName === "request_location") return null;
1836
1848
  if (action.kind === "tool-call" && action.toolName === "search_discovery") {
1837
1849
  return {
1838
1850
  id: action.callId,
@@ -1938,13 +1950,14 @@ function applyWorkEvent(event, handlers, workItems) {
1938
1950
  );
1939
1951
  }
1940
1952
  var AgentSession = class {
1941
- constructor(indexId, version, runtimeOrigin, visitorSessionId, storeOptions, previewBuildId, getUnpublishedPreviewGrant) {
1953
+ constructor(indexId, version, runtimeOrigin, visitorSessionId, storeOptions, previewBuildId, getUnpublishedPreviewGrant, locationConsent) {
1942
1954
  this.indexId = indexId;
1943
1955
  this.version = version;
1944
1956
  this.runtimeOrigin = runtimeOrigin;
1945
1957
  this.visitorSessionId = visitorSessionId;
1946
1958
  this.storeOptions = storeOptions;
1947
1959
  this.capability = createAgentRuntimeCapability({
1960
+ locationConsent,
1948
1961
  getUnpublishedPreviewGrant,
1949
1962
  indexId,
1950
1963
  previewBuildId,
@@ -2336,7 +2349,8 @@ function createAgentClient(options) {
2336
2349
  visitorSessionId,
2337
2350
  storeOptions,
2338
2351
  options.previewBuildId,
2339
- options.getUnpublishedPreviewGrant
2352
+ options.getUnpublishedPreviewGrant,
2353
+ options.locationConsent
2340
2354
  );
2341
2355
  return {
2342
2356
  indexId,
@@ -2915,6 +2929,7 @@ function useAgentChat({
2915
2929
  const runRef = useRef(null);
2916
2930
  const clientRef = useRef(
2917
2931
  createAgentClient({
2932
+ locationConsent: true,
2918
2933
  customerId,
2919
2934
  getUnpublishedPreviewGrant: resolveUnpublishedPreviewGrant,
2920
2935
  indexId,
@@ -2935,6 +2950,7 @@ function useAgentChat({
2935
2950
  runRef.current?.abort();
2936
2951
  runRef.current = null;
2937
2952
  clientRef.current = createAgentClient({
2953
+ locationConsent: true,
2938
2954
  customerId,
2939
2955
  getUnpublishedPreviewGrant: resolveUnpublishedPreviewGrant,
2940
2956
  indexId,
@@ -4202,7 +4218,7 @@ function MessageActions({
4202
4218
  }
4203
4219
 
4204
4220
  // src/react/components/AgentRail/AgentRail.tsx
4205
- import { useEffect as useEffect6, useRef as useRef6, useState as useState9 } from "react";
4221
+ import { useEffect as useEffect7, useRef as useRef7, useState as useState10 } from "react";
4206
4222
 
4207
4223
  // src/react/lib/agent-theme.ts
4208
4224
  function agentThemeStyle(theme, resolvedColorScheme) {
@@ -6035,31 +6051,173 @@ function HumanInputCard({
6035
6051
  );
6036
6052
  }
6037
6053
 
6038
- // src/react/components/CollectionResultCard/CollectionResultCard.tsx
6054
+ // src/react/components/LocationConsent/LocationConsent.tsx
6055
+ import { useEffect as useEffect6, useRef as useRef6, useState as useState9 } from "react";
6056
+
6057
+ // src/runtime/location-consent.ts
6058
+ function isLocationConsentRequest(request) {
6059
+ return request.kind === "tool-approval" && request.action.toolName === "request_location";
6060
+ }
6061
+ function preciseLocationResponse(requestId, position) {
6062
+ const { latitude, longitude, accuracy } = position.coords;
6063
+ if (!Number.isFinite(latitude) || latitude < -90 || latitude > 90 || !Number.isFinite(longitude) || longitude < -180 || longitude > 180 || !Number.isFinite(accuracy) || accuracy < 0 || !Number.isFinite(position.timestamp)) {
6064
+ throw new Error("Your device returned an invalid location.");
6065
+ }
6066
+ return {
6067
+ requestId,
6068
+ optionId: "approve",
6069
+ text: JSON.stringify({
6070
+ status: "shared",
6071
+ location: {
6072
+ source: "device",
6073
+ latitude,
6074
+ longitude,
6075
+ accuracyMeters: accuracy,
6076
+ capturedAt: new Date(position.timestamp).toISOString(),
6077
+ consentedAt: (/* @__PURE__ */ new Date()).toISOString(),
6078
+ scope: "conversation"
6079
+ }
6080
+ })
6081
+ };
6082
+ }
6083
+ function getPreciseLocation(geolocation) {
6084
+ return new Promise(
6085
+ (resolve, reject) => geolocation.getCurrentPosition(
6086
+ resolve,
6087
+ (error) => reject(
6088
+ new Error(
6089
+ error.code === 1 ? "Location access is blocked. Allow it in your browser, or continue without sharing." : "Your location couldn\u2019t be found. Try again or continue without sharing."
6090
+ )
6091
+ ),
6092
+ { enableHighAccuracy: true, maximumAge: 0, timeout: 1e4 }
6093
+ )
6094
+ );
6095
+ }
6096
+
6097
+ // src/react/components/LocationConsent/LocationConsent.tsx
6039
6098
  import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
6099
+ function LocationConsent({
6100
+ request,
6101
+ onRespond
6102
+ }) {
6103
+ const [preference, setPreference] = useState9("unset");
6104
+ const [locating, setLocating] = useState9(false);
6105
+ const [error, setError] = useState9(null);
6106
+ const respond = useRef6(onRespond);
6107
+ const answered = useRef6(null);
6108
+ const requestId = request?.requestId;
6109
+ useEffect6(() => {
6110
+ respond.current = onRespond;
6111
+ }, [onRespond]);
6112
+ useEffect6(() => {
6113
+ if (!requestId || preference === "unset" || answered.current === requestId || !respond.current)
6114
+ return;
6115
+ if (preference === "off") {
6116
+ setLocating(false);
6117
+ answered.current = requestId;
6118
+ respond.current({
6119
+ requestId,
6120
+ optionId: "approve",
6121
+ text: JSON.stringify({ status: "declined" })
6122
+ });
6123
+ return;
6124
+ }
6125
+ let cancelled = false;
6126
+ const pendingId = requestId;
6127
+ setLocating(true);
6128
+ setError(null);
6129
+ async function locate() {
6130
+ try {
6131
+ if (!Reflect.has(navigator, "geolocation"))
6132
+ throw new Error("Location sharing isn\u2019t available in this browser.");
6133
+ const position = await getPreciseLocation(navigator.geolocation);
6134
+ if (cancelled) return;
6135
+ const response = preciseLocationResponse(pendingId, position);
6136
+ answered.current = pendingId;
6137
+ respond.current?.(response);
6138
+ } catch (failure) {
6139
+ if (cancelled) return;
6140
+ setPreference("unset");
6141
+ setError(
6142
+ failure instanceof Error ? failure.message : "Location sharing failed. Try again or continue without sharing."
6143
+ );
6144
+ } finally {
6145
+ if (!cancelled) setLocating(false);
6146
+ }
6147
+ }
6148
+ void locate();
6149
+ return () => {
6150
+ cancelled = true;
6151
+ };
6152
+ }, [requestId, preference]);
6153
+ const isLocating = Boolean(requestId) && preference === "on" && locating;
6154
+ if (!request && preference === "unset") return null;
6155
+ return /* @__PURE__ */ jsxs12("section", { className: "location-consent", "aria-label": "Location sharing", children: [
6156
+ /* @__PURE__ */ jsxs12("div", { className: "location-consent__copy", children: [
6157
+ /* @__PURE__ */ jsx12("strong", { children: isLocating ? "Getting your location\u2026" : request ? "Get better results" : "Precise location" }),
6158
+ /* @__PURE__ */ jsx12("span", { children: isLocating ? "Allow location access in your browser." : request ? "Share your precise location" : preference === "on" ? "On for location-aware answers" : "Off for this chat" })
6159
+ ] }),
6160
+ /* @__PURE__ */ jsxs12("div", { className: "location-consent__actions", children: [
6161
+ /* @__PURE__ */ jsx12(
6162
+ "button",
6163
+ {
6164
+ type: "button",
6165
+ role: "switch",
6166
+ className: "location-consent__toggle",
6167
+ "aria-label": "Share precise location",
6168
+ "aria-checked": preference === "on",
6169
+ "aria-busy": isLocating,
6170
+ disabled: !onRespond,
6171
+ onClick: () => {
6172
+ setError(null);
6173
+ setPreference(preference === "on" ? "off" : "on");
6174
+ },
6175
+ children: /* @__PURE__ */ jsx12("span", {})
6176
+ }
6177
+ ),
6178
+ request && /* @__PURE__ */ jsx12(
6179
+ "button",
6180
+ {
6181
+ type: "button",
6182
+ className: "location-consent__decline",
6183
+ disabled: !onRespond,
6184
+ onClick: () => {
6185
+ setError(null);
6186
+ setPreference("off");
6187
+ },
6188
+ children: "No thanks"
6189
+ }
6190
+ )
6191
+ ] }),
6192
+ error && /* @__PURE__ */ jsx12("p", { role: "alert", className: "location-consent__error", children: error })
6193
+ ] });
6194
+ }
6195
+
6196
+ // src/react/components/CollectionResultCard/CollectionResultCard.tsx
6197
+ import { jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
6040
6198
  function CollectionResultCard({
6041
6199
  result
6042
6200
  }) {
6043
6201
  const empty = result.items.length === 0;
6044
- return /* @__PURE__ */ jsxs12(
6202
+ return /* @__PURE__ */ jsxs13(
6045
6203
  "section",
6046
6204
  {
6047
6205
  className: `collection-result-card tool-result-card tool-result-card--${result.status}`,
6048
6206
  "aria-label": result.title,
6049
6207
  role: result.status === "completed" ? "status" : "alert",
6050
6208
  children: [
6051
- /* @__PURE__ */ jsxs12("div", { className: "tool-result-card__heading", children: [
6052
- /* @__PURE__ */ jsx12("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
6053
- /* @__PURE__ */ jsx12("strong", { children: result.title })
6209
+ /* @__PURE__ */ jsxs13("div", { className: "tool-result-card__heading", children: [
6210
+ /* @__PURE__ */ jsx13("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
6211
+ /* @__PURE__ */ jsx13("strong", { children: result.title })
6054
6212
  ] }),
6055
- empty ? /* @__PURE__ */ jsx12("p", { className: "collection-result-card__empty", children: "No matching record for the email you shared." }) : /* @__PURE__ */ jsx12("ul", { className: "collection-result-card__list", children: result.items.map((item) => /* @__PURE__ */ jsxs12("li", { children: [
6056
- /* @__PURE__ */ jsx12("div", { className: "collection-result-card__item-title", children: item.title }),
6057
- item.description ? /* @__PURE__ */ jsx12("p", { children: item.description }) : null,
6058
- item.details?.length ? /* @__PURE__ */ jsx12("dl", { children: item.details.map((detail) => /* @__PURE__ */ jsxs12("div", { children: [
6059
- /* @__PURE__ */ jsx12("dt", { children: detail.label }),
6060
- /* @__PURE__ */ jsx12("dd", { children: detail.value })
6213
+ empty ? /* @__PURE__ */ jsx13("p", { className: "collection-result-card__empty", children: "No matching record for the email you shared." }) : /* @__PURE__ */ jsx13("ul", { className: "collection-result-card__list", children: result.items.map((item) => /* @__PURE__ */ jsxs13("li", { children: [
6214
+ /* @__PURE__ */ jsx13("div", { className: "collection-result-card__item-title", children: item.title }),
6215
+ item.description ? /* @__PURE__ */ jsx13("p", { children: item.description }) : null,
6216
+ item.details?.length ? /* @__PURE__ */ jsx13("dl", { children: item.details.map((detail) => /* @__PURE__ */ jsxs13("div", { children: [
6217
+ /* @__PURE__ */ jsx13("dt", { children: detail.label }),
6218
+ /* @__PURE__ */ jsx13("dd", { children: detail.value })
6061
6219
  ] }, `${detail.label}:${detail.value}`)) }) : null,
6062
- item.href ? /* @__PURE__ */ jsx12("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
6220
+ item.href ? /* @__PURE__ */ jsx13("a", { href: item.href, target: "_blank", rel: "noreferrer", children: "Open record" }) : null
6063
6221
  ] }, item.title)) })
6064
6222
  ]
6065
6223
  }
@@ -6067,23 +6225,23 @@ function CollectionResultCard({
6067
6225
  }
6068
6226
 
6069
6227
  // src/react/components/EntityResultCard/EntityResultCard.tsx
6070
- import { Fragment as Fragment3, jsx as jsx13, jsxs as jsxs13 } from "react/jsx-runtime";
6228
+ import { Fragment as Fragment3, jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
6071
6229
  function EntityResultCard({
6072
6230
  result
6073
6231
  }) {
6074
6232
  const compact = !result.description && !result.details?.length && !result.links?.length;
6075
6233
  const collapsible = result.status === "completed" && Boolean(result.details?.length) && !result.links?.length;
6076
- const heading = /* @__PURE__ */ jsxs13("span", { className: "tool-result-card__heading", children: [
6077
- /* @__PURE__ */ jsx13("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
6078
- /* @__PURE__ */ jsx13("strong", { children: result.title })
6234
+ const heading = /* @__PURE__ */ jsxs14("span", { className: "tool-result-card__heading", children: [
6235
+ /* @__PURE__ */ jsx14("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
6236
+ /* @__PURE__ */ jsx14("strong", { children: result.title })
6079
6237
  ] });
6080
- const content = /* @__PURE__ */ jsxs13(Fragment3, { children: [
6081
- result.description ? /* @__PURE__ */ jsx13("p", { children: result.description }) : null,
6082
- result.details?.length ? /* @__PURE__ */ jsx13("dl", { children: result.details.map((detail) => /* @__PURE__ */ jsxs13("div", { children: [
6083
- /* @__PURE__ */ jsx13("dt", { children: detail.label }),
6084
- /* @__PURE__ */ jsx13("dd", { children: detail.value })
6238
+ const content = /* @__PURE__ */ jsxs14(Fragment3, { children: [
6239
+ result.description ? /* @__PURE__ */ jsx14("p", { children: result.description }) : null,
6240
+ result.details?.length ? /* @__PURE__ */ jsx14("dl", { children: result.details.map((detail) => /* @__PURE__ */ jsxs14("div", { children: [
6241
+ /* @__PURE__ */ jsx14("dt", { children: detail.label }),
6242
+ /* @__PURE__ */ jsx14("dd", { children: detail.value })
6085
6243
  ] }, `${detail.label}:${detail.value}`)) }) : null,
6086
- result.links?.length ? /* @__PURE__ */ jsx13("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ jsx13(
6244
+ result.links?.length ? /* @__PURE__ */ jsx14("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ jsx14(
6087
6245
  "a",
6088
6246
  {
6089
6247
  href: link.href,
@@ -6095,12 +6253,12 @@ function EntityResultCard({
6095
6253
  )) }) : null
6096
6254
  ] });
6097
6255
  if (collapsible) {
6098
- return /* @__PURE__ */ jsxs13("details", { className: "entity-result-card tool-result-card entity-result-card--disclosure", children: [
6099
- /* @__PURE__ */ jsx13("summary", { children: /* @__PURE__ */ jsx13("span", { role: "status", children: heading }) }),
6256
+ return /* @__PURE__ */ jsxs14("details", { className: "entity-result-card tool-result-card entity-result-card--disclosure", children: [
6257
+ /* @__PURE__ */ jsx14("summary", { children: /* @__PURE__ */ jsx14("span", { role: "status", children: heading }) }),
6100
6258
  content
6101
6259
  ] });
6102
6260
  }
6103
- return /* @__PURE__ */ jsxs13(
6261
+ return /* @__PURE__ */ jsxs14(
6104
6262
  "section",
6105
6263
  {
6106
6264
  className: `entity-result-card tool-result-card tool-result-card--${result.status}${compact ? " entity-result-card--compact" : ""}`,
@@ -6115,24 +6273,24 @@ function EntityResultCard({
6115
6273
  }
6116
6274
 
6117
6275
  // src/react/components/SignatureResultCard/SignatureResultCard.tsx
6118
- import { jsx as jsx14, jsxs as jsxs14 } from "react/jsx-runtime";
6276
+ import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
6119
6277
  function SignatureResultCard({
6120
6278
  result
6121
6279
  }) {
6122
6280
  const primaryLink = result.links?.[0];
6123
- return /* @__PURE__ */ jsxs14(
6281
+ return /* @__PURE__ */ jsxs15(
6124
6282
  "section",
6125
6283
  {
6126
6284
  className: `signature-result-card tool-result-card tool-result-card--${result.status}`,
6127
6285
  "aria-label": result.title,
6128
6286
  children: [
6129
- /* @__PURE__ */ jsxs14("div", { className: "tool-result-card__heading", children: [
6130
- /* @__PURE__ */ jsx14("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
6131
- /* @__PURE__ */ jsx14("strong", { children: result.title })
6287
+ /* @__PURE__ */ jsxs15("div", { className: "tool-result-card__heading", children: [
6288
+ /* @__PURE__ */ jsx15("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
6289
+ /* @__PURE__ */ jsx15("strong", { children: result.title })
6132
6290
  ] }),
6133
- result.statusLabel ? /* @__PURE__ */ jsx14("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
6134
- result.description ? /* @__PURE__ */ jsx14("p", { children: result.description }) : null,
6135
- primaryLink ? /* @__PURE__ */ jsx14(
6291
+ result.statusLabel ? /* @__PURE__ */ jsx15("span", { className: "signature-result-card__badge", children: result.statusLabel }) : null,
6292
+ result.description ? /* @__PURE__ */ jsx15("p", { children: result.description }) : null,
6293
+ primaryLink ? /* @__PURE__ */ jsx15(
6136
6294
  "a",
6137
6295
  {
6138
6296
  className: "signature-result-card__cta",
@@ -6148,27 +6306,27 @@ function SignatureResultCard({
6148
6306
  }
6149
6307
 
6150
6308
  // src/react/components/ToolResultCard/ToolResultCard.tsx
6151
- import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
6309
+ import { jsx as jsx16, jsxs as jsxs16 } from "react/jsx-runtime";
6152
6310
  function ToolResultCard({
6153
6311
  result
6154
6312
  }) {
6155
- return /* @__PURE__ */ jsxs15(
6313
+ return /* @__PURE__ */ jsxs16(
6156
6314
  "section",
6157
6315
  {
6158
6316
  className: `tool-result-card tool-result-card--${result.status}`,
6159
6317
  "aria-label": result.title,
6160
6318
  role: result.status === "completed" ? "status" : "alert",
6161
6319
  children: [
6162
- /* @__PURE__ */ jsxs15("div", { className: "tool-result-card__heading", children: [
6163
- /* @__PURE__ */ jsx15("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
6164
- /* @__PURE__ */ jsx15("strong", { children: result.title })
6320
+ /* @__PURE__ */ jsxs16("div", { className: "tool-result-card__heading", children: [
6321
+ /* @__PURE__ */ jsx16("span", { className: "tool-result-card__status", "aria-hidden": "true" }),
6322
+ /* @__PURE__ */ jsx16("strong", { children: result.title })
6165
6323
  ] }),
6166
- result.description ? /* @__PURE__ */ jsx15("p", { children: result.description }) : null,
6167
- result.details?.length ? /* @__PURE__ */ jsx15("dl", { children: result.details.map((detail) => /* @__PURE__ */ jsxs15("div", { children: [
6168
- /* @__PURE__ */ jsx15("dt", { children: detail.label }),
6169
- /* @__PURE__ */ jsx15("dd", { children: detail.value })
6324
+ result.description ? /* @__PURE__ */ jsx16("p", { children: result.description }) : null,
6325
+ result.details?.length ? /* @__PURE__ */ jsx16("dl", { children: result.details.map((detail) => /* @__PURE__ */ jsxs16("div", { children: [
6326
+ /* @__PURE__ */ jsx16("dt", { children: detail.label }),
6327
+ /* @__PURE__ */ jsx16("dd", { children: detail.value })
6170
6328
  ] }, `${detail.label}:${detail.value}`)) }) : null,
6171
- result.links?.length ? /* @__PURE__ */ jsx15("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ jsx15(
6329
+ result.links?.length ? /* @__PURE__ */ jsx16("div", { className: "tool-result-card__links", children: result.links.map((link) => /* @__PURE__ */ jsx16(
6172
6330
  "a",
6173
6331
  {
6174
6332
  href: link.href,
@@ -6184,14 +6342,14 @@ function ToolResultCard({
6184
6342
  }
6185
6343
 
6186
6344
  // src/react/components/VisitorToolResultView/VisitorToolResultView.tsx
6187
- import { jsx as jsx16 } from "react/jsx-runtime";
6345
+ import { jsx as jsx17 } from "react/jsx-runtime";
6188
6346
  function VisitorToolResultView({
6189
6347
  disabled = false,
6190
6348
  onToolInput,
6191
6349
  result
6192
6350
  }) {
6193
6351
  if (result.kind === "input") {
6194
- return /* @__PURE__ */ jsx16(
6352
+ return /* @__PURE__ */ jsx17(
6195
6353
  ToolInputCard,
6196
6354
  {
6197
6355
  disabled,
@@ -6201,16 +6359,16 @@ function VisitorToolResultView({
6201
6359
  );
6202
6360
  }
6203
6361
  if (result.kind === "entity") {
6204
- return /* @__PURE__ */ jsx16(EntityResultCard, { result });
6362
+ return /* @__PURE__ */ jsx17(EntityResultCard, { result });
6205
6363
  }
6206
6364
  if (result.kind === "collection") {
6207
- return /* @__PURE__ */ jsx16(CollectionResultCard, { result });
6365
+ return /* @__PURE__ */ jsx17(CollectionResultCard, { result });
6208
6366
  }
6209
6367
  if (result.kind === "signature") {
6210
- return /* @__PURE__ */ jsx16(SignatureResultCard, { result });
6368
+ return /* @__PURE__ */ jsx17(SignatureResultCard, { result });
6211
6369
  }
6212
6370
  if (result.kind === "summary") {
6213
- return /* @__PURE__ */ jsx16(ToolResultCard, { result });
6371
+ return /* @__PURE__ */ jsx17(ToolResultCard, { result });
6214
6372
  }
6215
6373
  return null;
6216
6374
  }
@@ -6219,9 +6377,9 @@ function isRenderableVisitorToolResult(result) {
6219
6377
  }
6220
6378
 
6221
6379
  // src/react/components/AgentRail/AgentRail.tsx
6222
- import { Fragment as Fragment4, jsx as jsx17, jsxs as jsxs16 } from "react/jsx-runtime";
6380
+ import { Fragment as Fragment4, jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
6223
6381
  function MinimizeIcon() {
6224
- return /* @__PURE__ */ jsx17("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
6382
+ return /* @__PURE__ */ jsx18("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
6225
6383
  "path",
6226
6384
  {
6227
6385
  d: "M3.5 8h9",
@@ -6232,7 +6390,7 @@ function MinimizeIcon() {
6232
6390
  ) });
6233
6391
  }
6234
6392
  function CloseIcon2() {
6235
- return /* @__PURE__ */ jsx17("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
6393
+ return /* @__PURE__ */ jsx18("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
6236
6394
  "path",
6237
6395
  {
6238
6396
  d: "M4 4l8 8M12 4l-8 8",
@@ -6243,7 +6401,7 @@ function CloseIcon2() {
6243
6401
  ) });
6244
6402
  }
6245
6403
  function NewChatIcon() {
6246
- return /* @__PURE__ */ jsx17("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
6404
+ return /* @__PURE__ */ jsx18("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
6247
6405
  "path",
6248
6406
  {
6249
6407
  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",
@@ -6255,7 +6413,7 @@ function NewChatIcon() {
6255
6413
  ) });
6256
6414
  }
6257
6415
  function ExpandIcon() {
6258
- return /* @__PURE__ */ jsx17("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
6416
+ return /* @__PURE__ */ jsx18("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
6259
6417
  "path",
6260
6418
  {
6261
6419
  d: "M6 3.5H3.5V6M10 3.5h2.5V6M10 12.5h2.5V10M6 12.5H3.5V10",
@@ -6267,7 +6425,7 @@ function ExpandIcon() {
6267
6425
  ) });
6268
6426
  }
6269
6427
  function RestoreIcon() {
6270
- return /* @__PURE__ */ jsx17("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
6428
+ return /* @__PURE__ */ jsx18("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
6271
6429
  "path",
6272
6430
  {
6273
6431
  d: "M5.5 5.5H3.5V7.5M10.5 5.5h2V7.5M10.5 10.5h2V8.5M5.5 10.5H3.5V8.5",
@@ -6279,7 +6437,7 @@ function RestoreIcon() {
6279
6437
  ) });
6280
6438
  }
6281
6439
  function ChevronDownIcon() {
6282
- return /* @__PURE__ */ jsx17("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
6440
+ return /* @__PURE__ */ jsx18("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
6283
6441
  "path",
6284
6442
  {
6285
6443
  d: "M4 6.5l4 4 4-4",
@@ -6318,28 +6476,29 @@ function AgentRail({
6318
6476
  onInputResponse,
6319
6477
  onToolInput
6320
6478
  }) {
6321
- const railRef = useRef6(null);
6322
- const overlayRef = useRef6(null);
6323
- const transcriptRef = useRef6(null);
6324
- const responseRef = useRef6(null);
6325
- const threadRef = useRef6(null);
6326
- const lastScrolledVisitorIdRef = useRef6(void 0);
6327
- const pinnedToBottomRef = useRef6(true);
6328
- const smoothScrollToLatestRef = useRef6(false);
6329
- const lockedTranscriptScrollTopRef = useRef6(null);
6330
- const [showJumpToLatest, setShowJumpToLatest] = useState9(false);
6331
- const [receiptOpen, setReceiptOpen] = useState9(false);
6479
+ const railRef = useRef7(null);
6480
+ const overlayRef = useRef7(null);
6481
+ const transcriptRef = useRef7(null);
6482
+ const responseRef = useRef7(null);
6483
+ const threadRef = useRef7(null);
6484
+ const lastScrolledVisitorIdRef = useRef7(void 0);
6485
+ const pinnedToBottomRef = useRef7(true);
6486
+ const smoothScrollToLatestRef = useRef7(false);
6487
+ const lockedTranscriptScrollTopRef = useRef7(null);
6488
+ const [showJumpToLatest, setShowJumpToLatest] = useState10(false);
6489
+ const [receiptOpen, setReceiptOpen] = useState10(false);
6332
6490
  const resolvedBrandLabel = brandLabel.trim();
6333
6491
  const resolvedBrandLogoUrl = brandLogoUrl?.trim();
6334
6492
  const resolvedDisclaimerLabel = disclaimerLabel === void 0 ? DEFAULT_DISCLAIMER_LABEL : disclaimerLabel;
6335
- const [failedLogoUrl, setFailedLogoUrl] = useState9(null);
6493
+ const [failedLogoUrl, setFailedLogoUrl] = useState10(null);
6336
6494
  const showBrandLogo = Boolean(resolvedBrandLogoUrl) && failedLogoUrl !== resolvedBrandLogoUrl;
6337
6495
  const resolvedColorScheme = useAgentColorScheme(colorScheme);
6338
6496
  const railStyle = agentThemeStyle(theme, resolvedColorScheme);
6497
+ const locationRequest = state.pendingInputs?.find(isLocationConsentRequest);
6339
6498
  const pendingInputRequests = (state.pendingInputs ?? []).filter(
6340
- (request) => shouldRenderVisitorInputCard(request) && (!state.pendingOffer || request.kind === "tool-approval")
6499
+ (request) => !isLocationConsentRequest(request) && shouldRenderVisitorInputCard(request) && (!state.pendingOffer || request.kind === "tool-approval")
6341
6500
  );
6342
- const isBusy = state.phase === "thinking" || state.phase === "running-tools" || state.phase === "streaming" || state.phase === "waiting-input" && pendingInputRequests.length > 0;
6501
+ const isBusy = state.phase === "thinking" || state.phase === "running-tools" || state.phase === "streaming" || state.phase === "waiting-input" && (pendingInputRequests.length > 0 || Boolean(locationRequest));
6343
6502
  const semanticSurfaceDisabled = isBusy && state.phase !== "waiting-input";
6344
6503
  const visitorToolResults = (state.toolResults ?? []).filter(
6345
6504
  isRenderableVisitorToolResult
@@ -6425,7 +6584,7 @@ function AgentRail({
6425
6584
  ...visibleVisitorToolResults
6426
6585
  ].reverse().find((result) => result.kind !== "input")?.id;
6427
6586
  const receiptSteps = answerReceipt && state.toolSteps.length > 0 ? state.toolSteps : void 0;
6428
- useEffect6(() => {
6587
+ useEffect7(() => {
6429
6588
  if (state.phase !== "complete") {
6430
6589
  setReceiptOpen(false);
6431
6590
  }
@@ -6447,7 +6606,7 @@ function AgentRail({
6447
6606
  onFollowUpSelect?.(label);
6448
6607
  }
6449
6608
  const latestVisitorId = visibleMessages[lastVisitorIndex]?.id;
6450
- useEffect6(() => {
6609
+ useEffect7(() => {
6451
6610
  const node = transcriptRef.current;
6452
6611
  if (!node) return;
6453
6612
  if (latestVisitorId !== lastScrolledVisitorIdRef.current) {
@@ -6477,7 +6636,7 @@ function AgentRail({
6477
6636
  state.followUps,
6478
6637
  state.journey
6479
6638
  ]);
6480
- useEffect6(() => {
6639
+ useEffect7(() => {
6481
6640
  const node = transcriptRef.current;
6482
6641
  if (!node) return;
6483
6642
  const handleScroll = () => {
@@ -6491,7 +6650,7 @@ function AgentRail({
6491
6650
  handleScroll();
6492
6651
  return () => node.removeEventListener("scroll", handleScroll);
6493
6652
  }, []);
6494
- useEffect6(() => {
6653
+ useEffect7(() => {
6495
6654
  if (!receiptOpen) {
6496
6655
  lockedTranscriptScrollTopRef.current = null;
6497
6656
  return;
@@ -6529,7 +6688,7 @@ function AgentRail({
6529
6688
  window.setTimeout(settle, 900);
6530
6689
  node.scrollTo({ top: node.scrollHeight, behavior: "smooth" });
6531
6690
  }
6532
- return /* @__PURE__ */ jsx17(
6691
+ return /* @__PURE__ */ jsx18(
6533
6692
  "aside",
6534
6693
  {
6535
6694
  ref: railRef,
@@ -6543,34 +6702,34 @@ function AgentRail({
6543
6702
  autoFocus: mobileFullscreen || expanded,
6544
6703
  role: mobileFullscreen || expanded ? "dialog" : void 0,
6545
6704
  tabIndex: mobileFullscreen || expanded ? -1 : void 0,
6546
- children: /* @__PURE__ */ jsxs16(
6705
+ children: /* @__PURE__ */ jsxs17(
6547
6706
  AgentRailOverlayContext.Provider,
6548
6707
  {
6549
6708
  value: { railRef, overlayRef },
6550
6709
  children: [
6551
- /* @__PURE__ */ jsxs16("div", { className: "agent-rail__surface", inert: receiptOpen || void 0, children: [
6552
- /* @__PURE__ */ jsx17("header", { className: "agent-rail__header", children: /* @__PURE__ */ jsxs16("div", { className: "agent-rail__brand-row", children: [
6553
- onCollapse ? /* @__PURE__ */ jsx17(
6710
+ /* @__PURE__ */ jsxs17("div", { className: "agent-rail__surface", inert: receiptOpen || void 0, children: [
6711
+ /* @__PURE__ */ jsx18("header", { className: "agent-rail__header", children: /* @__PURE__ */ jsxs17("div", { className: "agent-rail__brand-row", children: [
6712
+ onCollapse ? /* @__PURE__ */ jsx18(
6554
6713
  "button",
6555
6714
  {
6556
6715
  type: "button",
6557
6716
  className: "agent-rail__collapse",
6558
6717
  "aria-label": "Collapse assist",
6559
6718
  onClick: onCollapse,
6560
- children: /* @__PURE__ */ jsx17(MinimizeIcon, {})
6719
+ children: /* @__PURE__ */ jsx18(MinimizeIcon, {})
6561
6720
  }
6562
- ) : onClose ? /* @__PURE__ */ jsx17(
6721
+ ) : onClose ? /* @__PURE__ */ jsx18(
6563
6722
  "button",
6564
6723
  {
6565
6724
  type: "button",
6566
6725
  className: "agent-rail__close",
6567
6726
  "aria-label": "Close agent",
6568
6727
  onClick: onClose,
6569
- children: /* @__PURE__ */ jsx17(CloseIcon2, {})
6728
+ children: /* @__PURE__ */ jsx18(CloseIcon2, {})
6570
6729
  }
6571
- ) : /* @__PURE__ */ jsx17("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
6572
- resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ jsxs16("span", { className: "agent-rail__identity", children: [
6573
- showBrandLogo ? /* @__PURE__ */ jsx17("span", { className: "agent-rail__brand-mark", "aria-hidden": "true", children: /* @__PURE__ */ jsx17(
6730
+ ) : /* @__PURE__ */ jsx18("span", { className: "agent-rail__brand-spacer", "aria-hidden": "true" }),
6731
+ resolvedBrandLabel || showBrandLogo ? /* @__PURE__ */ jsxs17("span", { className: "agent-rail__identity", children: [
6732
+ showBrandLogo ? /* @__PURE__ */ jsx18("span", { className: "agent-rail__brand-mark", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
6574
6733
  "img",
6575
6734
  {
6576
6735
  className: "agent-rail__brand-logo",
@@ -6581,10 +6740,10 @@ function AgentRail({
6581
6740
  }
6582
6741
  }
6583
6742
  ) }) : null,
6584
- resolvedBrandLabel ? /* @__PURE__ */ jsx17("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
6743
+ resolvedBrandLabel ? /* @__PURE__ */ jsx18("span", { className: "agent-rail__brand-label", children: resolvedBrandLabel }) : null
6585
6744
  ] }) : null,
6586
- /* @__PURE__ */ jsxs16("span", { className: "agent-rail__actions", children: [
6587
- onReset ? /* @__PURE__ */ jsx17(
6745
+ /* @__PURE__ */ jsxs17("span", { className: "agent-rail__actions", children: [
6746
+ onReset ? /* @__PURE__ */ jsx18(
6588
6747
  "button",
6589
6748
  {
6590
6749
  type: "button",
@@ -6592,24 +6751,24 @@ function AgentRail({
6592
6751
  "aria-label": "Start a new conversation",
6593
6752
  disabled: !hasVisitorMessages2,
6594
6753
  onClick: handleReset,
6595
- children: /* @__PURE__ */ jsx17(NewChatIcon, {})
6754
+ children: /* @__PURE__ */ jsx18(NewChatIcon, {})
6596
6755
  }
6597
6756
  ) : null,
6598
- onExpandToggle ? /* @__PURE__ */ jsx17(
6757
+ onExpandToggle ? /* @__PURE__ */ jsx18(
6599
6758
  "button",
6600
6759
  {
6601
6760
  type: "button",
6602
6761
  className: "agent-rail__expand",
6603
6762
  "aria-label": expanded ? "Exit full screen" : "Open full screen",
6604
6763
  onClick: onExpandToggle,
6605
- children: expanded ? /* @__PURE__ */ jsx17(RestoreIcon, {}) : /* @__PURE__ */ jsx17(ExpandIcon, {})
6764
+ children: expanded ? /* @__PURE__ */ jsx18(RestoreIcon, {}) : /* @__PURE__ */ jsx18(ExpandIcon, {})
6606
6765
  }
6607
6766
  ) : null
6608
6767
  ] })
6609
6768
  ] }) }),
6610
- /* @__PURE__ */ jsx17("div", { ref: transcriptRef, className: "agent-rail__transcript", children: /* @__PURE__ */ jsxs16("div", { ref: threadRef, className: "agent-rail__thread", children: [
6611
- !hasVisitorMessages2 ? /* @__PURE__ */ jsxs16("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
6612
- greeting?.role === "agent" ? /* @__PURE__ */ jsx17(
6769
+ /* @__PURE__ */ jsx18("div", { ref: transcriptRef, className: "agent-rail__transcript", children: /* @__PURE__ */ jsxs17("div", { ref: threadRef, className: "agent-rail__thread", children: [
6770
+ !hasVisitorMessages2 ? /* @__PURE__ */ jsxs17("section", { className: "agent-rail__welcome", "aria-label": "Welcome", children: [
6771
+ greeting?.role === "agent" ? /* @__PURE__ */ jsx18(
6613
6772
  MessageBubble,
6614
6773
  {
6615
6774
  message: greeting,
@@ -6618,7 +6777,7 @@ function AgentRail({
6618
6777
  onBook
6619
6778
  }
6620
6779
  ) : null,
6621
- showIdleFollowUps ? /* @__PURE__ */ jsx17("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ jsx17(
6780
+ showIdleFollowUps ? /* @__PURE__ */ jsx18("div", { className: "agent-rail__followups-slot", children: /* @__PURE__ */ jsx18(
6622
6781
  FollowUpChips,
6623
6782
  {
6624
6783
  suggestions: state.followUps,
@@ -6627,7 +6786,7 @@ function AgentRail({
6627
6786
  onSelect: (suggestion) => handleFollowUpSelect(suggestion.label)
6628
6787
  }
6629
6788
  ) }) : null,
6630
- showActivity ? /* @__PURE__ */ jsx17(
6789
+ showActivity ? /* @__PURE__ */ jsx18(
6631
6790
  AgentActivityBubble,
6632
6791
  {
6633
6792
  brandLabel: resolvedBrandLabel,
@@ -6636,7 +6795,7 @@ function AgentRail({
6636
6795
  steps: activitySteps
6637
6796
  }
6638
6797
  ) : null,
6639
- visibleVisitorToolResults.map((result) => /* @__PURE__ */ jsx17(
6798
+ visibleVisitorToolResults.map((result) => /* @__PURE__ */ jsx18(
6640
6799
  VisitorToolResultView,
6641
6800
  {
6642
6801
  result,
@@ -6645,7 +6804,7 @@ function AgentRail({
6645
6804
  },
6646
6805
  result.id
6647
6806
  )),
6648
- pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ jsx17(
6807
+ pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ jsx18(
6649
6808
  HumanInputCard,
6650
6809
  {
6651
6810
  request,
@@ -6654,14 +6813,14 @@ function AgentRail({
6654
6813
  request.requestId
6655
6814
  ))
6656
6815
  ] }) : null,
6657
- transcriptMessages.map((message, index) => /* @__PURE__ */ jsxs16(
6816
+ transcriptMessages.map((message, index) => /* @__PURE__ */ jsxs17(
6658
6817
  "div",
6659
6818
  {
6660
6819
  ref: index === lastVisitorIndex + 1 ? responseRef : void 0,
6661
6820
  className: "agent-rail__turn-block",
6662
6821
  children: [
6663
- message.role === "agent" ? message.toolResults?.map((result) => /* @__PURE__ */ jsx17(VisitorToolResultView, { result }, result.id)) : null,
6664
- /* @__PURE__ */ jsx17(
6822
+ message.role === "agent" ? message.toolResults?.map((result) => /* @__PURE__ */ jsx18(VisitorToolResultView, { result }, result.id)) : null,
6823
+ /* @__PURE__ */ jsx18(
6665
6824
  MessageBubble,
6666
6825
  {
6667
6826
  message,
@@ -6671,7 +6830,7 @@ function AgentRail({
6671
6830
  onBook
6672
6831
  }
6673
6832
  ),
6674
- index === lastAgentIndex && showMessageActions && message.role === "agent" ? /* @__PURE__ */ jsx17(
6833
+ index === lastAgentIndex && showMessageActions && message.role === "agent" ? /* @__PURE__ */ jsx18(
6675
6834
  MessageActions,
6676
6835
  {
6677
6836
  answeredAt: message.createdAt,
@@ -6683,8 +6842,8 @@ function AgentRail({
6683
6842
  onFeedback: onFeedback ? (rating) => onFeedback(rating, message) : void 0
6684
6843
  }
6685
6844
  ) : null,
6686
- index === lastVisitorIndex ? /* @__PURE__ */ jsxs16(Fragment4, { children: [
6687
- showActivity ? /* @__PURE__ */ jsx17(
6845
+ index === lastVisitorIndex ? /* @__PURE__ */ jsxs17(Fragment4, { children: [
6846
+ showActivity ? /* @__PURE__ */ jsx18(
6688
6847
  AgentActivityBubble,
6689
6848
  {
6690
6849
  brandLabel: resolvedBrandLabel,
@@ -6693,7 +6852,7 @@ function AgentRail({
6693
6852
  steps: activitySteps
6694
6853
  }
6695
6854
  ) : null,
6696
- visibleVisitorToolResults.map((result) => /* @__PURE__ */ jsx17(
6855
+ visibleVisitorToolResults.map((result) => /* @__PURE__ */ jsx18(
6697
6856
  VisitorToolResultView,
6698
6857
  {
6699
6858
  result,
@@ -6702,7 +6861,7 @@ function AgentRail({
6702
6861
  },
6703
6862
  result.id
6704
6863
  )),
6705
- pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ jsx17(
6864
+ pendingInputRequests.slice(0, 1).map((request) => /* @__PURE__ */ jsx18(
6706
6865
  HumanInputCard,
6707
6866
  {
6708
6867
  request,
@@ -6715,16 +6874,16 @@ function AgentRail({
6715
6874
  },
6716
6875
  message.role === "agent" && transcriptMessages[index - 1]?.role === "visitor" ? `answer-${transcriptMessages[index - 1]?.id}` : message.id
6717
6876
  )),
6718
- waitingForBooking ? /* @__PURE__ */ jsx17(BookingCardLoader, {}) : null,
6719
- state.error ? /* @__PURE__ */ jsxs16("section", { className: "agent-rail__error", role: "alert", children: [
6720
- /* @__PURE__ */ jsxs16("div", { children: [
6721
- /* @__PURE__ */ jsx17("strong", { children: "Something went wrong" }),
6722
- /* @__PURE__ */ jsx17("p", { children: state.error })
6877
+ waitingForBooking ? /* @__PURE__ */ jsx18(BookingCardLoader, {}) : null,
6878
+ state.error ? /* @__PURE__ */ jsxs17("section", { className: "agent-rail__error", role: "alert", children: [
6879
+ /* @__PURE__ */ jsxs17("div", { children: [
6880
+ /* @__PURE__ */ jsx18("strong", { children: "Something went wrong" }),
6881
+ /* @__PURE__ */ jsx18("p", { children: state.error })
6723
6882
  ] }),
6724
- onRetry ? /* @__PURE__ */ jsx17("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
6883
+ onRetry ? /* @__PURE__ */ jsx18("button", { type: "button", onClick: onRetry, children: "Try again" }) : null
6725
6884
  ] }) : null
6726
6885
  ] }) }),
6727
- showDisclaimerLabel ? /* @__PURE__ */ jsx17("div", { className: "agent-rail__disclaimer", children: /* @__PURE__ */ jsx17("p", { children: disclaimerLink ? /* @__PURE__ */ jsx17(
6886
+ showDisclaimerLabel ? /* @__PURE__ */ jsx18("div", { className: "agent-rail__disclaimer", children: /* @__PURE__ */ jsx18("p", { children: disclaimerLink ? /* @__PURE__ */ jsx18(
6728
6887
  "a",
6729
6888
  {
6730
6889
  href: disclaimerLink,
@@ -6733,8 +6892,16 @@ function AgentRail({
6733
6892
  children: resolvedDisclaimerLabel
6734
6893
  }
6735
6894
  ) : resolvedDisclaimerLabel }) }) : null,
6736
- /* @__PURE__ */ jsxs16("div", { className: "agent-rail__composer-wrap", children: [
6737
- showJumpToLatest ? /* @__PURE__ */ jsx17(
6895
+ /* @__PURE__ */ jsxs17("div", { className: "agent-rail__composer-wrap", children: [
6896
+ /* @__PURE__ */ jsx18(
6897
+ LocationConsent,
6898
+ {
6899
+ request: locationRequest,
6900
+ onRespond: onInputResponse
6901
+ },
6902
+ state.messages.find((message) => message.role === "visitor")?.id ?? "empty"
6903
+ ),
6904
+ showJumpToLatest ? /* @__PURE__ */ jsx18(
6738
6905
  "button",
6739
6906
  {
6740
6907
  type: "button",
@@ -6742,10 +6909,10 @@ function AgentRail({
6742
6909
  "aria-label": "Jump to the latest message",
6743
6910
  title: "Jump to the latest message",
6744
6911
  onClick: scrollToLatest,
6745
- children: /* @__PURE__ */ jsx17(ChevronDownIcon, {})
6912
+ children: /* @__PURE__ */ jsx18(ChevronDownIcon, {})
6746
6913
  }
6747
6914
  ) : null,
6748
- /* @__PURE__ */ jsx17(
6915
+ /* @__PURE__ */ jsx18(
6749
6916
  Composer,
6750
6917
  {
6751
6918
  variant: expanded || mobileFullscreen ? "dock" : "default",
@@ -6757,11 +6924,11 @@ function AgentRail({
6757
6924
  },
6758
6925
  `${state.messages.find((message) => message.role === "visitor")?.id ?? "empty"}:${latestResultId ?? ""}`
6759
6926
  ),
6760
- poweredByLabel ? /* @__PURE__ */ jsx17("div", { className: "agent-rail__footer", children: /* @__PURE__ */ jsx17("p", { children: /* @__PURE__ */ jsx17("span", { children: poweredByLabel }) }) }) : null
6927
+ poweredByLabel ? /* @__PURE__ */ jsx18("div", { className: "agent-rail__footer", children: /* @__PURE__ */ jsx18("p", { children: /* @__PURE__ */ jsx18("span", { children: poweredByLabel }) }) }) : null
6761
6928
  ] })
6762
6929
  ] }),
6763
- /* @__PURE__ */ jsx17("div", { ref: overlayRef, className: "agent-rail__overlay" }),
6764
- receiptOpen && receiptSteps ? /* @__PURE__ */ jsx17(
6930
+ /* @__PURE__ */ jsx18("div", { ref: overlayRef, className: "agent-rail__overlay" }),
6931
+ receiptOpen && receiptSteps ? /* @__PURE__ */ jsx18(
6765
6932
  AnswerReceiptDialog,
6766
6933
  {
6767
6934
  brandLabel: resolvedBrandLabel,
@@ -6777,10 +6944,10 @@ function AgentRail({
6777
6944
  }
6778
6945
 
6779
6946
  // src/react/components/AssistEdgeTab/AssistEdgeTab.tsx
6780
- import { useState as useState10 } from "react";
6781
- import { Fragment as Fragment5, jsx as jsx18, jsxs as jsxs17 } from "react/jsx-runtime";
6947
+ import { useState as useState11 } from "react";
6948
+ import { Fragment as Fragment5, jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
6782
6949
  function ChatSparkIcon() {
6783
- return /* @__PURE__ */ jsxs17(
6950
+ return /* @__PURE__ */ jsxs18(
6784
6951
  "svg",
6785
6952
  {
6786
6953
  className: "assist-edge-tab__chat-spark",
@@ -6788,7 +6955,7 @@ function ChatSparkIcon() {
6788
6955
  fill: "none",
6789
6956
  "aria-hidden": "true",
6790
6957
  children: [
6791
- /* @__PURE__ */ jsx18(
6958
+ /* @__PURE__ */ jsx19(
6792
6959
  "path",
6793
6960
  {
6794
6961
  className: "assist-edge-tab__spark assist-edge-tab__spark--a",
@@ -6796,7 +6963,7 @@ function ChatSparkIcon() {
6796
6963
  fill: "currentColor"
6797
6964
  }
6798
6965
  ),
6799
- /* @__PURE__ */ jsx18(
6966
+ /* @__PURE__ */ jsx19(
6800
6967
  "path",
6801
6968
  {
6802
6969
  className: "assist-edge-tab__spark assist-edge-tab__spark--b",
@@ -6804,8 +6971,8 @@ function ChatSparkIcon() {
6804
6971
  fill: "currentColor"
6805
6972
  }
6806
6973
  ),
6807
- /* @__PURE__ */ jsxs17("g", { className: "assist-edge-tab__bot", children: [
6808
- /* @__PURE__ */ jsx18(
6974
+ /* @__PURE__ */ jsxs18("g", { className: "assist-edge-tab__bot", children: [
6975
+ /* @__PURE__ */ jsx19(
6809
6976
  "path",
6810
6977
  {
6811
6978
  d: "M11.15 5.2V3.05",
@@ -6814,8 +6981,8 @@ function ChatSparkIcon() {
6814
6981
  strokeLinecap: "round"
6815
6982
  }
6816
6983
  ),
6817
- /* @__PURE__ */ jsx18("circle", { cx: "11.15", cy: "2.45", r: "0.85", fill: "currentColor" }),
6818
- /* @__PURE__ */ jsx18(
6984
+ /* @__PURE__ */ jsx19("circle", { cx: "11.15", cy: "2.45", r: "0.85", fill: "currentColor" }),
6985
+ /* @__PURE__ */ jsx19(
6819
6986
  "rect",
6820
6987
  {
6821
6988
  x: "3.55",
@@ -6827,7 +6994,7 @@ function ChatSparkIcon() {
6827
6994
  strokeWidth: "1.9"
6828
6995
  }
6829
6996
  ),
6830
- /* @__PURE__ */ jsx18(
6997
+ /* @__PURE__ */ jsx19(
6831
6998
  "circle",
6832
6999
  {
6833
7000
  className: "assist-edge-tab__eye",
@@ -6837,7 +7004,7 @@ function ChatSparkIcon() {
6837
7004
  fill: "currentColor"
6838
7005
  }
6839
7006
  ),
6840
- /* @__PURE__ */ jsx18(
7007
+ /* @__PURE__ */ jsx19(
6841
7008
  "circle",
6842
7009
  {
6843
7010
  className: "assist-edge-tab__eye assist-edge-tab__eye--r",
@@ -6858,10 +7025,10 @@ function TabMarkIcon({
6858
7025
  }) {
6859
7026
  const custom = customIconUrl?.trim();
6860
7027
  const logo = logoUrl?.trim();
6861
- const [customFailed, setCustomFailed] = useState10(false);
6862
- const [logoFailed, setLogoFailed] = useState10(false);
7028
+ const [customFailed, setCustomFailed] = useState11(false);
7029
+ const [logoFailed, setLogoFailed] = useState11(false);
6863
7030
  if (custom && !customFailed) {
6864
- return /* @__PURE__ */ jsx18(
7031
+ return /* @__PURE__ */ jsx19(
6865
7032
  "img",
6866
7033
  {
6867
7034
  alt: "",
@@ -6873,7 +7040,7 @@ function TabMarkIcon({
6873
7040
  );
6874
7041
  }
6875
7042
  if (logo && !logoFailed) {
6876
- return /* @__PURE__ */ jsx18(
7043
+ return /* @__PURE__ */ jsx19(
6877
7044
  "img",
6878
7045
  {
6879
7046
  alt: "",
@@ -6884,10 +7051,10 @@ function TabMarkIcon({
6884
7051
  }
6885
7052
  );
6886
7053
  }
6887
- return /* @__PURE__ */ jsx18(ChatSparkIcon, {});
7054
+ return /* @__PURE__ */ jsx19(ChatSparkIcon, {});
6888
7055
  }
6889
7056
  function ChevronLeftIcon() {
6890
- return /* @__PURE__ */ jsx18("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
7057
+ return /* @__PURE__ */ jsx19("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx19(
6891
7058
  "path",
6892
7059
  {
6893
7060
  d: "M10 4L6 8l4 4",
@@ -6899,7 +7066,7 @@ function ChevronLeftIcon() {
6899
7066
  ) });
6900
7067
  }
6901
7068
  function ChevronDownIcon2() {
6902
- return /* @__PURE__ */ jsx18("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
7069
+ return /* @__PURE__ */ jsx19("svg", { viewBox: "0 0 16 16", fill: "none", "aria-hidden": "true", children: /* @__PURE__ */ jsx19(
6903
7070
  "path",
6904
7071
  {
6905
7072
  d: "M4 6l4 4 4-4",
@@ -6911,7 +7078,7 @@ function ChevronDownIcon2() {
6911
7078
  ) });
6912
7079
  }
6913
7080
  function DragDots() {
6914
- return /* @__PURE__ */ jsx18("span", { className: "assist-edge-tab__dots", "aria-hidden": "true", children: Array.from({ length: 12 }, (_, index) => /* @__PURE__ */ jsx18("i", {}, index)) });
7081
+ return /* @__PURE__ */ jsx19("span", { className: "assist-edge-tab__dots", "aria-hidden": "true", children: Array.from({ length: 12 }, (_, index) => /* @__PURE__ */ jsx19("i", {}, index)) });
6915
7082
  }
6916
7083
  var VARIANT_COPY = {
6917
7084
  outline: { label: "Ask anything", aria: "Ask anything" },
@@ -6966,7 +7133,7 @@ function AssistEdgeTab({
6966
7133
  ...!pill && resolvedTextColor ? { "--as-text": resolvedTextColor } : {},
6967
7134
  colorScheme: chromeScheme
6968
7135
  };
6969
- return /* @__PURE__ */ jsxs17(
7136
+ return /* @__PURE__ */ jsxs18(
6970
7137
  "button",
6971
7138
  {
6972
7139
  type: "button",
@@ -6978,13 +7145,13 @@ function AssistEdgeTab({
6978
7145
  tabIndex: visible ? 0 : -1,
6979
7146
  onClick: onOpen,
6980
7147
  children: [
6981
- pill ? /* @__PURE__ */ jsxs17(Fragment5, { children: [
6982
- /* @__PURE__ */ jsx18(
7148
+ pill ? /* @__PURE__ */ jsxs18(Fragment5, { children: [
7149
+ /* @__PURE__ */ jsx19(
6983
7150
  "span",
6984
7151
  {
6985
7152
  className: `assist-edge-tab__mark assist-edge-tab__mark--chip${mobile ? " assist-edge-tab__mark--mobile" : ""}`,
6986
7153
  "aria-hidden": "true",
6987
- children: /* @__PURE__ */ jsx18(
7154
+ children: /* @__PURE__ */ jsx19(
6988
7155
  TabMarkIcon,
6989
7156
  {
6990
7157
  customIconUrl,
@@ -6994,12 +7161,12 @@ function AssistEdgeTab({
6994
7161
  )
6995
7162
  }
6996
7163
  ),
6997
- /* @__PURE__ */ jsxs17("span", { className: "assist-edge-tab__text", children: [
6998
- /* @__PURE__ */ jsx18("span", { className: "assist-edge-tab__label", children: visibleLabel }),
6999
- visibleSubLabel ? /* @__PURE__ */ jsx18("span", { className: "assist-edge-tab__sublabel", children: visibleSubLabel }) : null
7164
+ /* @__PURE__ */ jsxs18("span", { className: "assist-edge-tab__text", children: [
7165
+ /* @__PURE__ */ jsx19("span", { className: "assist-edge-tab__label", children: visibleLabel }),
7166
+ visibleSubLabel ? /* @__PURE__ */ jsx19("span", { className: "assist-edge-tab__sublabel", children: visibleSubLabel }) : null
7000
7167
  ] })
7001
- ] }) : variant === "outline" ? /* @__PURE__ */ jsxs17(Fragment5, { children: [
7002
- /* @__PURE__ */ jsx18("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
7168
+ ] }) : variant === "outline" ? /* @__PURE__ */ jsxs18(Fragment5, { children: [
7169
+ /* @__PURE__ */ jsx19("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: /* @__PURE__ */ jsx19(
7003
7170
  TabMarkIcon,
7004
7171
  {
7005
7172
  customIconUrl,
@@ -7007,16 +7174,16 @@ function AssistEdgeTab({
7007
7174
  },
7008
7175
  markSourceKey
7009
7176
  ) }),
7010
- /* @__PURE__ */ jsx18("span", { className: "assist-edge-tab__label", children: visibleLabel }),
7011
- /* @__PURE__ */ jsx18(ChevronDownIcon2, {})
7177
+ /* @__PURE__ */ jsx19("span", { className: "assist-edge-tab__label", children: visibleLabel }),
7178
+ /* @__PURE__ */ jsx19(ChevronDownIcon2, {})
7012
7179
  ] }) : null,
7013
- !pill && variant === "ask" ? /* @__PURE__ */ jsxs17(Fragment5, { children: [
7014
- /* @__PURE__ */ jsx18(ChevronLeftIcon, {}),
7015
- /* @__PURE__ */ jsx18("span", { className: "assist-edge-tab__label", children: visibleLabel }),
7016
- /* @__PURE__ */ jsx18(DragDots, {})
7180
+ !pill && variant === "ask" ? /* @__PURE__ */ jsxs18(Fragment5, { children: [
7181
+ /* @__PURE__ */ jsx19(ChevronLeftIcon, {}),
7182
+ /* @__PURE__ */ jsx19("span", { className: "assist-edge-tab__label", children: visibleLabel }),
7183
+ /* @__PURE__ */ jsx19(DragDots, {})
7017
7184
  ] }) : null,
7018
- !pill && variant === "fill" ? /* @__PURE__ */ jsxs17(Fragment5, { children: [
7019
- /* @__PURE__ */ jsx18("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: /* @__PURE__ */ jsx18(
7185
+ !pill && variant === "fill" ? /* @__PURE__ */ jsxs18(Fragment5, { children: [
7186
+ /* @__PURE__ */ jsx19("span", { className: "assist-edge-tab__mark", "aria-hidden": "true", children: /* @__PURE__ */ jsx19(
7020
7187
  TabMarkIcon,
7021
7188
  {
7022
7189
  customIconUrl,
@@ -7024,8 +7191,8 @@ function AssistEdgeTab({
7024
7191
  },
7025
7192
  markSourceKey
7026
7193
  ) }),
7027
- /* @__PURE__ */ jsx18("span", { className: "assist-edge-tab__label", children: visibleLabel }),
7028
- /* @__PURE__ */ jsx18(ChevronLeftIcon, {})
7194
+ /* @__PURE__ */ jsx19("span", { className: "assist-edge-tab__label", children: visibleLabel }),
7195
+ /* @__PURE__ */ jsx19(ChevronLeftIcon, {})
7029
7196
  ] }) : null
7030
7197
  ]
7031
7198
  }
@@ -7089,10 +7256,10 @@ function sendAgentAnswerFeedback(eventUrl, event) {
7089
7256
  }
7090
7257
 
7091
7258
  // src/react/components/AgentWidget/AgentWidget.tsx
7092
- import { useEffect as useEffect9, useRef as useRef7, useState as useState12 } from "react";
7259
+ import { useEffect as useEffect10, useRef as useRef8, useState as useState13 } from "react";
7093
7260
 
7094
7261
  // src/react/page-shift.ts
7095
- import { useEffect as useEffect7 } from "react";
7262
+ import { useEffect as useEffect8 } from "react";
7096
7263
  var PAGE_SHIFT_CLASS = "webless-agent-page-shift";
7097
7264
  var DEFAULT_RAIL_WIDTH_PX = 450;
7098
7265
  function shouldApplyPageShift(input) {
@@ -7144,7 +7311,7 @@ function clearPageMargin() {
7144
7311
  }
7145
7312
  function usePageShift(input) {
7146
7313
  const { active, railSlotRef } = input;
7147
- useEffect7(() => {
7314
+ useEffect8(() => {
7148
7315
  if (typeof document === "undefined") {
7149
7316
  return;
7150
7317
  }
@@ -7172,12 +7339,12 @@ function usePageShift(input) {
7172
7339
  }
7173
7340
 
7174
7341
  // src/react/hooks/useIsMobile.ts
7175
- import { useEffect as useEffect8, useState as useState11 } from "react";
7342
+ import { useEffect as useEffect9, useState as useState12 } from "react";
7176
7343
  function useIsMobile(breakpoint = 767) {
7177
- const [isMobile, setIsMobile] = useState11(
7344
+ const [isMobile, setIsMobile] = useState12(
7178
7345
  () => typeof window !== "undefined" && window.matchMedia(`(max-width: ${breakpoint}px)`).matches
7179
7346
  );
7180
- useEffect8(() => {
7347
+ useEffect9(() => {
7181
7348
  const media = window.matchMedia(`(max-width: ${breakpoint}px)`);
7182
7349
  const onChange = () => setIsMobile(media.matches);
7183
7350
  onChange();
@@ -7188,7 +7355,7 @@ function useIsMobile(breakpoint = 767) {
7188
7355
  }
7189
7356
 
7190
7357
  // src/react/components/AgentWidget/AgentWidget.tsx
7191
- import { jsx as jsx19, jsxs as jsxs18 } from "react/jsx-runtime";
7358
+ import { jsx as jsx20, jsxs as jsxs19 } from "react/jsx-runtime";
7192
7359
  function AgentWidget({
7193
7360
  indexId,
7194
7361
  customerId,
@@ -7207,9 +7374,9 @@ function AgentWidget({
7207
7374
  }) {
7208
7375
  const isMobile = useIsMobile();
7209
7376
  const placement = normalizeAgentPlacement(placementInput);
7210
- const railSlotRef = useRef7(null);
7211
- const [railCollapsed, setRailCollapsed] = useState12(defaultCollapsed);
7212
- const [railExpanded, setRailExpanded] = useState12(false);
7377
+ const railSlotRef = useRef8(null);
7378
+ const [railCollapsed, setRailCollapsed] = useState13(defaultCollapsed);
7379
+ const [railExpanded, setRailExpanded] = useState13(false);
7213
7380
  const pageShiftActive = shouldApplyPageShift({
7214
7381
  pageShift,
7215
7382
  isMobile,
@@ -7262,7 +7429,7 @@ function AgentWidget({
7262
7429
  } : {},
7263
7430
  ...branding?.colors?.border ? { border: branding.colors.border } : {}
7264
7431
  };
7265
- useEffect9(() => {
7432
+ useEffect10(() => {
7266
7433
  if (!registerPanelController) return;
7267
7434
  registerAgentPanelController(customerId, {
7268
7435
  open: () => setRailCollapsed(false),
@@ -7297,7 +7464,7 @@ function AgentWidget({
7297
7464
  })
7298
7465
  );
7299
7466
  }
7300
- useEffect9(() => {
7467
+ useEffect10(() => {
7301
7468
  if (railCollapsed) return;
7302
7469
  const handleKeyDown = (event) => {
7303
7470
  if (event.key === "Tab" && (isMobile || railExpanded)) {
@@ -7331,19 +7498,19 @@ function AgentWidget({
7331
7498
  window.addEventListener("keydown", handleKeyDown);
7332
7499
  return () => window.removeEventListener("keydown", handleKeyDown);
7333
7500
  }, [isMobile, railCollapsed, railExpanded]);
7334
- return /* @__PURE__ */ jsxs18("div", { className: "webless-agent-root", children: [
7335
- /* @__PURE__ */ jsx19(
7501
+ return /* @__PURE__ */ jsxs19("div", { className: "webless-agent-root", children: [
7502
+ /* @__PURE__ */ jsx20(
7336
7503
  "div",
7337
7504
  {
7338
7505
  className: `webless-agent-root__shell${railCollapsed ? " webless-agent-root__shell--collapsed" : ""}${railExpanded ? " webless-agent-root__shell--expanded" : ""}`,
7339
- children: /* @__PURE__ */ jsx19(
7506
+ children: /* @__PURE__ */ jsx20(
7340
7507
  "div",
7341
7508
  {
7342
7509
  ref: railSlotRef,
7343
7510
  className: "webless-agent-root__rail-slot",
7344
7511
  inert: railCollapsed || void 0,
7345
7512
  "aria-hidden": railCollapsed,
7346
- children: /* @__PURE__ */ jsx19(
7513
+ children: /* @__PURE__ */ jsx20(
7347
7514
  AgentRail,
7348
7515
  {
7349
7516
  theme,
@@ -7380,7 +7547,7 @@ function AgentWidget({
7380
7547
  )
7381
7548
  }
7382
7549
  ),
7383
- railCollapsed ? /* @__PURE__ */ jsx19(
7550
+ railCollapsed ? /* @__PURE__ */ jsx20(
7384
7551
  AssistEdgeTab,
7385
7552
  {
7386
7553
  variant: placement.variant,
@@ -7441,4 +7608,4 @@ export {
7441
7608
  sendAgentAnswerFeedback,
7442
7609
  AgentWidget
7443
7610
  };
7444
- //# sourceMappingURL=chunk-74CSWSC5.js.map
7611
+ //# sourceMappingURL=chunk-NW37MHU7.js.map