@helpai/elements 0.50.1 → 0.50.3
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/elements-web-component.esm.js +18 -18
- package/elements-web-component.esm.js.map +3 -3
- package/elements.cjs.js +18 -18
- package/elements.cjs.js.map +3 -3
- package/elements.esm.js +18 -18
- package/elements.esm.js.map +3 -3
- package/elements.js +18 -18
- package/elements.js.map +3 -3
- package/index.mjs +13 -15
- package/package.json +1 -1
- package/web-component.mjs +13 -15
package/index.mjs
CHANGED
|
@@ -29,7 +29,7 @@ var BRAND = {
|
|
|
29
29
|
};
|
|
30
30
|
|
|
31
31
|
// src/core/version.ts
|
|
32
|
-
var ELEMENTS_VERSION = true ? "0.50.
|
|
32
|
+
var ELEMENTS_VERSION = true ? "0.50.3" : "0.0.0-dev";
|
|
33
33
|
var ELEMENTS_VERSION_PARAM = "_ev";
|
|
34
34
|
|
|
35
35
|
// src/i18n/strings.ts
|
|
@@ -2016,7 +2016,8 @@ function buildSendMessageRequest(params) {
|
|
|
2016
2016
|
conversationId: params.conversationId,
|
|
2017
2017
|
trigger: params.trigger ?? "submit-message"
|
|
2018
2018
|
};
|
|
2019
|
-
|
|
2019
|
+
const anchorId = wire.at(-1)?.id;
|
|
2020
|
+
if (anchorId) body.messageId = anchorId;
|
|
2020
2021
|
if (params.visitorId) body.visitorId = params.visitorId;
|
|
2021
2022
|
if (params.userPrefs) body.userPrefs = params.userPrefs;
|
|
2022
2023
|
const tools = params.tools?.map(normalizeToolRef).filter((t) => t !== null);
|
|
@@ -5281,6 +5282,11 @@ function toolName(raw) {
|
|
|
5281
5282
|
if (raw.startsWith("tool-")) return raw.slice(5);
|
|
5282
5283
|
return raw;
|
|
5283
5284
|
}
|
|
5285
|
+
function toolDecisionState(state, approval) {
|
|
5286
|
+
const terminal = state === "output-available" || state === "output-error" || state === "output-denied";
|
|
5287
|
+
const responded = state === "approval-responded" || approval?.approved !== void 0;
|
|
5288
|
+
return { terminal, responded, decided: terminal || responded };
|
|
5289
|
+
}
|
|
5284
5290
|
function statusOf(state, approval) {
|
|
5285
5291
|
if (state === "output-error") return "error";
|
|
5286
5292
|
if (state === "output-denied" || approval?.approved === false) return "denied";
|
|
@@ -5371,9 +5377,7 @@ function ToolApproval({ part, strings, active, onDecision, onEdit }) {
|
|
|
5371
5377
|
const error = useComputed2(() => part.errorSig.value);
|
|
5372
5378
|
const name = toolName(part.toolName);
|
|
5373
5379
|
const approved = approval.value?.approved;
|
|
5374
|
-
const responded
|
|
5375
|
-
const terminal = state.value === "output-available" || state.value === "output-error" || state.value === "output-denied";
|
|
5376
|
-
const decided = responded || terminal;
|
|
5380
|
+
const { terminal, responded, decided } = toolDecisionState(state.value, approval.value);
|
|
5377
5381
|
const editable = responded && active && !terminal;
|
|
5378
5382
|
const id = part.toolCallId;
|
|
5379
5383
|
return /* @__PURE__ */ jsxs12("div", { class: `${p14}-toolui-group`, "data-testid": decided ? TID.toolDecision : TID.toolApproval, children: [
|
|
@@ -5496,9 +5500,7 @@ function ToolAskInput({ part, strings, active, onSubmit, onDecision, onEdit }) {
|
|
|
5496
5500
|
const state = useComputed3(() => part.stateSig.value);
|
|
5497
5501
|
const approval = useComputed3(() => part.approvalSig.value);
|
|
5498
5502
|
const request = useComputed3(() => parseAskUserInput(part.inputSig.value));
|
|
5499
|
-
const terminal
|
|
5500
|
-
const responded = state.value === "approval-responded" || approval.value?.approved !== void 0;
|
|
5501
|
-
const decided = terminal || responded;
|
|
5503
|
+
const { terminal, responded, decided } = toolDecisionState(state.value, approval.value);
|
|
5502
5504
|
const viaApproval = approval.value !== void 0;
|
|
5503
5505
|
const resolve = (answer, accepted) => {
|
|
5504
5506
|
if (viaApproval) onDecision(part.toolCallId, accepted, answer);
|
|
@@ -5603,7 +5605,7 @@ function DecidedCard({
|
|
|
5603
5605
|
const output = useComputed3(() => part.outputSig.value);
|
|
5604
5606
|
const approval = useComputed3(() => part.approvalSig.value);
|
|
5605
5607
|
const skipped = approval.value?.approved === false;
|
|
5606
|
-
const answer = approval.value?.approved !== void 0 ? approval.value.reason ?? "" : summarizeOutput(output.value);
|
|
5608
|
+
const answer = approval.value?.approved !== void 0 ? approval.value.reason ?? "" : summarizeOutput(output.value, strings);
|
|
5607
5609
|
return /* @__PURE__ */ jsxs13("div", { class: `${p15}-toolui`, "data-testid": TID.toolDecision, children: [
|
|
5608
5610
|
/* @__PURE__ */ jsxs13("div", { class: `${p15}-toolui-head`, children: [
|
|
5609
5611
|
/* @__PURE__ */ jsx16("span", { class: `${p15}-toolui-badge ${p15}-toolui-badge-accent`, children: strings.inputBadge }),
|
|
@@ -5615,12 +5617,12 @@ function DecidedCard({
|
|
|
5615
5617
|
editable ? /* @__PURE__ */ jsx16("div", { class: `${p15}-toolui-actions`, children: /* @__PURE__ */ jsx16("button", { type: "button", class: `${p15}-form-skip`, onClick: onEdit, "data-testid": TID.toolEdit, children: strings.edit }) }) : null
|
|
5616
5618
|
] });
|
|
5617
5619
|
}
|
|
5618
|
-
function summarizeOutput(output) {
|
|
5620
|
+
function summarizeOutput(output, strings) {
|
|
5619
5621
|
if (output == null) return "";
|
|
5620
5622
|
if (typeof output === "string") return output;
|
|
5621
5623
|
if (typeof output === "object") {
|
|
5622
5624
|
const rec = output;
|
|
5623
|
-
if ("confirmed" in rec) return rec.confirmed ?
|
|
5625
|
+
if ("confirmed" in rec) return rec.confirmed ? strings.confirmYes : strings.confirmNo;
|
|
5624
5626
|
if (typeof rec.responseText === "string" && rec.responseText) return rec.responseText;
|
|
5625
5627
|
return Object.values(rec).filter((v) => typeof v === "string" || typeof v === "number").join(", ");
|
|
5626
5628
|
}
|
|
@@ -7949,10 +7951,6 @@ function App({ options, hostElement, bus }) {
|
|
|
7949
7951
|
const body = buildSendMessageRequest({
|
|
7950
7952
|
messages: thread.map(fromReactive),
|
|
7951
7953
|
conversationId: activeConversationId,
|
|
7952
|
-
// The assistant message being generated / resumed — prefer the id the
|
|
7953
|
-
// backend assigned (adopted from the `start` chunk) so a HITL re-POST
|
|
7954
|
-
// resumes the message the backend persisted, not the client-minted id.
|
|
7955
|
-
messageId: assistantMsg.serverMessageId ?? assistantMsg.id,
|
|
7956
7954
|
// textModel + imageModel are backend-only — selected per deployment.
|
|
7957
7955
|
tools: options.features.tools,
|
|
7958
7956
|
// Identity + preferences ride on every message — server may need
|
package/package.json
CHANGED
package/web-component.mjs
CHANGED
|
@@ -1794,7 +1794,7 @@ function createAuth(opts) {
|
|
|
1794
1794
|
}
|
|
1795
1795
|
|
|
1796
1796
|
// src/core/version.ts
|
|
1797
|
-
var ELEMENTS_VERSION = true ? "0.50.
|
|
1797
|
+
var ELEMENTS_VERSION = true ? "0.50.3" : "0.0.0-dev";
|
|
1798
1798
|
var ELEMENTS_VERSION_PARAM = "_ev";
|
|
1799
1799
|
|
|
1800
1800
|
// src/stream/types.ts
|
|
@@ -1975,7 +1975,8 @@ function buildSendMessageRequest(params) {
|
|
|
1975
1975
|
conversationId: params.conversationId,
|
|
1976
1976
|
trigger: params.trigger ?? "submit-message"
|
|
1977
1977
|
};
|
|
1978
|
-
|
|
1978
|
+
const anchorId = wire.at(-1)?.id;
|
|
1979
|
+
if (anchorId) body.messageId = anchorId;
|
|
1979
1980
|
if (params.visitorId) body.visitorId = params.visitorId;
|
|
1980
1981
|
if (params.userPrefs) body.userPrefs = params.userPrefs;
|
|
1981
1982
|
const tools = params.tools?.map(normalizeToolRef).filter((t) => t !== null);
|
|
@@ -5240,6 +5241,11 @@ function toolName(raw) {
|
|
|
5240
5241
|
if (raw.startsWith("tool-")) return raw.slice(5);
|
|
5241
5242
|
return raw;
|
|
5242
5243
|
}
|
|
5244
|
+
function toolDecisionState(state, approval) {
|
|
5245
|
+
const terminal = state === "output-available" || state === "output-error" || state === "output-denied";
|
|
5246
|
+
const responded = state === "approval-responded" || approval?.approved !== void 0;
|
|
5247
|
+
return { terminal, responded, decided: terminal || responded };
|
|
5248
|
+
}
|
|
5243
5249
|
function statusOf(state, approval) {
|
|
5244
5250
|
if (state === "output-error") return "error";
|
|
5245
5251
|
if (state === "output-denied" || approval?.approved === false) return "denied";
|
|
@@ -5330,9 +5336,7 @@ function ToolApproval({ part, strings, active, onDecision, onEdit }) {
|
|
|
5330
5336
|
const error = useComputed2(() => part.errorSig.value);
|
|
5331
5337
|
const name = toolName(part.toolName);
|
|
5332
5338
|
const approved = approval.value?.approved;
|
|
5333
|
-
const responded
|
|
5334
|
-
const terminal = state.value === "output-available" || state.value === "output-error" || state.value === "output-denied";
|
|
5335
|
-
const decided = responded || terminal;
|
|
5339
|
+
const { terminal, responded, decided } = toolDecisionState(state.value, approval.value);
|
|
5336
5340
|
const editable = responded && active && !terminal;
|
|
5337
5341
|
const id = part.toolCallId;
|
|
5338
5342
|
return /* @__PURE__ */ jsxs12("div", { class: `${p14}-toolui-group`, "data-testid": decided ? TID.toolDecision : TID.toolApproval, children: [
|
|
@@ -5455,9 +5459,7 @@ function ToolAskInput({ part, strings, active, onSubmit, onDecision, onEdit }) {
|
|
|
5455
5459
|
const state = useComputed3(() => part.stateSig.value);
|
|
5456
5460
|
const approval = useComputed3(() => part.approvalSig.value);
|
|
5457
5461
|
const request = useComputed3(() => parseAskUserInput(part.inputSig.value));
|
|
5458
|
-
const terminal
|
|
5459
|
-
const responded = state.value === "approval-responded" || approval.value?.approved !== void 0;
|
|
5460
|
-
const decided = terminal || responded;
|
|
5462
|
+
const { terminal, responded, decided } = toolDecisionState(state.value, approval.value);
|
|
5461
5463
|
const viaApproval = approval.value !== void 0;
|
|
5462
5464
|
const resolve = (answer, accepted) => {
|
|
5463
5465
|
if (viaApproval) onDecision(part.toolCallId, accepted, answer);
|
|
@@ -5562,7 +5564,7 @@ function DecidedCard({
|
|
|
5562
5564
|
const output = useComputed3(() => part.outputSig.value);
|
|
5563
5565
|
const approval = useComputed3(() => part.approvalSig.value);
|
|
5564
5566
|
const skipped = approval.value?.approved === false;
|
|
5565
|
-
const answer = approval.value?.approved !== void 0 ? approval.value.reason ?? "" : summarizeOutput(output.value);
|
|
5567
|
+
const answer = approval.value?.approved !== void 0 ? approval.value.reason ?? "" : summarizeOutput(output.value, strings);
|
|
5566
5568
|
return /* @__PURE__ */ jsxs13("div", { class: `${p15}-toolui`, "data-testid": TID.toolDecision, children: [
|
|
5567
5569
|
/* @__PURE__ */ jsxs13("div", { class: `${p15}-toolui-head`, children: [
|
|
5568
5570
|
/* @__PURE__ */ jsx16("span", { class: `${p15}-toolui-badge ${p15}-toolui-badge-accent`, children: strings.inputBadge }),
|
|
@@ -5574,12 +5576,12 @@ function DecidedCard({
|
|
|
5574
5576
|
editable ? /* @__PURE__ */ jsx16("div", { class: `${p15}-toolui-actions`, children: /* @__PURE__ */ jsx16("button", { type: "button", class: `${p15}-form-skip`, onClick: onEdit, "data-testid": TID.toolEdit, children: strings.edit }) }) : null
|
|
5575
5577
|
] });
|
|
5576
5578
|
}
|
|
5577
|
-
function summarizeOutput(output) {
|
|
5579
|
+
function summarizeOutput(output, strings) {
|
|
5578
5580
|
if (output == null) return "";
|
|
5579
5581
|
if (typeof output === "string") return output;
|
|
5580
5582
|
if (typeof output === "object") {
|
|
5581
5583
|
const rec = output;
|
|
5582
|
-
if ("confirmed" in rec) return rec.confirmed ?
|
|
5584
|
+
if ("confirmed" in rec) return rec.confirmed ? strings.confirmYes : strings.confirmNo;
|
|
5583
5585
|
if (typeof rec.responseText === "string" && rec.responseText) return rec.responseText;
|
|
5584
5586
|
return Object.values(rec).filter((v) => typeof v === "string" || typeof v === "number").join(", ");
|
|
5585
5587
|
}
|
|
@@ -7908,10 +7910,6 @@ function App({ options, hostElement, bus }) {
|
|
|
7908
7910
|
const body = buildSendMessageRequest({
|
|
7909
7911
|
messages: thread.map(fromReactive),
|
|
7910
7912
|
conversationId: activeConversationId,
|
|
7911
|
-
// The assistant message being generated / resumed — prefer the id the
|
|
7912
|
-
// backend assigned (adopted from the `start` chunk) so a HITL re-POST
|
|
7913
|
-
// resumes the message the backend persisted, not the client-minted id.
|
|
7914
|
-
messageId: assistantMsg.serverMessageId ?? assistantMsg.id,
|
|
7915
7913
|
// textModel + imageModel are backend-only — selected per deployment.
|
|
7916
7914
|
tools: options.features.tools,
|
|
7917
7915
|
// Identity + preferences ride on every message — server may need
|