@helpai/elements 0.50.0 → 0.50.2
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.d.ts +4 -5
- package/index.mjs +16 -18
- package/package.json +1 -1
- package/web-component.mjs +16 -18
package/index.d.ts
CHANGED
|
@@ -1286,10 +1286,9 @@ interface ServerConfig {
|
|
|
1286
1286
|
* `?helpai-debug=trace`, or the `options.debug` mount param all
|
|
1287
1287
|
* converge on the same internal level. Persisted to
|
|
1288
1288
|
* `localStorage["helpai.debug"]` so a refresh keeps visibility.
|
|
1289
|
-
* • Co-hosted
|
|
1290
|
-
*
|
|
1291
|
-
*
|
|
1292
|
-
* transcripts.
|
|
1289
|
+
* • Co-hosted safety — every signal (query, global key, log tag) is
|
|
1290
|
+
* brand-prefixed so two widgets on the same page don't fight over
|
|
1291
|
+
* flags or pollute each other's transcripts.
|
|
1293
1292
|
*/
|
|
1294
1293
|
type LogLevel = "off" | "error" | "warn" | "info" | "debug" | "trace";
|
|
1295
1294
|
/** One structured line, as forwarded to an external {@link setLogSink} sink. */
|
|
@@ -1575,7 +1574,7 @@ type HookListener = (instance: ChatWidgetInstance, event: EventName, data: unkno
|
|
|
1575
1574
|
*
|
|
1576
1575
|
* @example
|
|
1577
1576
|
* ```ts
|
|
1578
|
-
* import { mount } from '@helpai/elements';
|
|
1577
|
+
* import { mount } from '@helpai/elements';
|
|
1579
1578
|
*
|
|
1580
1579
|
* const chat = mount({
|
|
1581
1580
|
* publicKey: 'agent_pk_...',
|
package/index.mjs
CHANGED
|
@@ -10,9 +10,8 @@ var BRAND = {
|
|
|
10
10
|
id: true ? "help-ai" : "help-ai",
|
|
11
11
|
name: true ? "@helpai/elements" : "Help AI",
|
|
12
12
|
global: true ? "HelpAI" : "HelpAI",
|
|
13
|
-
// Custom-element tag — `web-ai-chat
|
|
14
|
-
//
|
|
15
|
-
// and @goai builds.
|
|
13
|
+
// Custom-element tag — `web-ai-chat`. Brand-neutral by design so docs
|
|
14
|
+
// and copy snippets stay stable regardless of which brand is built.
|
|
16
15
|
tagName: true ? "web-ai-chat" : "web-ai-chat",
|
|
17
16
|
cssPrefix: true ? "helpai" : "helpai",
|
|
18
17
|
/**
|
|
@@ -21,16 +20,16 @@ var BRAND = {
|
|
|
21
20
|
* `${defaultBaseUrl}/api/data`.
|
|
22
21
|
*/
|
|
23
22
|
defaultBaseUrl: true ? "https://help.ai" : "",
|
|
24
|
-
/** Public-facing brand label, e.g. "Help AI"
|
|
23
|
+
/** Public-facing brand label, e.g. "Help AI". */
|
|
25
24
|
displayName: true ? "Help AI" : "Help AI",
|
|
26
|
-
/** Bare host without protocol, e.g. "help.ai"
|
|
25
|
+
/** Bare host without protocol, e.g. "help.ai". */
|
|
27
26
|
domain: true ? "help.ai" : "help.ai",
|
|
28
27
|
/** Full marketing site URL, e.g. "https://help.ai". */
|
|
29
28
|
siteUrl: true ? "https://help.ai" : "https://help.ai"
|
|
30
29
|
};
|
|
31
30
|
|
|
32
31
|
// src/core/version.ts
|
|
33
|
-
var ELEMENTS_VERSION = true ? "0.50.
|
|
32
|
+
var ELEMENTS_VERSION = true ? "0.50.2" : "0.0.0-dev";
|
|
34
33
|
var ELEMENTS_VERSION_PARAM = "_ev";
|
|
35
34
|
|
|
36
35
|
// src/i18n/strings.ts
|
|
@@ -5282,6 +5281,11 @@ function toolName(raw) {
|
|
|
5282
5281
|
if (raw.startsWith("tool-")) return raw.slice(5);
|
|
5283
5282
|
return raw;
|
|
5284
5283
|
}
|
|
5284
|
+
function toolDecisionState(state, approval) {
|
|
5285
|
+
const terminal = state === "output-available" || state === "output-error" || state === "output-denied";
|
|
5286
|
+
const responded = state === "approval-responded" || approval?.approved !== void 0;
|
|
5287
|
+
return { terminal, responded, decided: terminal || responded };
|
|
5288
|
+
}
|
|
5285
5289
|
function statusOf(state, approval) {
|
|
5286
5290
|
if (state === "output-error") return "error";
|
|
5287
5291
|
if (state === "output-denied" || approval?.approved === false) return "denied";
|
|
@@ -5372,9 +5376,7 @@ function ToolApproval({ part, strings, active, onDecision, onEdit }) {
|
|
|
5372
5376
|
const error = useComputed2(() => part.errorSig.value);
|
|
5373
5377
|
const name = toolName(part.toolName);
|
|
5374
5378
|
const approved = approval.value?.approved;
|
|
5375
|
-
const responded
|
|
5376
|
-
const terminal = state.value === "output-available" || state.value === "output-error" || state.value === "output-denied";
|
|
5377
|
-
const decided = responded || terminal;
|
|
5379
|
+
const { terminal, responded, decided } = toolDecisionState(state.value, approval.value);
|
|
5378
5380
|
const editable = responded && active && !terminal;
|
|
5379
5381
|
const id = part.toolCallId;
|
|
5380
5382
|
return /* @__PURE__ */ jsxs12("div", { class: `${p14}-toolui-group`, "data-testid": decided ? TID.toolDecision : TID.toolApproval, children: [
|
|
@@ -5497,9 +5499,7 @@ function ToolAskInput({ part, strings, active, onSubmit, onDecision, onEdit }) {
|
|
|
5497
5499
|
const state = useComputed3(() => part.stateSig.value);
|
|
5498
5500
|
const approval = useComputed3(() => part.approvalSig.value);
|
|
5499
5501
|
const request = useComputed3(() => parseAskUserInput(part.inputSig.value));
|
|
5500
|
-
const terminal
|
|
5501
|
-
const responded = state.value === "approval-responded" || approval.value?.approved !== void 0;
|
|
5502
|
-
const decided = terminal || responded;
|
|
5502
|
+
const { terminal, responded, decided } = toolDecisionState(state.value, approval.value);
|
|
5503
5503
|
const viaApproval = approval.value !== void 0;
|
|
5504
5504
|
const resolve = (answer, accepted) => {
|
|
5505
5505
|
if (viaApproval) onDecision(part.toolCallId, accepted, answer);
|
|
@@ -5603,10 +5603,8 @@ function DecidedCard({
|
|
|
5603
5603
|
}) {
|
|
5604
5604
|
const output = useComputed3(() => part.outputSig.value);
|
|
5605
5605
|
const approval = useComputed3(() => part.approvalSig.value);
|
|
5606
|
-
const
|
|
5607
|
-
const
|
|
5608
|
-
const skipped = !isConfirm && approved === false;
|
|
5609
|
-
const answer = isConfirm ? `${approved ? strings.confirmYes : strings.confirmNo}${approval.value?.reason ? ` \u2014 ${approval.value.reason}` : ""}` : approved !== void 0 ? approval.value?.reason ?? "" : summarizeOutput(output.value);
|
|
5606
|
+
const skipped = approval.value?.approved === false;
|
|
5607
|
+
const answer = approval.value?.approved !== void 0 ? approval.value.reason ?? "" : summarizeOutput(output.value, strings);
|
|
5610
5608
|
return /* @__PURE__ */ jsxs13("div", { class: `${p15}-toolui`, "data-testid": TID.toolDecision, children: [
|
|
5611
5609
|
/* @__PURE__ */ jsxs13("div", { class: `${p15}-toolui-head`, children: [
|
|
5612
5610
|
/* @__PURE__ */ jsx16("span", { class: `${p15}-toolui-badge ${p15}-toolui-badge-accent`, children: strings.inputBadge }),
|
|
@@ -5618,12 +5616,12 @@ function DecidedCard({
|
|
|
5618
5616
|
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
|
|
5619
5617
|
] });
|
|
5620
5618
|
}
|
|
5621
|
-
function summarizeOutput(output) {
|
|
5619
|
+
function summarizeOutput(output, strings) {
|
|
5622
5620
|
if (output == null) return "";
|
|
5623
5621
|
if (typeof output === "string") return output;
|
|
5624
5622
|
if (typeof output === "object") {
|
|
5625
5623
|
const rec = output;
|
|
5626
|
-
if ("confirmed" in rec) return rec.confirmed ?
|
|
5624
|
+
if ("confirmed" in rec) return rec.confirmed ? strings.confirmYes : strings.confirmNo;
|
|
5627
5625
|
if (typeof rec.responseText === "string" && rec.responseText) return rec.responseText;
|
|
5628
5626
|
return Object.values(rec).filter((v) => typeof v === "string" || typeof v === "number").join(", ");
|
|
5629
5627
|
}
|
package/package.json
CHANGED
package/web-component.mjs
CHANGED
|
@@ -10,9 +10,8 @@ var BRAND = {
|
|
|
10
10
|
id: true ? "help-ai" : "help-ai",
|
|
11
11
|
name: true ? "@helpai/elements" : "Help AI",
|
|
12
12
|
global: true ? "HelpAI" : "HelpAI",
|
|
13
|
-
// Custom-element tag — `web-ai-chat
|
|
14
|
-
//
|
|
15
|
-
// and @goai builds.
|
|
13
|
+
// Custom-element tag — `web-ai-chat`. Brand-neutral by design so docs
|
|
14
|
+
// and copy snippets stay stable regardless of which brand is built.
|
|
16
15
|
tagName: true ? "web-ai-chat" : "web-ai-chat",
|
|
17
16
|
cssPrefix: true ? "helpai" : "helpai",
|
|
18
17
|
/**
|
|
@@ -21,9 +20,9 @@ var BRAND = {
|
|
|
21
20
|
* `${defaultBaseUrl}/api/data`.
|
|
22
21
|
*/
|
|
23
22
|
defaultBaseUrl: true ? "https://help.ai" : "",
|
|
24
|
-
/** Public-facing brand label, e.g. "Help AI"
|
|
23
|
+
/** Public-facing brand label, e.g. "Help AI". */
|
|
25
24
|
displayName: true ? "Help AI" : "Help AI",
|
|
26
|
-
/** Bare host without protocol, e.g. "help.ai"
|
|
25
|
+
/** Bare host without protocol, e.g. "help.ai". */
|
|
27
26
|
domain: true ? "help.ai" : "help.ai",
|
|
28
27
|
/** Full marketing site URL, e.g. "https://help.ai". */
|
|
29
28
|
siteUrl: true ? "https://help.ai" : "https://help.ai"
|
|
@@ -1795,7 +1794,7 @@ function createAuth(opts) {
|
|
|
1795
1794
|
}
|
|
1796
1795
|
|
|
1797
1796
|
// src/core/version.ts
|
|
1798
|
-
var ELEMENTS_VERSION = true ? "0.50.
|
|
1797
|
+
var ELEMENTS_VERSION = true ? "0.50.2" : "0.0.0-dev";
|
|
1799
1798
|
var ELEMENTS_VERSION_PARAM = "_ev";
|
|
1800
1799
|
|
|
1801
1800
|
// src/stream/types.ts
|
|
@@ -5241,6 +5240,11 @@ function toolName(raw) {
|
|
|
5241
5240
|
if (raw.startsWith("tool-")) return raw.slice(5);
|
|
5242
5241
|
return raw;
|
|
5243
5242
|
}
|
|
5243
|
+
function toolDecisionState(state, approval) {
|
|
5244
|
+
const terminal = state === "output-available" || state === "output-error" || state === "output-denied";
|
|
5245
|
+
const responded = state === "approval-responded" || approval?.approved !== void 0;
|
|
5246
|
+
return { terminal, responded, decided: terminal || responded };
|
|
5247
|
+
}
|
|
5244
5248
|
function statusOf(state, approval) {
|
|
5245
5249
|
if (state === "output-error") return "error";
|
|
5246
5250
|
if (state === "output-denied" || approval?.approved === false) return "denied";
|
|
@@ -5331,9 +5335,7 @@ function ToolApproval({ part, strings, active, onDecision, onEdit }) {
|
|
|
5331
5335
|
const error = useComputed2(() => part.errorSig.value);
|
|
5332
5336
|
const name = toolName(part.toolName);
|
|
5333
5337
|
const approved = approval.value?.approved;
|
|
5334
|
-
const responded
|
|
5335
|
-
const terminal = state.value === "output-available" || state.value === "output-error" || state.value === "output-denied";
|
|
5336
|
-
const decided = responded || terminal;
|
|
5338
|
+
const { terminal, responded, decided } = toolDecisionState(state.value, approval.value);
|
|
5337
5339
|
const editable = responded && active && !terminal;
|
|
5338
5340
|
const id = part.toolCallId;
|
|
5339
5341
|
return /* @__PURE__ */ jsxs12("div", { class: `${p14}-toolui-group`, "data-testid": decided ? TID.toolDecision : TID.toolApproval, children: [
|
|
@@ -5456,9 +5458,7 @@ function ToolAskInput({ part, strings, active, onSubmit, onDecision, onEdit }) {
|
|
|
5456
5458
|
const state = useComputed3(() => part.stateSig.value);
|
|
5457
5459
|
const approval = useComputed3(() => part.approvalSig.value);
|
|
5458
5460
|
const request = useComputed3(() => parseAskUserInput(part.inputSig.value));
|
|
5459
|
-
const terminal
|
|
5460
|
-
const responded = state.value === "approval-responded" || approval.value?.approved !== void 0;
|
|
5461
|
-
const decided = terminal || responded;
|
|
5461
|
+
const { terminal, responded, decided } = toolDecisionState(state.value, approval.value);
|
|
5462
5462
|
const viaApproval = approval.value !== void 0;
|
|
5463
5463
|
const resolve = (answer, accepted) => {
|
|
5464
5464
|
if (viaApproval) onDecision(part.toolCallId, accepted, answer);
|
|
@@ -5562,10 +5562,8 @@ function DecidedCard({
|
|
|
5562
5562
|
}) {
|
|
5563
5563
|
const output = useComputed3(() => part.outputSig.value);
|
|
5564
5564
|
const approval = useComputed3(() => part.approvalSig.value);
|
|
5565
|
-
const
|
|
5566
|
-
const
|
|
5567
|
-
const skipped = !isConfirm && approved === false;
|
|
5568
|
-
const answer = isConfirm ? `${approved ? strings.confirmYes : strings.confirmNo}${approval.value?.reason ? ` \u2014 ${approval.value.reason}` : ""}` : approved !== void 0 ? approval.value?.reason ?? "" : summarizeOutput(output.value);
|
|
5565
|
+
const skipped = approval.value?.approved === false;
|
|
5566
|
+
const answer = approval.value?.approved !== void 0 ? approval.value.reason ?? "" : summarizeOutput(output.value, strings);
|
|
5569
5567
|
return /* @__PURE__ */ jsxs13("div", { class: `${p15}-toolui`, "data-testid": TID.toolDecision, children: [
|
|
5570
5568
|
/* @__PURE__ */ jsxs13("div", { class: `${p15}-toolui-head`, children: [
|
|
5571
5569
|
/* @__PURE__ */ jsx16("span", { class: `${p15}-toolui-badge ${p15}-toolui-badge-accent`, children: strings.inputBadge }),
|
|
@@ -5577,12 +5575,12 @@ function DecidedCard({
|
|
|
5577
5575
|
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
|
|
5578
5576
|
] });
|
|
5579
5577
|
}
|
|
5580
|
-
function summarizeOutput(output) {
|
|
5578
|
+
function summarizeOutput(output, strings) {
|
|
5581
5579
|
if (output == null) return "";
|
|
5582
5580
|
if (typeof output === "string") return output;
|
|
5583
5581
|
if (typeof output === "object") {
|
|
5584
5582
|
const rec = output;
|
|
5585
|
-
if ("confirmed" in rec) return rec.confirmed ?
|
|
5583
|
+
if ("confirmed" in rec) return rec.confirmed ? strings.confirmYes : strings.confirmNo;
|
|
5586
5584
|
if (typeof rec.responseText === "string" && rec.responseText) return rec.responseText;
|
|
5587
5585
|
return Object.values(rec).filter((v) => typeof v === "string" || typeof v === "number").join(", ");
|
|
5588
5586
|
}
|