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