@squadico/chatbot 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +110 -20
- package/dist/answer-CDGrP8YE.js +1193 -0
- package/dist/answer-CDGrP8YE.js.map +1 -0
- package/dist/answer-DRaV2dVt.cjs +8 -0
- package/dist/answer-DRaV2dVt.cjs.map +1 -0
- package/dist/chatbot-widgets.global.js +4 -0
- package/dist/chatbot-widgets.global.js.map +1 -0
- package/dist/chatbot.global.js +12 -7
- package/dist/chatbot.global.js.map +1 -1
- package/dist/components/ChatbotWidget.d.ts.map +1 -1
- package/dist/components/MessageList.d.ts +4 -1
- package/dist/components/MessageList.d.ts.map +1 -1
- package/dist/components/RichText.d.ts +6 -4
- package/dist/components/RichText.d.ts.map +1 -1
- package/dist/element.d.ts.map +1 -1
- package/dist/extras-ClIRRLqo.js +604 -0
- package/dist/extras-ClIRRLqo.js.map +1 -0
- package/dist/extras-lsCe4xgN.cjs +4 -0
- package/dist/extras-lsCe4xgN.cjs.map +1 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -2
- package/dist/jsx.d.ts +41 -0
- package/dist/jsx.d.ts.map +1 -1
- package/dist/lib/client.d.ts +8 -4
- package/dist/lib/client.d.ts.map +1 -1
- package/dist/lib/conversation.d.ts +5 -1
- package/dist/lib/conversation.d.ts.map +1 -1
- package/dist/lib/i18n.d.ts +20 -0
- package/dist/lib/i18n.d.ts.map +1 -1
- package/dist/lib/useChat.d.ts +6 -0
- package/dist/lib/useChat.d.ts.map +1 -1
- package/dist/react.cjs +1 -1
- package/dist/react.cjs.map +1 -1
- package/dist/react.d.ts.map +1 -1
- package/dist/react.js +2 -2
- package/dist/react.js.map +1 -1
- package/dist/src-BWDC0W4O.js +2005 -0
- package/dist/src-BWDC0W4O.js.map +1 -0
- package/dist/src-DvrmRR89.cjs +7 -0
- package/dist/src-DvrmRR89.cjs.map +1 -0
- package/dist/types.d.ts +16 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/widgets/approval/SqcApproval.d.ts +17 -0
- package/dist/widgets/approval/SqcApproval.d.ts.map +1 -0
- package/dist/widgets/approval/name.d.ts +3 -0
- package/dist/widgets/approval/name.d.ts.map +1 -0
- package/dist/widgets/chart/SqcChart.d.ts +19 -0
- package/dist/widgets/chart/SqcChart.d.ts.map +1 -0
- package/dist/widgets/chart/draw.d.ts +31 -0
- package/dist/widgets/chart/draw.d.ts.map +1 -0
- package/dist/widgets/chart/png.d.ts +10 -0
- package/dist/widgets/chart/png.d.ts.map +1 -0
- package/dist/widgets/chart/read.d.ts +11 -0
- package/dist/widgets/chart/read.d.ts.map +1 -0
- package/dist/widgets/chart/strings.d.ts +32 -0
- package/dist/widgets/chart/strings.d.ts.map +1 -0
- package/dist/widgets/choices/SqcChoices.d.ts +17 -0
- package/dist/widgets/choices/SqcChoices.d.ts.map +1 -0
- package/dist/widgets/confirm/SqcConfirm.d.ts +12 -0
- package/dist/widgets/confirm/SqcConfirm.d.ts.map +1 -0
- package/dist/widgets/define.d.ts +8 -0
- package/dist/widgets/define.d.ts.map +1 -0
- package/dist/widgets/element.d.ts +26 -0
- package/dist/widgets/element.d.ts.map +1 -0
- package/dist/widgets/extras-loader.d.ts +21 -0
- package/dist/widgets/extras-loader.d.ts.map +1 -0
- package/dist/widgets/extras.d.ts +3 -0
- package/dist/widgets/extras.d.ts.map +1 -0
- package/dist/widgets/extras.global.d.ts +2 -0
- package/dist/widgets/extras.global.d.ts.map +1 -0
- package/dist/widgets/form/SqcForm.d.ts +14 -0
- package/dist/widgets/form/SqcForm.d.ts.map +1 -0
- package/dist/widgets/form/reply.d.ts +7 -0
- package/dist/widgets/form/reply.d.ts.map +1 -0
- package/dist/widgets/i18n.d.ts +4 -0
- package/dist/widgets/i18n.d.ts.map +1 -0
- package/dist/widgets/index.d.ts +10 -0
- package/dist/widgets/index.d.ts.map +1 -0
- package/dist/widgets/inline.d.ts +11 -0
- package/dist/widgets/inline.d.ts.map +1 -0
- package/dist/widgets/live.d.ts +12 -0
- package/dist/widgets/live.d.ts.map +1 -0
- package/dist/widgets/names.d.ts +10 -0
- package/dist/widgets/names.d.ts.map +1 -0
- package/dist/widgets/parse/answer.d.ts +11 -0
- package/dist/widgets/parse/answer.d.ts.map +1 -0
- package/dist/widgets/parse/confirm.d.ts +19 -0
- package/dist/widgets/parse/confirm.d.ts.map +1 -0
- package/dist/widgets/parse/form.d.ts +6 -0
- package/dist/widgets/parse/form.d.ts.map +1 -0
- package/dist/widgets/styles.d.ts +3 -0
- package/dist/widgets/styles.d.ts.map +1 -0
- package/dist/widgets/table/SqcTable.d.ts +16 -0
- package/dist/widgets/table/SqcTable.d.ts.map +1 -0
- package/dist/widgets/types.d.ts +68 -0
- package/dist/widgets/types.d.ts.map +1 -0
- package/dist/widgets.cjs +1 -0
- package/dist/widgets.js +3 -0
- package/package.json +7 -2
- package/dist/components/Approval.d.ts +0 -37
- package/dist/components/Approval.d.ts.map +0 -1
- package/dist/components/Choices.d.ts +0 -27
- package/dist/components/Choices.d.ts.map +0 -1
- package/dist/components/Confirm.d.ts +0 -16
- package/dist/components/Confirm.d.ts.map +0 -1
- package/dist/lib/confirm.d.ts +0 -17
- package/dist/lib/confirm.d.ts.map +0 -1
- package/dist/src-DcJyi601.cjs +0 -8
- package/dist/src-DcJyi601.cjs.map +0 -1
- package/dist/src-Nh5rZvti.js +0 -2710
- package/dist/src-Nh5rZvti.js.map +0 -1
package/dist/types.d.ts
CHANGED
|
@@ -39,8 +39,8 @@ export interface HostUser {
|
|
|
39
39
|
* refused.
|
|
40
40
|
*/
|
|
41
41
|
export type SubjectTokenSource = () => string | null | undefined | Promise<string | null | undefined>;
|
|
42
|
-
/** What a file
|
|
43
|
-
export type ChatAttachmentKind = 'image' | 'document';
|
|
42
|
+
/** What a file of a turn is: a picture, a document read as text, or a chart an agent drew. */
|
|
43
|
+
export type ChatAttachmentKind = 'image' | 'document' | 'chart';
|
|
44
44
|
/**
|
|
45
45
|
* One file attached to a question, as the panel knows it.
|
|
46
46
|
*
|
|
@@ -54,6 +54,12 @@ export interface ChatAttachment {
|
|
|
54
54
|
filename: string;
|
|
55
55
|
contentType: string;
|
|
56
56
|
}
|
|
57
|
+
/**
|
|
58
|
+
* What an agent is busy with before it writes: searching its knowledge, following
|
|
59
|
+
* a skill, asking a member of its team, or using some other tool. A kind of work,
|
|
60
|
+
* never the tool itself — its name and arguments are not the visitor's to read.
|
|
61
|
+
*/
|
|
62
|
+
export type ChatActivity = 'knowledge' | 'skill' | 'delegation' | 'tool';
|
|
57
63
|
export interface ChatMessage {
|
|
58
64
|
id: string;
|
|
59
65
|
role: ChatRole;
|
|
@@ -65,6 +71,9 @@ export interface ChatMessage {
|
|
|
65
71
|
createdAt: number;
|
|
66
72
|
/** `true` while SSE tokens are still coming in. */
|
|
67
73
|
streaming?: boolean;
|
|
74
|
+
/** What the agent is doing while the answer has no words yet. Cleared by the
|
|
75
|
+
* first one. */
|
|
76
|
+
activity?: ChatActivity;
|
|
68
77
|
/** `true` when the message carries an error instead of an answer. */
|
|
69
78
|
error?: boolean;
|
|
70
79
|
/** Which agent wrote it, on an application that holds several. Absent on a
|
|
@@ -236,6 +245,10 @@ export interface ChatbotOptions {
|
|
|
236
245
|
* than relabelling the old one.
|
|
237
246
|
*/
|
|
238
247
|
user?: HostUser;
|
|
248
|
+
/** Partitions conversations the way the host does (an organization, a workspace).
|
|
249
|
+
* A conversation is only ever resumed under the scope it was opened with, and
|
|
250
|
+
* changing it at runtime opens a new one, as for `user`. */
|
|
251
|
+
scope?: string;
|
|
239
252
|
/** The access token of the site's signed-in user, for connectors acting as them.
|
|
240
253
|
* A function, so it can only be set from script — see `SubjectTokenSource`. */
|
|
241
254
|
getSubjectToken?: SubjectTokenSource;
|
|
@@ -312,6 +325,7 @@ export interface SquadicoChatbotElement extends HTMLElement {
|
|
|
312
325
|
context?: ChatbotContext;
|
|
313
326
|
embedKey?: string;
|
|
314
327
|
user?: HostUser;
|
|
328
|
+
scope?: string;
|
|
315
329
|
/** Set from script only: a function has no attribute form. */
|
|
316
330
|
getSubjectToken?: SubjectTokenSource;
|
|
317
331
|
agent?: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAA;AAE3C;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;2DACuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAC7B,MAAM,GACN,IAAI,GACJ,SAAS,GACT,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAA;AAEtC
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,WAAW,CAAA;AAE3C;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;2DACuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,kBAAkB,GAAG,MAC7B,MAAM,GACN,IAAI,GACJ,SAAS,GACT,OAAO,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAA;AAEtC,8FAA8F;AAC9F,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,UAAU,GAAG,OAAO,CAAA;AAE/D;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ACrB;4EACwE;IACxE,WAAW,CAAC,EAAE,OAAO,CAAA;IAErB;;;;;;;;;;;;OAYG;IACH,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB;AAED;;;GAGG;AACH,MAAM,WAAW,sBAAuB,SAAQ,WAAW;IACzD,OAAO,CAAC,EAAE,cAAc,CAAA;IACxB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,QAAQ,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,8DAA8D;IAC9D,eAAe,CAAC,EAAE,kBAAkB,CAAA;IACpC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,sDAAsD;IACtD,IAAI,EAAE,OAAO,CAAA;IACb,QAAQ,IAAI,IAAI,CAAA;IAChB,SAAS,IAAI,IAAI,CAAA;IACjB,UAAU,IAAI,IAAI,CAAA;IAClB,2EAA2E;IAC3E,KAAK,IAAI,IAAI,CAAA;IACb,uEAAuE;IACvE,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IAC/B;gCAC4B;IAC5B,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,gBAAgB,CAAC,CAAC,SAAS,gBAAgB,EACzC,IAAI,EAAE,CAAC,EACP,QAAQ,EAAE,CAAC,KAAK,EAAE,WAAW,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,EAC1D,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI,CAAA;IACP,gBAAgB,CACd,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,kCAAkC,EAC5C,OAAO,CAAC,EAAE,OAAO,GAAG,uBAAuB,GAC1C,IAAI,CAAA;CACR"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { JSX } from 'preact';
|
|
2
|
+
import type { PendingApproval } from '../../types';
|
|
3
|
+
import type { WidgetBase } from '../element';
|
|
4
|
+
export interface ApprovalProps {
|
|
5
|
+
/** The paused call, when the agent asked for it without a word of its own. */
|
|
6
|
+
call?: PendingApproval;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Decision on a tool call the agent stopped before making: yes, or no.
|
|
10
|
+
*
|
|
11
|
+
* Answers with `sqc-decision` rather than `sqc-reply`: a decision releases the
|
|
12
|
+
* call, it is not a message. The model's values are drawn as text, never markup.
|
|
13
|
+
* Once decided (or locked by the host) the group is frozen, and a call is not
|
|
14
|
+
* approved twice.
|
|
15
|
+
*/
|
|
16
|
+
export declare function SqcApproval({ call, locked, language, }: ApprovalProps & Pick<WidgetBase, 'locked' | 'language'>): JSX.Element;
|
|
17
|
+
//# sourceMappingURL=SqcApproval.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SqcApproval.d.ts","sourceRoot":"","sources":["../../../src/widgets/approval/SqcApproval.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAGjC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAElD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAG5C,MAAM,WAAW,aAAa;IAC5B,8EAA8E;IAC9E,IAAI,CAAC,EAAE,eAAe,CAAA;CACvB;AAWD;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,MAAM,EACN,QAAQ,GACT,EAAE,aAAa,GAAG,IAAI,CAAC,UAAU,EAAE,QAAQ,GAAG,UAAU,CAAC,GAAG,GAAG,CAAC,OAAO,CAsDvE"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"name.d.ts","sourceRoot":"","sources":["../../../src/widgets/approval/name.ts"],"names":[],"mappings":"AAKA,iFAAiF;AACjF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAS7C"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { JSX } from 'preact';
|
|
2
|
+
import type { WidgetBase } from '../element';
|
|
3
|
+
import type { ReadChart } from '../types';
|
|
4
|
+
interface ChartProps {
|
|
5
|
+
/** The chart, already read. */
|
|
6
|
+
chart?: ReadChart;
|
|
7
|
+
/** Or the text of the chart file, now or as it arrives: read here, where its reader lives. */
|
|
8
|
+
body?: string | Promise<string>;
|
|
9
|
+
/** Shown while the file loads, when it is not a chart, and as the title of an untitled one. */
|
|
10
|
+
filename?: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* A chart an agent drew, under its answer: title, legend, the drawing with a
|
|
14
|
+
* tooltip, its figures on demand, and a PNG to keep. Read-only — it answers
|
|
15
|
+
* nothing, so it never replies or locks.
|
|
16
|
+
*/
|
|
17
|
+
export declare function SqcChart(props: ChartProps & WidgetBase): JSX.Element;
|
|
18
|
+
export {};
|
|
19
|
+
//# sourceMappingURL=SqcChart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SqcChart.d.ts","sourceRoot":"","sources":["../../../src/widgets/chart/SqcChart.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAEjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAC5C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAMzC,UAAU,UAAU;IAClB,+BAA+B;IAC/B,KAAK,CAAC,EAAE,SAAS,CAAA;IACjB,8FAA8F;IAC9F,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAA;IAC/B,+FAA+F;IAC/F,QAAQ,CAAC,EAAE,MAAM,CAAA;CAClB;AAqDD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,UAAU,GAAG,GAAG,CAAC,OAAO,CA8EpE"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A chart drawn by hand in SVG: bars (grouped, stacked, horizontal), lines,
|
|
3
|
+
* areas, a pie or a donut, a scatter. No chart library — the widget carries
|
|
4
|
+
* its own weight to every host page.
|
|
5
|
+
*
|
|
6
|
+
* Drawn in a fixed `viewBox` scaled to the width it is given. Every colour is
|
|
7
|
+
* written inline, as a `var(--sqc-series-N, default)`, so a host can theme the
|
|
8
|
+
* series and the PNG export (which loses the stylesheet) can resolve them.
|
|
9
|
+
* Labels from the model are text nodes: whatever markup they hold stays inert.
|
|
10
|
+
*/
|
|
11
|
+
import type { JSX } from 'preact';
|
|
12
|
+
import type { ReadChart } from '../types';
|
|
13
|
+
export declare const WIDTH = 560;
|
|
14
|
+
export declare const HEIGHT = 280;
|
|
15
|
+
/** The colour of series `index`; the backend refuses more series than there are colours. */
|
|
16
|
+
export declare function seriesColour(index: number): string;
|
|
17
|
+
/** What the tooltip says about the mark under the pointer, placed in `viewBox` units. */
|
|
18
|
+
export interface Tip {
|
|
19
|
+
x: number;
|
|
20
|
+
y: number;
|
|
21
|
+
title: string;
|
|
22
|
+
line: string;
|
|
23
|
+
}
|
|
24
|
+
interface DrawProps {
|
|
25
|
+
chart: ReadChart;
|
|
26
|
+
format: (value: number) => string;
|
|
27
|
+
onTip: (tip: Tip | null) => void;
|
|
28
|
+
}
|
|
29
|
+
export declare function ChartDrawing({ chart, format, onTip }: DrawProps): JSX.Element;
|
|
30
|
+
export {};
|
|
31
|
+
//# sourceMappingURL=draw.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"draw.d.ts","sourceRoot":"","sources":["../../../src/widgets/chart/draw.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AACjC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAA;AAEzC,eAAO,MAAM,KAAK,MAAM,CAAA;AACxB,eAAO,MAAM,MAAM,MAAM,CAAA;AAIzB,4FAA4F;AAC5F,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAGlD;AAED,yFAAyF;AACzF,MAAM,WAAW,GAAG;IAClB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;IACT,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;CACb;AAED,UAAU,SAAS;IACjB,KAAK,EAAE,SAAS,CAAA;IAChB,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACjC,KAAK,EAAE,CAAC,GAAG,EAAE,GAAG,GAAG,IAAI,KAAK,IAAI,CAAA;CACjC;AAuGD,wBAAgB,YAAY,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,CAgN7E"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The drawn chart as a PNG the visitor keeps.
|
|
3
|
+
*
|
|
4
|
+
* The SVG is serialised and painted on a canvas. Its colours are custom
|
|
5
|
+
* properties, which mean nothing outside the page: each `var(--x, fallback)`
|
|
6
|
+
* is swapped for what it resolves to on the element, so the picture is the
|
|
7
|
+
* chart in the theme it was seen in.
|
|
8
|
+
*/
|
|
9
|
+
export declare function downloadPng(svg: SVGSVGElement, host: Element, filename: string): void;
|
|
10
|
+
//# sourceMappingURL=png.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"png.d.ts","sourceRoot":"","sources":["../../../src/widgets/chart/png.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,GAAG,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAmCrF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The chart in a file `show_chart` wrote (`apps/backend/app/agents/builtins/charts.py`),
|
|
3
|
+
* or `null` for something that is not one.
|
|
4
|
+
*
|
|
5
|
+
* Read defensively: the file came from a model, through a tool that checked it,
|
|
6
|
+
* and a screen still owes the visitor a name rather than a crash if it is not
|
|
7
|
+
* what it should be.
|
|
8
|
+
*/
|
|
9
|
+
import { type ReadChart } from '../types';
|
|
10
|
+
export declare function readChart(body: string): ReadChart | null;
|
|
11
|
+
//# sourceMappingURL=read.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"read.d.ts","sourceRoot":"","sources":["../../../src/widgets/chart/read.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAML,KAAK,SAAS,EAEf,MAAM,UAAU,CAAA;AAkCjB,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CA2BxD"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { LanguageCode } from '../../lib/i18n';
|
|
2
|
+
/**
|
|
3
|
+
* The copy of `<sqc-chart>`. Kept beside it rather than in the chat's strings:
|
|
4
|
+
* the chart ships in the extras file, and the chat's own budget is spent.
|
|
5
|
+
*/
|
|
6
|
+
declare const STRINGS: {
|
|
7
|
+
en: {
|
|
8
|
+
download: string;
|
|
9
|
+
show: string;
|
|
10
|
+
hide: string;
|
|
11
|
+
category: string;
|
|
12
|
+
series: string;
|
|
13
|
+
};
|
|
14
|
+
fr: {
|
|
15
|
+
download: string;
|
|
16
|
+
show: string;
|
|
17
|
+
hide: string;
|
|
18
|
+
category: string;
|
|
19
|
+
series: string;
|
|
20
|
+
};
|
|
21
|
+
es: {
|
|
22
|
+
download: string;
|
|
23
|
+
show: string;
|
|
24
|
+
hide: string;
|
|
25
|
+
category: string;
|
|
26
|
+
series: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
export type ChartStrings = (typeof STRINGS)['en'];
|
|
30
|
+
export declare function chartStrings(language: LanguageCode): ChartStrings;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=strings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strings.d.ts","sourceRoot":"","sources":["../../../src/widgets/chart/strings.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAElD;;;GAGG;AACH,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;CAsBZ,CAAA;AAED,MAAM,MAAM,YAAY,GAAG,CAAC,OAAO,OAAO,CAAC,CAAC,IAAI,CAAC,CAAA;AAEjD,wBAAgB,YAAY,CAAC,QAAQ,EAAE,YAAY,GAAG,YAAY,CAEjE"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { JSX } from 'preact';
|
|
2
|
+
import type { WidgetBase } from '../element';
|
|
3
|
+
interface ChoicesProps {
|
|
4
|
+
options: string[];
|
|
5
|
+
multiple?: boolean;
|
|
6
|
+
/** Options pre-ticked by the Markdown (`- (x) …`, `- [x] …`). */
|
|
7
|
+
checked?: string[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Options offered by the assistant. Single, drawn with round marks: one click
|
|
11
|
+
* answers with the label.
|
|
12
|
+
* Multiple: tick any, then one button sends the labels comma-joined. The label
|
|
13
|
+
* sent is stripped of its markup — the agent matches candidates by name.
|
|
14
|
+
*/
|
|
15
|
+
export declare function SqcChoices({ options, multiple, checked, locked, language, reply, }: ChoicesProps & WidgetBase): JSX.Element;
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=SqcChoices.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SqcChoices.d.ts","sourceRoot":"","sources":["../../../src/widgets/choices/SqcChoices.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAEjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAI5C,UAAU,YAAY;IACpB,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,iEAAiE;IACjE,OAAO,CAAC,EAAE,MAAM,EAAE,CAAA;CACnB;AAUD;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,EACzB,OAAY,EACZ,QAAQ,EACR,OAAO,EACP,MAAM,EACN,QAAQ,EACR,KAAK,GACN,EAAE,YAAY,GAAG,UAAU,GAAG,GAAG,CAAC,OAAO,CAwDzC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { JSX } from 'preact';
|
|
2
|
+
import type { WidgetBase } from '../element';
|
|
3
|
+
/**
|
|
4
|
+
* Yes / No under a closed question. A bare "yes" is recognised agent-side
|
|
5
|
+
* without a model call, so the word sent is the one of the visitor's language.
|
|
6
|
+
*
|
|
7
|
+
* The third button sends nothing: it asks the host, through `sqc-compose`, to
|
|
8
|
+
* hand the visitor the composer. The widget stays live until their message
|
|
9
|
+
* arrives — they may still change their mind and click Yes.
|
|
10
|
+
*/
|
|
11
|
+
export declare function SqcConfirm({ locked, language, reply }: WidgetBase): JSX.Element;
|
|
12
|
+
//# sourceMappingURL=SqcConfirm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SqcConfirm.d.ts","sourceRoot":"","sources":["../../../src/widgets/confirm/SqcConfirm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAGjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C;;;;;;;GAOG;AACH,wBAAgB,UAAU,CAAC,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,UAAU,GAAG,GAAG,CAAC,OAAO,CAuC/E"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { WIDGET_TAGS } from './names';
|
|
2
|
+
/**
|
|
3
|
+
* Registers the widget elements every answer may hold. Idempotent; does nothing
|
|
4
|
+
* where there is no DOM. The heavier, rarer ones (form, chart, approval) live
|
|
5
|
+
* in `./extras`.
|
|
6
|
+
*/
|
|
7
|
+
export declare function defineChatWidgets(): void;
|
|
8
|
+
//# sourceMappingURL=define.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"define.d.ts","sourceRoot":"","sources":["../../src/widgets/define.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,IAAI,CAcxC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime shared by every widget element (`<sqc-table>`, `<sqc-choices>`…).
|
|
3
|
+
*
|
|
4
|
+
* An element is a Preact component in a shadow root, driven by properties and
|
|
5
|
+
* answering through one DOM event, so the chat widget and any other host (the
|
|
6
|
+
* console) use it the same way and know nothing of what is inside.
|
|
7
|
+
*
|
|
8
|
+
* The class is built when `createWidgetElement` is called — from
|
|
9
|
+
* `defineChatWidgets()`, never at module level — because `class X extends
|
|
10
|
+
* HTMLElement` throws on a server-side import.
|
|
11
|
+
*/
|
|
12
|
+
import { type FunctionComponent } from 'preact';
|
|
13
|
+
import type { LanguageCode } from '../lib/i18n';
|
|
14
|
+
export interface WidgetBase {
|
|
15
|
+
/** An answered or superseded widget: shown, no longer interactive. */
|
|
16
|
+
locked: boolean;
|
|
17
|
+
language: LanguageCode;
|
|
18
|
+
/** Sends text back as the visitor's answer, and locks the widget. */
|
|
19
|
+
reply: (text: string) => void;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* `css` is passed in rather than imported, so a bundle holding only some of
|
|
23
|
+
* the elements (the extras, loaded on first use) carries only their styles.
|
|
24
|
+
*/
|
|
25
|
+
export declare function createWidgetElement<P>(Component: FunctionComponent<P & WidgetBase>, props: (keyof P)[], css: string): CustomElementConstructor;
|
|
26
|
+
//# sourceMappingURL=element.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../../src/widgets/element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAa,KAAK,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAC1D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAA;AAE/C,MAAM,WAAW,UAAU;IACzB,sEAAsE;IACtE,MAAM,EAAE,OAAO,CAAA;IACf,QAAQ,EAAE,YAAY,CAAA;IACtB,qEAAqE;IACrE,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAC9B;AAkBD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EACnC,SAAS,EAAE,iBAAiB,CAAC,CAAC,GAAG,UAAU,CAAC,EAC5C,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC,EAAE,EAClB,GAAG,EAAE,MAAM,GACV,wBAAwB,CA6E1B"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* URL and CSP nonce of the running script. `currentScript` only holds while a
|
|
3
|
+
* classic script evaluates: null in a module script, where nothing is captured.
|
|
4
|
+
*/
|
|
5
|
+
export declare function captureScript(): {
|
|
6
|
+
src: string;
|
|
7
|
+
nonce: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Where the extras file sits for a main script at `src`: beside it, or in
|
|
11
|
+
* `dist/` under a short CDN URL (`…/@squadico/chatbot@1.5.0`), where jsDelivr
|
|
12
|
+
* and unpkg serve the main file named by the package's `jsdelivr` / `unpkg`
|
|
13
|
+
* fields.
|
|
14
|
+
*/
|
|
15
|
+
export declare function extrasUrl(src: string): string;
|
|
16
|
+
/** Appends a `<script>` for the extras file of the main script at `src`. */
|
|
17
|
+
export declare function injectScript(src: string, nonce?: string): Promise<void>;
|
|
18
|
+
/** Runs `load` once it has succeeded; a failure is logged and forgotten, so the next call tries again. */
|
|
19
|
+
export declare function retrying(load: () => Promise<void>): () => Promise<void>;
|
|
20
|
+
export declare const loadWidgetExtras: () => Promise<void>;
|
|
21
|
+
//# sourceMappingURL=extras-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extras-loader.d.ts","sourceRoot":"","sources":["../../src/widgets/extras-loader.ts"],"names":[],"mappings":"AAUA;;;GAGG;AACH,wBAAgB,aAAa,IAAI;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAG9D;AAKD;;;;;GAKG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAK7C;AAED,4EAA4E;AAC5E,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,SAAK,GAAG,OAAO,CAAC,IAAI,CAAC,CAiBnE;AAED,0GAA0G;AAC1G,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAOvE;AAED,eAAO,MAAM,gBAAgB,QAT8B,OAAO,CAAC,IAAI,CAatE,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extras.d.ts","sourceRoot":"","sources":["../../src/widgets/extras.ts"],"names":[],"mappings":"AAmBA,oFAAoF;AACpF,wBAAgB,kBAAkB,IAAI,IAAI,CAiBzC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"extras.global.d.ts","sourceRoot":"","sources":["../../src/widgets/extras.global.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { JSX } from 'preact';
|
|
2
|
+
import type { WidgetBase } from '../element';
|
|
3
|
+
import type { FormSpec } from '../types';
|
|
4
|
+
interface FormProps {
|
|
5
|
+
form?: FormSpec;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Fields the assistant asks for. Checked on submit (required, email, number);
|
|
9
|
+
* a valid form answers with `formReply` and locks. Labels are rendered as
|
|
10
|
+
* text: whatever markup the model wrote stays inert.
|
|
11
|
+
*/
|
|
12
|
+
export declare function SqcForm({ form, locked, language, reply }: FormProps & WidgetBase): JSX.Element;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=SqcForm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SqcForm.d.ts","sourceRoot":"","sources":["../../../src/widgets/form/SqcForm.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAGjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAE5C,OAAO,KAAK,EAAa,QAAQ,EAAE,MAAM,UAAU,CAAA;AAGnD,UAAU,SAAS;IACjB,IAAI,CAAC,EAAE,QAAQ,CAAA;CAChB;AAaD;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,EAAE,SAAS,GAAG,UAAU,GAAG,GAAG,CAAC,OAAO,CA6E9F"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { FormSpec } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* What a submitted form says to the agent: one `label : value` line per filled
|
|
4
|
+
* field, in the order the agent asked for them. An empty field is left out.
|
|
5
|
+
*/
|
|
6
|
+
export declare function formReply(form: FormSpec, values: Record<string, string>): string;
|
|
7
|
+
//# sourceMappingURL=reply.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reply.d.ts","sourceRoot":"","sources":["../../../src/widgets/form/reply.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC;;;GAGG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAMhF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"i18n.d.ts","sourceRoot":"","sources":["../../src/widgets/i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,YAAY,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAA;AAE5E,yEAAyE;AACzE,wBAAgB,OAAO,CAAC,QAAQ,EAAE,YAAY,GAAG,OAAO,CAEvD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** What a host needs to draw the widget elements. */
|
|
2
|
+
export { defineChatWidgets, WIDGET_TAGS } from './define';
|
|
3
|
+
export { defineWidgetExtras } from './extras';
|
|
4
|
+
export { loadWidgetExtras } from './extras-loader';
|
|
5
|
+
export { isLive } from './live';
|
|
6
|
+
export type { WidgetBase } from './element';
|
|
7
|
+
export type { WidgetBlock, ParsedAnswer, FormSpec, FormField, FieldType, ReadChart, ChartType, } from './types';
|
|
8
|
+
export { readChart } from './chart/read';
|
|
9
|
+
export { parseAnswer } from './parse/answer';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/widgets/index.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAA;AAC7C,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAA;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAC/B,YAAY,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AAC3C,YAAY,EACV,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,SAAS,EACT,SAAS,EACT,SAAS,EACT,SAAS,GACV,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inline Markdown shared by the answer text and the widget elements: emphasis,
|
|
3
|
+
* code, links. Everything is produced as Preact nodes, hence escaped by
|
|
4
|
+
* construction; a link is only rendered when its href is navigable.
|
|
5
|
+
*/
|
|
6
|
+
import type { JSX } from 'preact';
|
|
7
|
+
export type Inline = JSX.Element | string;
|
|
8
|
+
export declare function inline(text: string, keyPrefix: string): Inline[];
|
|
9
|
+
/** Text without markup: what the agent must receive when an option is clicked. */
|
|
10
|
+
export declare function plain(text: string): string;
|
|
11
|
+
//# sourceMappingURL=inline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"inline.d.ts","sourceRoot":"","sources":["../../src/widgets/inline.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAEjC,MAAM,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,GAAG,MAAM,CAAA;AAuBzC,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,EAAE,CA2BhE;AAED,kFAAkF;AAClF,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAK1C"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a message's widgets still await an answer.
|
|
3
|
+
*
|
|
4
|
+
* Only the last message, written by the assistant and finished, is waited on:
|
|
5
|
+
* anything followed by another message has been answered (or abandoned), which
|
|
6
|
+
* is what a reloaded transcript must show — locked, not live again.
|
|
7
|
+
*/
|
|
8
|
+
export declare function isLive(index: number, messages: readonly {
|
|
9
|
+
role: string;
|
|
10
|
+
streaming?: boolean;
|
|
11
|
+
}[]): boolean;
|
|
12
|
+
//# sourceMappingURL=live.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"live.d.ts","sourceRoot":"","sources":["../../src/widgets/live.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,wBAAgB,MAAM,CACpB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,SAAS;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,GACzD,OAAO,CAKT"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** Tag names of the widget elements, in a module of their own so either bundle can name them. */
|
|
2
|
+
export declare const WIDGET_TAGS: {
|
|
3
|
+
readonly table: "sqc-table";
|
|
4
|
+
readonly choices: "sqc-choices";
|
|
5
|
+
readonly confirm: "sqc-confirm";
|
|
6
|
+
readonly form: "sqc-form";
|
|
7
|
+
readonly chart: "sqc-chart";
|
|
8
|
+
readonly approval: "sqc-approval";
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=names.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"names.d.ts","sourceRoot":"","sources":["../../src/widgets/names.ts"],"names":[],"mappings":"AAAA,iGAAiG;AACjG,eAAO,MAAM,WAAW;;;;;;;CAOd,CAAA"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LanguageCode } from '../../lib/i18n';
|
|
2
|
+
import type { ParsedAnswer } from '../types';
|
|
3
|
+
/**
|
|
4
|
+
* Splits an answer into markdown, table, choices and form blocks. A fence that
|
|
5
|
+
* is invalid, unknown or still open (answer streaming) stays markdown, verbatim.
|
|
6
|
+
*
|
|
7
|
+
* `confirmable`: whether Yes / No buttons may go under this answer. Where they
|
|
8
|
+
* do, the `(yes/no)` marker that asked for them is not shown.
|
|
9
|
+
*/
|
|
10
|
+
export declare function parseAnswer(text: string, language: LanguageCode, confirmable?: boolean): ParsedAnswer;
|
|
11
|
+
//# sourceMappingURL=answer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"answer.d.ts","sourceRoot":"","sources":["../../../src/widgets/parse/answer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAClD,OAAO,KAAK,EAAE,YAAY,EAAe,MAAM,UAAU,CAAA;AAuBzD;;;;;;GAMG;AACH,wBAAgB,WAAW,CACzB,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,YAAY,EACtB,WAAW,UAAO,GACjB,YAAY,CAuFd"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Detection of the assistant's closed questions, so "Yes" / "No" can be offered
|
|
3
|
+
* instead of making the user retype the answer.
|
|
4
|
+
*
|
|
5
|
+
* The `Chat display` skill (apps/backend/app/agents/display_skill.py) has the
|
|
6
|
+
* agent mark such a question explicitly: its last line ends with `(yes/no)`,
|
|
7
|
+
* `(oui/non)` or `(sí/no)`, a marker hidden once the buttons are drawn.
|
|
8
|
+
*
|
|
9
|
+
* An agent without the skill writes no marker, so the phrasings agents actually
|
|
10
|
+
* produce are recognised too, as a fallback. That list is deliberately narrow:
|
|
11
|
+
* an open question ("Which records would you like to see?") must not bring up
|
|
12
|
+
* buttons. It is keyed by language, the widget's locale picking the set — a
|
|
13
|
+
* single English set would leave a French-speaking host without buttons.
|
|
14
|
+
*/
|
|
15
|
+
import { type LanguageCode } from '../../lib/i18n';
|
|
16
|
+
/** The answer without its closing yes/no marker. */
|
|
17
|
+
export declare function unmark(text: string): string;
|
|
18
|
+
export declare function isConfirmationPrompt(text: string, language?: LanguageCode): boolean;
|
|
19
|
+
//# sourceMappingURL=confirm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"confirm.d.ts","sourceRoot":"","sources":["../../../src/widgets/parse/confirm.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAoB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAA;AA2CpE,oDAAoD;AACpD,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE3C;AAED,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,MAAM,EACZ,QAAQ,GAAE,YAA+B,GACxC,OAAO,CAeT"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FormSpec } from '../types';
|
|
2
|
+
export declare const MAX_OPTIONS = 20;
|
|
3
|
+
export declare const MAX_FIELDS = 12;
|
|
4
|
+
/** A `form` fence body, or `null` when it is not valid or exceeds the limits. */
|
|
5
|
+
export declare function readForm(json: string): FormSpec | null;
|
|
6
|
+
//# sourceMappingURL=form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../../src/widgets/parse/form.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAwB,QAAQ,EAAE,MAAM,UAAU,CAAA;AAE9D,eAAO,MAAM,WAAW,KAAK,CAAA;AAC7B,eAAO,MAAM,UAAU,KAAK,CAAA;AA2C5B,iFAAiF;AACjF,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI,CAgBtD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../src/widgets/styles.ts"],"names":[],"mappings":"AAKA,mFAAmF;AACnF,eAAO,MAAM,UAAU,QAA8C,CAAA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { JSX } from 'preact';
|
|
2
|
+
import type { WidgetBase } from '../element';
|
|
3
|
+
interface TableProps {
|
|
4
|
+
table: {
|
|
5
|
+
header: string[];
|
|
6
|
+
rows: string[][];
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* A record listing: click a header to sort (numbers by value), at most 200
|
|
11
|
+
* rows drawn, the whole table copied as TSV. Cells are inline Markdown turned
|
|
12
|
+
* into nodes, never HTML.
|
|
13
|
+
*/
|
|
14
|
+
export declare function SqcTable({ table, language }: TableProps & WidgetBase): JSX.Element;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=SqcTable.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SqcTable.d.ts","sourceRoot":"","sources":["../../../src/widgets/table/SqcTable.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,QAAQ,CAAA;AAEjC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAA;AAM5C,UAAU,UAAU;IAClB,KAAK,EAAE;QAAE,MAAM,EAAE,MAAM,EAAE,CAAC;QAAC,IAAI,EAAE,MAAM,EAAE,EAAE,CAAA;KAAE,CAAA;CAC9C;AAOD;;;;GAIG;AACH,wBAAgB,QAAQ,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,UAAU,GAAG,UAAU,GAAG,GAAG,CAAC,OAAO,CA6ElF"}
|