@helpai/elements 0.19.1 → 0.19.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 +5 -5
- package/elements-web-component.esm.js.map +3 -3
- package/elements.cjs.js +5 -5
- package/elements.cjs.js.map +3 -3
- package/elements.esm.js +5 -5
- package/elements.esm.js.map +3 -3
- package/elements.js +5 -5
- package/elements.js.map +3 -3
- package/index.d.ts +1 -1
- package/index.mjs +40 -18
- package/package.json +1 -1
- package/schema.d.ts +49 -49
- package/web-component.mjs +40 -18
package/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, L as Link, S as ServerConfig, b as SiteConfig, c as StartConversationResponse, W as WidgetConfig, d as WidgetConfigPartial, e as WidgetSettings, f as WidgetSettingsPartial } from './deployment-
|
|
1
|
+
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, L as Link, S as ServerConfig, b as SiteConfig, c as StartConversationResponse, W as WidgetConfig, d as WidgetConfigPartial, e as WidgetSettings, f as WidgetSettingsPartial } from './deployment-H2uevlHy.js';
|
|
2
2
|
import 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
package/index.mjs
CHANGED
|
@@ -128,7 +128,7 @@ var STRINGS_EN = {
|
|
|
128
128
|
formChooseAtMost: "Choose at most {max}",
|
|
129
129
|
formOther: "Other",
|
|
130
130
|
formOtherPlaceholder: "Type your answer\u2026",
|
|
131
|
-
inputRequired: "
|
|
131
|
+
inputRequired: "I need a bit more info",
|
|
132
132
|
inputSubmit: "Submit",
|
|
133
133
|
inputSkip: "Skip",
|
|
134
134
|
inputSubmitted: "Answer submitted",
|
|
@@ -238,7 +238,7 @@ var STRINGS_FR = {
|
|
|
238
238
|
formChooseAtMost: "Choisissez au plus {max}",
|
|
239
239
|
formOther: "Autre",
|
|
240
240
|
formOtherPlaceholder: "Saisissez votre r\xE9ponse\u2026",
|
|
241
|
-
inputRequired: "
|
|
241
|
+
inputRequired: "J'ai besoin de quelques pr\xE9cisions",
|
|
242
242
|
inputSubmit: "Envoyer",
|
|
243
243
|
inputSkip: "Ignorer",
|
|
244
244
|
inputSubmitted: "R\xE9ponse envoy\xE9e",
|
|
@@ -1985,9 +1985,10 @@ function partFromReactive(p33) {
|
|
|
1985
1985
|
import { signal as signal2 } from "@preact/signals";
|
|
1986
1986
|
|
|
1987
1987
|
// src/stream/constants.ts
|
|
1988
|
-
var ASK_USER_INPUT_TOOL = "tool:ask-user-input";
|
|
1989
1988
|
function isAskUserInputTool(toolName) {
|
|
1990
|
-
|
|
1989
|
+
if (!toolName) return false;
|
|
1990
|
+
const name = toolName.startsWith("tool:") ? toolName.slice(5) : toolName;
|
|
1991
|
+
return name === "ask-user-input" || name === "ask_user_input" || name === "request-user-input" || name === "request_user_input";
|
|
1991
1992
|
}
|
|
1992
1993
|
var TRIGGER = {
|
|
1993
1994
|
submitMessage: "submit-message",
|
|
@@ -4363,6 +4364,9 @@ function hardenLink(a) {
|
|
|
4363
4364
|
import { useComputed as useComputed2, useSignal } from "@preact/signals";
|
|
4364
4365
|
import { Fragment, jsx as jsx13, jsxs as jsxs10 } from "preact/jsx-runtime";
|
|
4365
4366
|
var p12 = BRAND.cssPrefix;
|
|
4367
|
+
function displayToolName(toolName) {
|
|
4368
|
+
return (toolName.startsWith("tool:") ? toolName.slice(5) : toolName).replace(/[-_]+/g, " ");
|
|
4369
|
+
}
|
|
4366
4370
|
function ToolApproval({ part, strings, active, onDecision }) {
|
|
4367
4371
|
const approval = useComputed2(() => part.approvalSig.value);
|
|
4368
4372
|
const input = useComputed2(() => part.inputSig.value);
|
|
@@ -4372,7 +4376,7 @@ function ToolApproval({ part, strings, active, onDecision }) {
|
|
|
4372
4376
|
const ap = approval.value;
|
|
4373
4377
|
return /* @__PURE__ */ jsxs10("div", { class: `${p12}-tool-approval ${p12}-tool-decided`, "data-testid": TID.toolDecision, children: [
|
|
4374
4378
|
/* @__PURE__ */ jsx13("span", { class: `${p12}-tool-decided-label`, "data-approved": ap?.approved ? "true" : "false", children: ap?.approved ? strings.approved : strings.rejected }),
|
|
4375
|
-
/* @__PURE__ */ jsx13("strong", { class: `${p12}-tool-title`, children: part.toolName }),
|
|
4379
|
+
/* @__PURE__ */ jsx13("strong", { class: `${p12}-tool-title`, children: displayToolName(part.toolName) }),
|
|
4376
4380
|
ap?.reason ? /* @__PURE__ */ jsx13("span", { class: `${p12}-tool-decided-value`, children: ap.reason }) : null
|
|
4377
4381
|
] });
|
|
4378
4382
|
}
|
|
@@ -4380,7 +4384,7 @@ function ToolApproval({ part, strings, active, onDecision }) {
|
|
|
4380
4384
|
return /* @__PURE__ */ jsxs10("div", { class: `${p12}-tool-approval`, "data-testid": TID.toolApproval, children: [
|
|
4381
4385
|
/* @__PURE__ */ jsxs10("div", { class: `${p12}-tool-head`, children: [
|
|
4382
4386
|
/* @__PURE__ */ jsx13("span", { class: `${p12}-tool-badge`, children: strings.approvalRequired }),
|
|
4383
|
-
/* @__PURE__ */ jsx13("strong", { class: `${p12}-tool-title`, children: part.toolName })
|
|
4387
|
+
/* @__PURE__ */ jsx13("strong", { class: `${p12}-tool-title`, children: displayToolName(part.toolName) })
|
|
4384
4388
|
] }),
|
|
4385
4389
|
args ? /* @__PURE__ */ jsx13("pre", { class: `${p12}-tool-args`, children: args }) : null,
|
|
4386
4390
|
active ? /* @__PURE__ */ jsxs10(Fragment, { children: [
|
|
@@ -4490,10 +4494,17 @@ function num(v) {
|
|
|
4490
4494
|
// src/ui/tool-ask-input.tsx
|
|
4491
4495
|
import { jsx as jsx14, jsxs as jsxs11 } from "preact/jsx-runtime";
|
|
4492
4496
|
var p13 = BRAND.cssPrefix;
|
|
4493
|
-
function ToolAskInput({ part, strings, active, onSubmit }) {
|
|
4497
|
+
function ToolAskInput({ part, strings, active, onSubmit, onDecision }) {
|
|
4494
4498
|
const state = useComputed3(() => part.stateSig.value);
|
|
4499
|
+
const approval = useComputed3(() => part.approvalSig.value);
|
|
4495
4500
|
const request = useComputed3(() => parseAskUserInput(part.inputSig.value));
|
|
4496
|
-
const decided = state.value === "output" || state.value === "error";
|
|
4501
|
+
const decided = state.value === "output" || state.value === "error" || approval.value?.approved !== void 0;
|
|
4502
|
+
const viaApproval = approval.value !== void 0;
|
|
4503
|
+
const resolve = (answer, accepted) => {
|
|
4504
|
+
if (viaApproval) onDecision(part.toolCallId, accepted, answer);
|
|
4505
|
+
else if (request.value.responseType === "confirmation") onSubmit(part.toolCallId, { confirmed: accepted });
|
|
4506
|
+
else onSubmit(part.toolCallId, accepted ? { answer } : {});
|
|
4507
|
+
};
|
|
4497
4508
|
if (decided) {
|
|
4498
4509
|
return /* @__PURE__ */ jsx14(DecidedSummary, { part, strings });
|
|
4499
4510
|
}
|
|
@@ -4515,7 +4526,7 @@ function ToolAskInput({ part, strings, active, onSubmit }) {
|
|
|
4515
4526
|
{
|
|
4516
4527
|
type: "button",
|
|
4517
4528
|
class: `${p13}-form-skip`,
|
|
4518
|
-
onClick: () =>
|
|
4529
|
+
onClick: () => resolve(void 0, false),
|
|
4519
4530
|
"data-testid": TID.toolInputSkip,
|
|
4520
4531
|
children: strings.reject
|
|
4521
4532
|
}
|
|
@@ -4525,7 +4536,7 @@ function ToolAskInput({ part, strings, active, onSubmit }) {
|
|
|
4525
4536
|
{
|
|
4526
4537
|
type: "button",
|
|
4527
4538
|
class: `${p13}-form-submit`,
|
|
4528
|
-
onClick: () =>
|
|
4539
|
+
onClick: () => resolve(void 0, true),
|
|
4529
4540
|
"data-testid": TID.toolInputSubmit,
|
|
4530
4541
|
children: strings.approve
|
|
4531
4542
|
}
|
|
@@ -4536,9 +4547,9 @@ function ToolAskInput({ part, strings, active, onSubmit }) {
|
|
|
4536
4547
|
fields: askInputToFields(req),
|
|
4537
4548
|
strings,
|
|
4538
4549
|
submitLabel: strings.inputSubmit,
|
|
4539
|
-
onSubmit: (values) =>
|
|
4550
|
+
onSubmit: (values) => resolve(values.answer ?? Object.values(values).join(", "), true),
|
|
4540
4551
|
skipLabel: req.required === false ? strings.inputSkip : void 0,
|
|
4541
|
-
onSkip: req.required === false ? () =>
|
|
4552
|
+
onSkip: req.required === false ? () => resolve(void 0, false) : void 0,
|
|
4542
4553
|
submitTestId: TID.toolInputSubmit,
|
|
4543
4554
|
skipTestId: TID.toolInputSkip
|
|
4544
4555
|
}
|
|
@@ -4553,10 +4564,12 @@ function Header({ strings, title }) {
|
|
|
4553
4564
|
}
|
|
4554
4565
|
function DecidedSummary({ part, strings }) {
|
|
4555
4566
|
const output = useComputed3(() => part.outputSig.value);
|
|
4556
|
-
const
|
|
4567
|
+
const approval = useComputed3(() => part.approvalSig.value);
|
|
4568
|
+
const answer = approval.value?.approved !== void 0 ? approval.value.reason ?? "" : summarizeOutput(output.value);
|
|
4569
|
+
const skipped = approval.value?.approved === false;
|
|
4557
4570
|
return /* @__PURE__ */ jsxs11("div", { class: `${p13}-tool-ask-input ${p13}-tool-decided`, "data-testid": TID.toolDecision, children: [
|
|
4558
|
-
/* @__PURE__ */ jsx14("span", { class: `${p13}-tool-decided-label`, children: strings.inputSubmitted }),
|
|
4559
|
-
/* @__PURE__ */ jsx14("span", { class: `${p13}-tool-decided-value`, children:
|
|
4571
|
+
/* @__PURE__ */ jsx14("span", { class: `${p13}-tool-decided-label`, children: skipped ? strings.inputSkip : strings.inputSubmitted }),
|
|
4572
|
+
/* @__PURE__ */ jsx14("span", { class: `${p13}-tool-decided-value`, children: skipped ? "" : answer || strings.inputSubmitted })
|
|
4560
4573
|
] });
|
|
4561
4574
|
}
|
|
4562
4575
|
function summarizeOutput(output) {
|
|
@@ -4686,12 +4699,21 @@ function ToolPartView({
|
|
|
4686
4699
|
const state = useComputed4(() => part.stateSig.value);
|
|
4687
4700
|
const hasApproval = useComputed4(() => part.approvalSig.value !== void 0);
|
|
4688
4701
|
if (tool?.humanInLoop) {
|
|
4702
|
+
if (isAskUserInputTool(part.toolName) || state.value === "awaiting-input") {
|
|
4703
|
+
return /* @__PURE__ */ jsx16(
|
|
4704
|
+
ToolAskInput,
|
|
4705
|
+
{
|
|
4706
|
+
part,
|
|
4707
|
+
strings,
|
|
4708
|
+
active: interactive,
|
|
4709
|
+
onSubmit: tool.onResult,
|
|
4710
|
+
onDecision: tool.onDecision
|
|
4711
|
+
}
|
|
4712
|
+
);
|
|
4713
|
+
}
|
|
4689
4714
|
if (hasApproval.value || state.value === "awaiting-approval") {
|
|
4690
4715
|
return /* @__PURE__ */ jsx16(ToolApproval, { part, strings, active: interactive, onDecision: tool.onDecision });
|
|
4691
4716
|
}
|
|
4692
|
-
if (isAskUserInputTool(part.toolName) || state.value === "awaiting-input") {
|
|
4693
|
-
return /* @__PURE__ */ jsx16(ToolAskInput, { part, strings, active: interactive, onSubmit: tool.onResult });
|
|
4694
|
-
}
|
|
4695
4717
|
}
|
|
4696
4718
|
return showToolCalls ? /* @__PURE__ */ jsx16(ToolChip, { part, strings }) : null;
|
|
4697
4719
|
}
|
package/package.json
CHANGED
package/schema.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, E as Endpoints, L as Link, P as PAGE_AREA_SUGGESTIONS, g as PageContext, S as ServerConfig, b as SiteConfig, c as StartConversationResponse, U as UserContext, W as WidgetConfig, d as WidgetConfigPartial, e as WidgetSettings, f as WidgetSettingsPartial, h as assetSchema, i as blocksConfigSchema, j as connectionConfigPartialSchema, k as connectionConfigSchema, l as cssColorSchema, m as cssLengthSchema, n as endpointsSchema, o as linkSchema, p as localeSchema, q as pageContextSchema, s as serverConfigSchema, r as siteConfigSchema, t as startConversationResponseSchema, u as userContextSchema, v as uuid7Schema, w as widgetConfigPartialSchema, x as widgetConfigSchema, y as widgetSettingsPartialSchema, z as widgetSettingsSchema } from './deployment-
|
|
1
|
+
export { A as Asset, B as BlocksConfig, C as ConnectionConfig, a as ConnectionConfigPartial, E as Endpoints, L as Link, P as PAGE_AREA_SUGGESTIONS, g as PageContext, S as ServerConfig, b as SiteConfig, c as StartConversationResponse, U as UserContext, W as WidgetConfig, d as WidgetConfigPartial, e as WidgetSettings, f as WidgetSettingsPartial, h as assetSchema, i as blocksConfigSchema, j as connectionConfigPartialSchema, k as connectionConfigSchema, l as cssColorSchema, m as cssLengthSchema, n as endpointsSchema, o as linkSchema, p as localeSchema, q as pageContextSchema, s as serverConfigSchema, r as siteConfigSchema, t as startConversationResponseSchema, u as userContextSchema, v as uuid7Schema, w as widgetConfigPartialSchema, x as widgetConfigSchema, y as widgetSettingsPartialSchema, z as widgetSettingsSchema } from './deployment-H2uevlHy.js';
|
|
2
2
|
import { z } from 'zod';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -56,9 +56,9 @@ declare const presentationSchema: z.ZodObject<{
|
|
|
56
56
|
inset: z.ZodOptional<z.ZodString>;
|
|
57
57
|
initialSize: z.ZodDefault<z.ZodEnum<{
|
|
58
58
|
fullscreen: "fullscreen";
|
|
59
|
+
normal: "normal";
|
|
59
60
|
expanded: "expanded";
|
|
60
61
|
auto: "auto";
|
|
61
|
-
normal: "normal";
|
|
62
62
|
}>>;
|
|
63
63
|
autoSizeBreakpoint: z.ZodDefault<z.ZodNumber>;
|
|
64
64
|
}, z.core.$loose>>;
|
|
@@ -148,9 +148,9 @@ declare const launcherSizeSchema: z.ZodEnum<{
|
|
|
148
148
|
}>;
|
|
149
149
|
type LauncherSize = z.infer<typeof launcherSizeSchema>;
|
|
150
150
|
declare const calloutShapeSchema: z.ZodEnum<{
|
|
151
|
-
callout: "callout";
|
|
152
151
|
pill: "pill";
|
|
153
152
|
bubble: "bubble";
|
|
153
|
+
callout: "callout";
|
|
154
154
|
}>;
|
|
155
155
|
type CalloutShape = z.infer<typeof calloutShapeSchema>;
|
|
156
156
|
declare const calloutPositionSchema: z.ZodEnum<{
|
|
@@ -162,9 +162,9 @@ type CalloutPosition = z.infer<typeof calloutPositionSchema>;
|
|
|
162
162
|
declare const launcherCalloutSchema: z.ZodObject<{
|
|
163
163
|
text: z.ZodDefault<z.ZodString>;
|
|
164
164
|
shape: z.ZodDefault<z.ZodEnum<{
|
|
165
|
-
callout: "callout";
|
|
166
165
|
pill: "pill";
|
|
167
166
|
bubble: "bubble";
|
|
167
|
+
callout: "callout";
|
|
168
168
|
}>>;
|
|
169
169
|
position: z.ZodDefault<z.ZodEnum<{
|
|
170
170
|
auto: "auto";
|
|
@@ -195,9 +195,9 @@ declare const launcherOptionsSchema: z.ZodObject<{
|
|
|
195
195
|
callout: z.ZodOptional<z.ZodObject<{
|
|
196
196
|
text: z.ZodDefault<z.ZodString>;
|
|
197
197
|
shape: z.ZodDefault<z.ZodEnum<{
|
|
198
|
-
callout: "callout";
|
|
199
198
|
pill: "pill";
|
|
200
199
|
bubble: "bubble";
|
|
200
|
+
callout: "callout";
|
|
201
201
|
}>>;
|
|
202
202
|
position: z.ZodDefault<z.ZodEnum<{
|
|
203
203
|
auto: "auto";
|
|
@@ -240,9 +240,9 @@ type LauncherOptions = z.infer<typeof launcherOptionsSchema>;
|
|
|
240
240
|
|
|
241
241
|
declare const initialSizeSchema: z.ZodEnum<{
|
|
242
242
|
fullscreen: "fullscreen";
|
|
243
|
+
normal: "normal";
|
|
243
244
|
expanded: "expanded";
|
|
244
245
|
auto: "auto";
|
|
245
|
-
normal: "normal";
|
|
246
246
|
}>;
|
|
247
247
|
declare const resizeOptionsSchema: z.ZodObject<{
|
|
248
248
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
@@ -269,9 +269,9 @@ declare const sizeOptionsSchema: z.ZodObject<{
|
|
|
269
269
|
inset: z.ZodOptional<z.ZodString>;
|
|
270
270
|
initialSize: z.ZodDefault<z.ZodEnum<{
|
|
271
271
|
fullscreen: "fullscreen";
|
|
272
|
+
normal: "normal";
|
|
272
273
|
expanded: "expanded";
|
|
273
274
|
auto: "auto";
|
|
274
|
-
normal: "normal";
|
|
275
275
|
}>>;
|
|
276
276
|
autoSizeBreakpoint: z.ZodDefault<z.ZodNumber>;
|
|
277
277
|
}, z.core.$loose>;
|
|
@@ -323,43 +323,43 @@ type FeatureFlags = z.infer<typeof featureFlagsSchema>;
|
|
|
323
323
|
*/
|
|
324
324
|
|
|
325
325
|
declare const actionNameSchema: z.ZodEnum<{
|
|
326
|
-
close: "close";
|
|
327
326
|
expand: "expand";
|
|
328
327
|
fullscreen: "fullscreen";
|
|
329
328
|
popOut: "popOut";
|
|
330
|
-
|
|
331
|
-
theme: "theme";
|
|
329
|
+
close: "close";
|
|
332
330
|
language: "language";
|
|
331
|
+
theme: "theme";
|
|
333
332
|
textSize: "textSize";
|
|
334
333
|
history: "history";
|
|
334
|
+
clear: "clear";
|
|
335
335
|
sound: "sound";
|
|
336
336
|
}>;
|
|
337
337
|
type ActionName = z.infer<typeof actionNameSchema>;
|
|
338
338
|
declare const headerActionsSchema: z.ZodArray<z.ZodEnum<{
|
|
339
|
-
close: "close";
|
|
340
339
|
expand: "expand";
|
|
341
340
|
fullscreen: "fullscreen";
|
|
342
341
|
popOut: "popOut";
|
|
343
|
-
|
|
344
|
-
theme: "theme";
|
|
342
|
+
close: "close";
|
|
345
343
|
language: "language";
|
|
344
|
+
theme: "theme";
|
|
346
345
|
textSize: "textSize";
|
|
347
346
|
history: "history";
|
|
347
|
+
clear: "clear";
|
|
348
348
|
sound: "sound";
|
|
349
349
|
}>>;
|
|
350
350
|
type HeaderActions = z.infer<typeof headerActionsSchema>;
|
|
351
351
|
/** Section wrapper — `actions` list wrapped under `header` in the dashboard form. */
|
|
352
352
|
declare const headerSchema: z.ZodObject<{
|
|
353
353
|
actions: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
354
|
-
close: "close";
|
|
355
354
|
expand: "expand";
|
|
356
355
|
fullscreen: "fullscreen";
|
|
357
356
|
popOut: "popOut";
|
|
358
|
-
|
|
359
|
-
theme: "theme";
|
|
357
|
+
close: "close";
|
|
360
358
|
language: "language";
|
|
359
|
+
theme: "theme";
|
|
361
360
|
textSize: "textSize";
|
|
362
361
|
history: "history";
|
|
362
|
+
clear: "clear";
|
|
363
363
|
sound: "sound";
|
|
364
364
|
}>>>;
|
|
365
365
|
}, z.core.$loose>;
|
|
@@ -375,33 +375,33 @@ type HeaderOptions = z.infer<typeof headerSchema>;
|
|
|
375
375
|
*/
|
|
376
376
|
|
|
377
377
|
declare const feedbackEventSchema: z.ZodEnum<{
|
|
378
|
-
voiceStart: "voiceStart";
|
|
379
|
-
voiceStop: "voiceStop";
|
|
380
378
|
error: "error";
|
|
381
379
|
messageReceived: "messageReceived";
|
|
382
380
|
messageSent: "messageSent";
|
|
381
|
+
voiceStart: "voiceStart";
|
|
382
|
+
voiceStop: "voiceStop";
|
|
383
383
|
}>;
|
|
384
384
|
type FeedbackEvent = z.infer<typeof feedbackEventSchema>;
|
|
385
385
|
declare const soundOptionsSchema: z.ZodObject<{
|
|
386
386
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
387
387
|
volume: z.ZodDefault<z.ZodNumber>;
|
|
388
388
|
events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
389
|
-
voiceStart: "voiceStart";
|
|
390
|
-
voiceStop: "voiceStop";
|
|
391
389
|
error: "error";
|
|
392
390
|
messageReceived: "messageReceived";
|
|
393
391
|
messageSent: "messageSent";
|
|
392
|
+
voiceStart: "voiceStart";
|
|
393
|
+
voiceStop: "voiceStop";
|
|
394
394
|
}> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>;
|
|
395
395
|
}, z.core.$loose>;
|
|
396
396
|
type SoundOptions = z.infer<typeof soundOptionsSchema>;
|
|
397
397
|
declare const hapticsOptionsSchema: z.ZodObject<{
|
|
398
398
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
399
399
|
events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
400
|
-
voiceStart: "voiceStart";
|
|
401
|
-
voiceStop: "voiceStop";
|
|
402
400
|
error: "error";
|
|
403
401
|
messageReceived: "messageReceived";
|
|
404
402
|
messageSent: "messageSent";
|
|
403
|
+
voiceStart: "voiceStart";
|
|
404
|
+
voiceStop: "voiceStop";
|
|
405
405
|
}> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
406
406
|
}, z.core.$loose>;
|
|
407
407
|
type HapticsOptions = z.infer<typeof hapticsOptionsSchema>;
|
|
@@ -410,21 +410,21 @@ declare const feedbackSchema: z.ZodObject<{
|
|
|
410
410
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
411
411
|
volume: z.ZodDefault<z.ZodNumber>;
|
|
412
412
|
events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
413
|
-
voiceStart: "voiceStart";
|
|
414
|
-
voiceStop: "voiceStop";
|
|
415
413
|
error: "error";
|
|
416
414
|
messageReceived: "messageReceived";
|
|
417
415
|
messageSent: "messageSent";
|
|
416
|
+
voiceStart: "voiceStart";
|
|
417
|
+
voiceStop: "voiceStop";
|
|
418
418
|
}> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodString]>>>;
|
|
419
419
|
}, z.core.$loose>>;
|
|
420
420
|
haptics: z.ZodOptional<z.ZodObject<{
|
|
421
421
|
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
422
422
|
events: z.ZodOptional<z.ZodRecord<z.ZodEnum<{
|
|
423
|
-
voiceStart: "voiceStart";
|
|
424
|
-
voiceStop: "voiceStop";
|
|
425
423
|
error: "error";
|
|
426
424
|
messageReceived: "messageReceived";
|
|
427
425
|
messageSent: "messageSent";
|
|
426
|
+
voiceStart: "voiceStart";
|
|
427
|
+
voiceStop: "voiceStop";
|
|
428
428
|
}> & z.core.$partial, z.ZodUnion<readonly [z.ZodBoolean, z.ZodNumber, z.ZodArray<z.ZodNumber>]>>>;
|
|
429
429
|
}, z.core.$loose>>;
|
|
430
430
|
}, z.core.$loose>;
|
|
@@ -565,16 +565,16 @@ type FooterOptions = z.infer<typeof footerSchema>;
|
|
|
565
565
|
|
|
566
566
|
declare const fieldTypeSchema: z.ZodEnum<{
|
|
567
567
|
number: "number";
|
|
568
|
-
select: "select";
|
|
569
|
-
textarea: "textarea";
|
|
570
|
-
time: "time";
|
|
571
568
|
text: "text";
|
|
572
|
-
checkbox: "checkbox";
|
|
573
|
-
radio: "radio";
|
|
574
569
|
url: "url";
|
|
575
570
|
email: "email";
|
|
576
571
|
tel: "tel";
|
|
577
572
|
date: "date";
|
|
573
|
+
time: "time";
|
|
574
|
+
textarea: "textarea";
|
|
575
|
+
select: "select";
|
|
576
|
+
radio: "radio";
|
|
577
|
+
checkbox: "checkbox";
|
|
578
578
|
multiselect: "multiselect";
|
|
579
579
|
}>;
|
|
580
580
|
type FieldType = z.infer<typeof fieldTypeSchema>;
|
|
@@ -599,16 +599,16 @@ declare const formFieldSchema: z.ZodObject<{
|
|
|
599
599
|
label: z.ZodString;
|
|
600
600
|
type: z.ZodEnum<{
|
|
601
601
|
number: "number";
|
|
602
|
-
select: "select";
|
|
603
|
-
textarea: "textarea";
|
|
604
|
-
time: "time";
|
|
605
602
|
text: "text";
|
|
606
|
-
checkbox: "checkbox";
|
|
607
|
-
radio: "radio";
|
|
608
603
|
url: "url";
|
|
609
604
|
email: "email";
|
|
610
605
|
tel: "tel";
|
|
611
606
|
date: "date";
|
|
607
|
+
time: "time";
|
|
608
|
+
textarea: "textarea";
|
|
609
|
+
select: "select";
|
|
610
|
+
radio: "radio";
|
|
611
|
+
checkbox: "checkbox";
|
|
612
612
|
multiselect: "multiselect";
|
|
613
613
|
}>;
|
|
614
614
|
placeholder: z.ZodOptional<z.ZodString>;
|
|
@@ -659,16 +659,16 @@ declare const formDefSchema: z.ZodObject<{
|
|
|
659
659
|
label: z.ZodString;
|
|
660
660
|
type: z.ZodEnum<{
|
|
661
661
|
number: "number";
|
|
662
|
-
select: "select";
|
|
663
|
-
textarea: "textarea";
|
|
664
|
-
time: "time";
|
|
665
662
|
text: "text";
|
|
666
|
-
checkbox: "checkbox";
|
|
667
|
-
radio: "radio";
|
|
668
663
|
url: "url";
|
|
669
664
|
email: "email";
|
|
670
665
|
tel: "tel";
|
|
671
666
|
date: "date";
|
|
667
|
+
time: "time";
|
|
668
|
+
textarea: "textarea";
|
|
669
|
+
select: "select";
|
|
670
|
+
radio: "radio";
|
|
671
|
+
checkbox: "checkbox";
|
|
672
672
|
multiselect: "multiselect";
|
|
673
673
|
}>;
|
|
674
674
|
placeholder: z.ZodOptional<z.ZodString>;
|
|
@@ -717,16 +717,16 @@ declare const formsSchema: z.ZodArray<z.ZodObject<{
|
|
|
717
717
|
label: z.ZodString;
|
|
718
718
|
type: z.ZodEnum<{
|
|
719
719
|
number: "number";
|
|
720
|
-
select: "select";
|
|
721
|
-
textarea: "textarea";
|
|
722
|
-
time: "time";
|
|
723
720
|
text: "text";
|
|
724
|
-
checkbox: "checkbox";
|
|
725
|
-
radio: "radio";
|
|
726
721
|
url: "url";
|
|
727
722
|
email: "email";
|
|
728
723
|
tel: "tel";
|
|
729
724
|
date: "date";
|
|
725
|
+
time: "time";
|
|
726
|
+
textarea: "textarea";
|
|
727
|
+
select: "select";
|
|
728
|
+
radio: "radio";
|
|
729
|
+
checkbox: "checkbox";
|
|
730
730
|
multiselect: "multiselect";
|
|
731
731
|
}>;
|
|
732
732
|
placeholder: z.ZodOptional<z.ZodString>;
|
|
@@ -798,18 +798,18 @@ type I18nOptions = z.infer<typeof i18nSchema>;
|
|
|
798
798
|
*/
|
|
799
799
|
|
|
800
800
|
declare const moduleLayoutSchema: z.ZodEnum<{
|
|
801
|
-
home: "home";
|
|
802
801
|
chat: "chat";
|
|
803
802
|
help: "help";
|
|
803
|
+
home: "home";
|
|
804
804
|
news: "news";
|
|
805
805
|
}>;
|
|
806
806
|
type ModuleLayout = z.infer<typeof moduleLayoutSchema>;
|
|
807
807
|
declare const moduleSchema: z.ZodObject<{
|
|
808
808
|
label: z.ZodString;
|
|
809
809
|
layout: z.ZodEnum<{
|
|
810
|
-
home: "home";
|
|
811
810
|
chat: "chat";
|
|
812
811
|
help: "help";
|
|
812
|
+
home: "home";
|
|
813
813
|
news: "news";
|
|
814
814
|
}>;
|
|
815
815
|
contentTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
@@ -835,9 +835,9 @@ type ModuleOptions = z.infer<typeof moduleSchema>;
|
|
|
835
835
|
declare const modulesSchema: z.ZodArray<z.ZodObject<{
|
|
836
836
|
label: z.ZodString;
|
|
837
837
|
layout: z.ZodEnum<{
|
|
838
|
-
home: "home";
|
|
839
838
|
chat: "chat";
|
|
840
839
|
help: "help";
|
|
840
|
+
home: "home";
|
|
841
841
|
news: "news";
|
|
842
842
|
}>;
|
|
843
843
|
contentTags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
package/web-component.mjs
CHANGED
|
@@ -128,7 +128,7 @@ var STRINGS_EN = {
|
|
|
128
128
|
formChooseAtMost: "Choose at most {max}",
|
|
129
129
|
formOther: "Other",
|
|
130
130
|
formOtherPlaceholder: "Type your answer\u2026",
|
|
131
|
-
inputRequired: "
|
|
131
|
+
inputRequired: "I need a bit more info",
|
|
132
132
|
inputSubmit: "Submit",
|
|
133
133
|
inputSkip: "Skip",
|
|
134
134
|
inputSubmitted: "Answer submitted",
|
|
@@ -238,7 +238,7 @@ var STRINGS_FR = {
|
|
|
238
238
|
formChooseAtMost: "Choisissez au plus {max}",
|
|
239
239
|
formOther: "Autre",
|
|
240
240
|
formOtherPlaceholder: "Saisissez votre r\xE9ponse\u2026",
|
|
241
|
-
inputRequired: "
|
|
241
|
+
inputRequired: "J'ai besoin de quelques pr\xE9cisions",
|
|
242
242
|
inputSubmit: "Envoyer",
|
|
243
243
|
inputSkip: "Ignorer",
|
|
244
244
|
inputSubmitted: "R\xE9ponse envoy\xE9e",
|
|
@@ -2040,9 +2040,10 @@ function partFromReactive(p33) {
|
|
|
2040
2040
|
import { signal as signal2 } from "@preact/signals";
|
|
2041
2041
|
|
|
2042
2042
|
// src/stream/constants.ts
|
|
2043
|
-
var ASK_USER_INPUT_TOOL = "tool:ask-user-input";
|
|
2044
2043
|
function isAskUserInputTool(toolName) {
|
|
2045
|
-
|
|
2044
|
+
if (!toolName) return false;
|
|
2045
|
+
const name = toolName.startsWith("tool:") ? toolName.slice(5) : toolName;
|
|
2046
|
+
return name === "ask-user-input" || name === "ask_user_input" || name === "request-user-input" || name === "request_user_input";
|
|
2046
2047
|
}
|
|
2047
2048
|
var TRIGGER = {
|
|
2048
2049
|
submitMessage: "submit-message",
|
|
@@ -4418,6 +4419,9 @@ function hardenLink(a) {
|
|
|
4418
4419
|
import { useComputed as useComputed2, useSignal } from "@preact/signals";
|
|
4419
4420
|
import { Fragment, jsx as jsx13, jsxs as jsxs10 } from "preact/jsx-runtime";
|
|
4420
4421
|
var p12 = BRAND.cssPrefix;
|
|
4422
|
+
function displayToolName(toolName) {
|
|
4423
|
+
return (toolName.startsWith("tool:") ? toolName.slice(5) : toolName).replace(/[-_]+/g, " ");
|
|
4424
|
+
}
|
|
4421
4425
|
function ToolApproval({ part, strings, active, onDecision }) {
|
|
4422
4426
|
const approval = useComputed2(() => part.approvalSig.value);
|
|
4423
4427
|
const input = useComputed2(() => part.inputSig.value);
|
|
@@ -4427,7 +4431,7 @@ function ToolApproval({ part, strings, active, onDecision }) {
|
|
|
4427
4431
|
const ap = approval.value;
|
|
4428
4432
|
return /* @__PURE__ */ jsxs10("div", { class: `${p12}-tool-approval ${p12}-tool-decided`, "data-testid": TID.toolDecision, children: [
|
|
4429
4433
|
/* @__PURE__ */ jsx13("span", { class: `${p12}-tool-decided-label`, "data-approved": ap?.approved ? "true" : "false", children: ap?.approved ? strings.approved : strings.rejected }),
|
|
4430
|
-
/* @__PURE__ */ jsx13("strong", { class: `${p12}-tool-title`, children: part.toolName }),
|
|
4434
|
+
/* @__PURE__ */ jsx13("strong", { class: `${p12}-tool-title`, children: displayToolName(part.toolName) }),
|
|
4431
4435
|
ap?.reason ? /* @__PURE__ */ jsx13("span", { class: `${p12}-tool-decided-value`, children: ap.reason }) : null
|
|
4432
4436
|
] });
|
|
4433
4437
|
}
|
|
@@ -4435,7 +4439,7 @@ function ToolApproval({ part, strings, active, onDecision }) {
|
|
|
4435
4439
|
return /* @__PURE__ */ jsxs10("div", { class: `${p12}-tool-approval`, "data-testid": TID.toolApproval, children: [
|
|
4436
4440
|
/* @__PURE__ */ jsxs10("div", { class: `${p12}-tool-head`, children: [
|
|
4437
4441
|
/* @__PURE__ */ jsx13("span", { class: `${p12}-tool-badge`, children: strings.approvalRequired }),
|
|
4438
|
-
/* @__PURE__ */ jsx13("strong", { class: `${p12}-tool-title`, children: part.toolName })
|
|
4442
|
+
/* @__PURE__ */ jsx13("strong", { class: `${p12}-tool-title`, children: displayToolName(part.toolName) })
|
|
4439
4443
|
] }),
|
|
4440
4444
|
args ? /* @__PURE__ */ jsx13("pre", { class: `${p12}-tool-args`, children: args }) : null,
|
|
4441
4445
|
active ? /* @__PURE__ */ jsxs10(Fragment, { children: [
|
|
@@ -4545,10 +4549,17 @@ function num(v) {
|
|
|
4545
4549
|
// src/ui/tool-ask-input.tsx
|
|
4546
4550
|
import { jsx as jsx14, jsxs as jsxs11 } from "preact/jsx-runtime";
|
|
4547
4551
|
var p13 = BRAND.cssPrefix;
|
|
4548
|
-
function ToolAskInput({ part, strings, active, onSubmit }) {
|
|
4552
|
+
function ToolAskInput({ part, strings, active, onSubmit, onDecision }) {
|
|
4549
4553
|
const state = useComputed3(() => part.stateSig.value);
|
|
4554
|
+
const approval = useComputed3(() => part.approvalSig.value);
|
|
4550
4555
|
const request = useComputed3(() => parseAskUserInput(part.inputSig.value));
|
|
4551
|
-
const decided = state.value === "output" || state.value === "error";
|
|
4556
|
+
const decided = state.value === "output" || state.value === "error" || approval.value?.approved !== void 0;
|
|
4557
|
+
const viaApproval = approval.value !== void 0;
|
|
4558
|
+
const resolve = (answer, accepted) => {
|
|
4559
|
+
if (viaApproval) onDecision(part.toolCallId, accepted, answer);
|
|
4560
|
+
else if (request.value.responseType === "confirmation") onSubmit(part.toolCallId, { confirmed: accepted });
|
|
4561
|
+
else onSubmit(part.toolCallId, accepted ? { answer } : {});
|
|
4562
|
+
};
|
|
4552
4563
|
if (decided) {
|
|
4553
4564
|
return /* @__PURE__ */ jsx14(DecidedSummary, { part, strings });
|
|
4554
4565
|
}
|
|
@@ -4570,7 +4581,7 @@ function ToolAskInput({ part, strings, active, onSubmit }) {
|
|
|
4570
4581
|
{
|
|
4571
4582
|
type: "button",
|
|
4572
4583
|
class: `${p13}-form-skip`,
|
|
4573
|
-
onClick: () =>
|
|
4584
|
+
onClick: () => resolve(void 0, false),
|
|
4574
4585
|
"data-testid": TID.toolInputSkip,
|
|
4575
4586
|
children: strings.reject
|
|
4576
4587
|
}
|
|
@@ -4580,7 +4591,7 @@ function ToolAskInput({ part, strings, active, onSubmit }) {
|
|
|
4580
4591
|
{
|
|
4581
4592
|
type: "button",
|
|
4582
4593
|
class: `${p13}-form-submit`,
|
|
4583
|
-
onClick: () =>
|
|
4594
|
+
onClick: () => resolve(void 0, true),
|
|
4584
4595
|
"data-testid": TID.toolInputSubmit,
|
|
4585
4596
|
children: strings.approve
|
|
4586
4597
|
}
|
|
@@ -4591,9 +4602,9 @@ function ToolAskInput({ part, strings, active, onSubmit }) {
|
|
|
4591
4602
|
fields: askInputToFields(req),
|
|
4592
4603
|
strings,
|
|
4593
4604
|
submitLabel: strings.inputSubmit,
|
|
4594
|
-
onSubmit: (values) =>
|
|
4605
|
+
onSubmit: (values) => resolve(values.answer ?? Object.values(values).join(", "), true),
|
|
4595
4606
|
skipLabel: req.required === false ? strings.inputSkip : void 0,
|
|
4596
|
-
onSkip: req.required === false ? () =>
|
|
4607
|
+
onSkip: req.required === false ? () => resolve(void 0, false) : void 0,
|
|
4597
4608
|
submitTestId: TID.toolInputSubmit,
|
|
4598
4609
|
skipTestId: TID.toolInputSkip
|
|
4599
4610
|
}
|
|
@@ -4608,10 +4619,12 @@ function Header({ strings, title }) {
|
|
|
4608
4619
|
}
|
|
4609
4620
|
function DecidedSummary({ part, strings }) {
|
|
4610
4621
|
const output = useComputed3(() => part.outputSig.value);
|
|
4611
|
-
const
|
|
4622
|
+
const approval = useComputed3(() => part.approvalSig.value);
|
|
4623
|
+
const answer = approval.value?.approved !== void 0 ? approval.value.reason ?? "" : summarizeOutput(output.value);
|
|
4624
|
+
const skipped = approval.value?.approved === false;
|
|
4612
4625
|
return /* @__PURE__ */ jsxs11("div", { class: `${p13}-tool-ask-input ${p13}-tool-decided`, "data-testid": TID.toolDecision, children: [
|
|
4613
|
-
/* @__PURE__ */ jsx14("span", { class: `${p13}-tool-decided-label`, children: strings.inputSubmitted }),
|
|
4614
|
-
/* @__PURE__ */ jsx14("span", { class: `${p13}-tool-decided-value`, children:
|
|
4626
|
+
/* @__PURE__ */ jsx14("span", { class: `${p13}-tool-decided-label`, children: skipped ? strings.inputSkip : strings.inputSubmitted }),
|
|
4627
|
+
/* @__PURE__ */ jsx14("span", { class: `${p13}-tool-decided-value`, children: skipped ? "" : answer || strings.inputSubmitted })
|
|
4615
4628
|
] });
|
|
4616
4629
|
}
|
|
4617
4630
|
function summarizeOutput(output) {
|
|
@@ -4741,12 +4754,21 @@ function ToolPartView({
|
|
|
4741
4754
|
const state = useComputed4(() => part.stateSig.value);
|
|
4742
4755
|
const hasApproval = useComputed4(() => part.approvalSig.value !== void 0);
|
|
4743
4756
|
if (tool?.humanInLoop) {
|
|
4757
|
+
if (isAskUserInputTool(part.toolName) || state.value === "awaiting-input") {
|
|
4758
|
+
return /* @__PURE__ */ jsx16(
|
|
4759
|
+
ToolAskInput,
|
|
4760
|
+
{
|
|
4761
|
+
part,
|
|
4762
|
+
strings,
|
|
4763
|
+
active: interactive,
|
|
4764
|
+
onSubmit: tool.onResult,
|
|
4765
|
+
onDecision: tool.onDecision
|
|
4766
|
+
}
|
|
4767
|
+
);
|
|
4768
|
+
}
|
|
4744
4769
|
if (hasApproval.value || state.value === "awaiting-approval") {
|
|
4745
4770
|
return /* @__PURE__ */ jsx16(ToolApproval, { part, strings, active: interactive, onDecision: tool.onDecision });
|
|
4746
4771
|
}
|
|
4747
|
-
if (isAskUserInputTool(part.toolName) || state.value === "awaiting-input") {
|
|
4748
|
-
return /* @__PURE__ */ jsx16(ToolAskInput, { part, strings, active: interactive, onSubmit: tool.onResult });
|
|
4749
|
-
}
|
|
4750
4772
|
}
|
|
4751
4773
|
return showToolCalls ? /* @__PURE__ */ jsx16(ToolChip, { part, strings }) : null;
|
|
4752
4774
|
}
|