@webority/mobile-chat 0.122.0 → 0.124.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.
Files changed (66) hide show
  1. package/README.md +39 -7
  2. package/lib/commonjs/components/ActionCard.js +1 -1
  3. package/lib/commonjs/components/ChatComposer.js +1 -1
  4. package/lib/commonjs/components/ChatConversationList.js +1 -1
  5. package/lib/commonjs/components/ChatLauncher.js +1 -1
  6. package/lib/commonjs/components/ChatMarkdown.js +1 -1
  7. package/lib/commonjs/components/ChatMessage.js +1 -1
  8. package/lib/commonjs/components/ChatScreen.js +1 -1
  9. package/lib/commonjs/components/ChatThread.js +1 -1
  10. package/lib/commonjs/components/ComposerAttachments.js +1 -0
  11. package/lib/commonjs/components/ReplyRating.js +1 -1
  12. package/lib/commonjs/index.js +1 -1
  13. package/lib/commonjs/useChat.js +1 -1
  14. package/lib/module/components/ActionCard.js +1 -1
  15. package/lib/module/components/ChatComposer.js +1 -1
  16. package/lib/module/components/ChatConversationList.js +1 -1
  17. package/lib/module/components/ChatLauncher.js +1 -1
  18. package/lib/module/components/ChatMarkdown.js +1 -1
  19. package/lib/module/components/ChatMessage.js +1 -1
  20. package/lib/module/components/ChatScreen.js +1 -1
  21. package/lib/module/components/ChatThread.js +1 -1
  22. package/lib/module/components/ComposerAttachments.js +1 -0
  23. package/lib/module/components/ReplyRating.js +1 -1
  24. package/lib/module/index.js +1 -1
  25. package/lib/module/useChat.js +1 -1
  26. package/lib/typescript/commonjs/components/ActionCard.d.ts +2 -2
  27. package/lib/typescript/commonjs/components/ChatComposer.d.ts +12 -1
  28. package/lib/typescript/commonjs/components/ChatConversationList.d.ts +3 -4
  29. package/lib/typescript/commonjs/components/ChatLauncher.d.ts +1 -1
  30. package/lib/typescript/commonjs/components/ChatMarkdown.d.ts +8 -1
  31. package/lib/typescript/commonjs/components/ChatMessage.d.ts +23 -6
  32. package/lib/typescript/commonjs/components/ChatScreen.d.ts +7 -2
  33. package/lib/typescript/commonjs/components/ChatThread.d.ts +9 -1
  34. package/lib/typescript/commonjs/components/ComposerAttachments.d.ts +12 -0
  35. package/lib/typescript/commonjs/components/ReplyRating.d.ts +2 -2
  36. package/lib/typescript/commonjs/index.d.ts +2 -7
  37. package/lib/typescript/commonjs/useChat.d.ts +9 -53
  38. package/lib/typescript/module/components/ActionCard.d.ts +2 -2
  39. package/lib/typescript/module/components/ChatComposer.d.ts +12 -1
  40. package/lib/typescript/module/components/ChatConversationList.d.ts +3 -4
  41. package/lib/typescript/module/components/ChatLauncher.d.ts +1 -1
  42. package/lib/typescript/module/components/ChatMarkdown.d.ts +8 -1
  43. package/lib/typescript/module/components/ChatMessage.d.ts +23 -6
  44. package/lib/typescript/module/components/ChatScreen.d.ts +7 -2
  45. package/lib/typescript/module/components/ChatThread.d.ts +9 -1
  46. package/lib/typescript/module/components/ComposerAttachments.d.ts +12 -0
  47. package/lib/typescript/module/components/ReplyRating.d.ts +2 -2
  48. package/lib/typescript/module/index.d.ts +2 -7
  49. package/lib/typescript/module/useChat.d.ts +9 -53
  50. package/package.json +8 -6
  51. package/lib/commonjs/client.js +0 -1
  52. package/lib/commonjs/labels.js +0 -1
  53. package/lib/commonjs/sse.js +0 -1
  54. package/lib/commonjs/types.js +0 -1
  55. package/lib/module/client.js +0 -1
  56. package/lib/module/labels.js +0 -1
  57. package/lib/module/sse.js +0 -1
  58. package/lib/module/types.js +0 -1
  59. package/lib/typescript/commonjs/client.d.ts +0 -73
  60. package/lib/typescript/commonjs/labels.d.ts +0 -63
  61. package/lib/typescript/commonjs/sse.d.ts +0 -23
  62. package/lib/typescript/commonjs/types.d.ts +0 -71
  63. package/lib/typescript/module/client.d.ts +0 -73
  64. package/lib/typescript/module/labels.d.ts +0 -63
  65. package/lib/typescript/module/sse.d.ts +0 -23
  66. package/lib/typescript/module/types.d.ts +0 -71
@@ -1 +0,0 @@
1
- "use strict";export const DEFAULT_CHAT_LABELS=Object.freeze({launcher:"Ask the assistant",panelTitle:"Assistant",newChat:"New chat",close:"Close",thread:"Conversation",you:"You",assistant:"Assistant",thinking:"Thinking",emptyTitle:"How can I help?",emptyText:"Ask a question about what you see on this page.",composer:"Your question",placeholder:"Ask a question",send:"Send",composerHint:"Press Enter to send, Shift and Enter for a new line.",allowance:e=>0===e?"You have no questions left today.":1===e?"You have 1 question left today.":`You have ${e} questions left today.`,disclaimer:"Answers are written by AI and can be wrong. Check anything important.",loadingConversation:"Loading the conversation",rateUp:"Helpful",rateDown:"Not helpful",rated:"Thanks for the feedback.",ratingNote:"What was wrong with this answer?",ratingNoteHint:"Optional.",ratingNoteSend:"Send",ratingNoteSkip:"Skip",ratingFailed:"Your rating did not save. Please try again.",actionRaiseTicket:"New support ticket",actionReply:e=>`Reply on ${e}`,actionReopen:e=>`Reopen ${e}`,actionNote:"Nothing is sent until you confirm.",actionConfirm:"Confirm",actionDismiss:"Not now",actionDismissed:"Not sent.",actionExpired:"This request expired and was not sent. Ask again if you still need it.",actionFailed:"We could not send this. Please try again.",actionDoneRaiseTicket:e=>`Ticket ${e} raised.`,actionDoneReply:e=>`Your reply was added to ${e}.`,actionDoneReopen:e=>`${e} is open again.`,viewTicket:"View ticket",conversations:"Past chats",conversationsEmptyTitle:"No past chats",conversationsEmptyText:"Your conversations with the assistant show here.",untitled:"Untitled chat",deleteConversation:"Delete chat",deleteConfirmTitle:"Delete this chat?",deleteConfirmMessage:"The conversation is removed for good.",deleteConfirm:"Delete",deleteFailed:"We could not delete this chat. Please try again.",cancel:"Cancel",loadMore:"Show more",loadFailed:"We could not load your chats. Please try again.",retry:"Try again"});export const mergeLabels=e=>e?{...DEFAULT_CHAT_LABELS,...e}:DEFAULT_CHAT_LABELS;
package/lib/module/sse.js DELETED
@@ -1 +0,0 @@
1
- "use strict";export const createSseParser=e=>{let t="";const dispatch=t=>{let n="message";const r=[];for(const e of t.split("\n")){if(""===e||e.startsWith(":"))continue;const t=e.indexOf(":"),s=-1===t?e:e.slice(0,t);let a=-1===t?"":e.slice(t+1);a.startsWith(" ")&&(a=a.slice(1)),"event"===s?n=a:"data"===s&&r.push(a)}if(0===r.length)return;let s;try{s=JSON.parse(r.join("\n"))}catch{return void e({name:"error",data:{code:"invalid-response",message:null}})}e({name:n,data:s})};return{push(e){if(!e)return;t=(t+e).replace(/\r\n/g,"\n").replace(/\r(?!$)/g,"\n");const n=t.split("\n\n");t=n.pop()??"";for(const e of n)dispatch(e)},end(){const e=t.replace(/\r$/,"");t="",e.trim()&&dispatch(e)}}};
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,73 +0,0 @@
1
- import type { ChatRatingInput, ChatStreamOptions, ChatTurnInput, ChatTurnResult, Conversation, ConversationSummary } from "./types";
2
- /** A failed chat request. `message` is written for the person and is safe to show as is. */
3
- export declare class ChatApiError extends Error {
4
- /**
5
- * The server's code (`daily_limit`, `assistant_unavailable`, ...), `network` when no response
6
- * arrived, `aborted` when the request was cancelled, `invalid-response`, or `unknown`.
7
- */
8
- readonly code: string;
9
- /** The HTTP status, when a response arrived. */
10
- readonly status: number | undefined;
11
- /** For `daily_limit`: when the allowance comes back, in UTC. */
12
- readonly resetsAtUtc: string | null;
13
- constructor(code: string, message: string, status?: number, resetsAtUtc?: string | null);
14
- }
15
- /** The axios config fields the chat client sets. */
16
- export interface ChatHttpRequestConfig {
17
- headers?: Record<string, string>;
18
- responseType?: "text";
19
- signal?: AbortSignal;
20
- onDownloadProgress?: (progress: unknown) => void;
21
- }
22
- /**
23
- * The slice of an HTTP client the chat client needs. The app's signed-in axios instance
24
- * (mobile-core's `userClient`, or its own) satisfies it as is, so the bearer token, tenant header
25
- * and refresh on 401 apply to chat calls too. Declared structurally so no axios type leaks into
26
- * this package's declarations.
27
- */
28
- export interface ChatHttpClient {
29
- get(url: string, config?: ChatHttpRequestConfig): Promise<{
30
- data: unknown;
31
- }>;
32
- post(url: string, body?: unknown, config?: ChatHttpRequestConfig): Promise<{
33
- data: unknown;
34
- status?: number;
35
- }>;
36
- put(url: string, body?: unknown, config?: ChatHttpRequestConfig): Promise<{
37
- data: unknown;
38
- }>;
39
- delete(url: string, config?: ChatHttpRequestConfig): Promise<{
40
- data: unknown;
41
- }>;
42
- }
43
- export interface ChatClient {
44
- /** `POST {base}/chat`, streamed; resolves with the `done` event. */
45
- sendMessage(input: ChatTurnInput, options?: ChatStreamOptions): Promise<ChatTurnResult>;
46
- /** `GET {base}/allowance`. */
47
- getAllowance(): Promise<{
48
- messagesLeftToday: number | null;
49
- }>;
50
- /** `GET {base}/conversations?skip=&take=`, newest first. */
51
- listConversations(query?: {
52
- skip?: number;
53
- take?: number;
54
- }): Promise<ConversationSummary[]>;
55
- /** `GET {base}/conversations/{id}`. */
56
- getConversation(id: string): Promise<Conversation>;
57
- /** `DELETE {base}/conversations/{id}`. */
58
- deleteConversation(id: string): Promise<void>;
59
- /** `PUT {base}/conversations/{conversationId}/messages/{messageId}/rating`. */
60
- rateMessage(conversationId: string, messageId: string, input: ChatRatingInput): Promise<void>;
61
- }
62
- /**
63
- * Binds the chat HTTP contract to the app's own signed-in axios instance. The package never
64
- * handles auth: tokens, tenant headers and refresh stay in the instance.
65
- *
66
- * @param http The app's axios instance, e.g. mobile-core's `userClient`.
67
- * @param options `base` is the prefix the API maps the chat endpoints under, e.g.
68
- * `/api/assistant` for `POST /api/assistant/chat`.
69
- */
70
- export declare const createChatClient: (http: ChatHttpClient, { base }: {
71
- base: string;
72
- }) => ChatClient;
73
- //# sourceMappingURL=client.d.ts.map
@@ -1,63 +0,0 @@
1
- export interface ChatLabels {
2
- launcher: string;
3
- panelTitle: string;
4
- newChat: string;
5
- close: string;
6
- thread: string;
7
- you: string;
8
- assistant: string;
9
- thinking: string;
10
- emptyTitle: string;
11
- emptyText: string;
12
- composer: string;
13
- placeholder: string;
14
- send: string;
15
- composerHint: string;
16
- allowance: (count: number) => string;
17
- disclaimer: string;
18
- loadingConversation: string;
19
- rateUp: string;
20
- rateDown: string;
21
- rated: string;
22
- ratingNote: string;
23
- ratingNoteHint: string;
24
- ratingNoteSend: string;
25
- ratingNoteSkip: string;
26
- ratingFailed: string;
27
- actionRaiseTicket: string;
28
- actionReply: (ticketNumber: string) => string;
29
- actionReopen: (ticketNumber: string) => string;
30
- actionNote: string;
31
- actionConfirm: string;
32
- actionDismiss: string;
33
- actionDismissed: string;
34
- actionExpired: string;
35
- actionFailed: string;
36
- actionDoneRaiseTicket: (ticketNumber: string) => string;
37
- actionDoneReply: (ticketNumber: string) => string;
38
- actionDoneReopen: (ticketNumber: string) => string;
39
- viewTicket: string;
40
- conversations: string;
41
- conversationsEmptyTitle: string;
42
- conversationsEmptyText: string;
43
- untitled: string;
44
- deleteConversation: string;
45
- deleteConfirmTitle: string;
46
- deleteConfirmMessage: string;
47
- deleteConfirm: string;
48
- deleteFailed: string;
49
- cancel: string;
50
- loadMore: string;
51
- loadFailed: string;
52
- retry: string;
53
- }
54
- /**
55
- * Every word the chat components show, in English, with the same keys as the web assistant's
56
- * labels, so a product passes one label set to both. Pass a `labels` object with any subset to a
57
- * component to change its wording; the rest keep these defaults. The few that take a value are
58
- * functions. `composerHint` describes a hardware keyboard's Enter key and is not shown on a phone.
59
- */
60
- export declare const DEFAULT_CHAT_LABELS: Readonly<ChatLabels>;
61
- /** The defaults with a component's `labels` laid over them. */
62
- export declare const mergeLabels: (labels?: Partial<ChatLabels>) => ChatLabels;
63
- //# sourceMappingURL=labels.d.ts.map
@@ -1,23 +0,0 @@
1
- export interface SseEvent {
2
- /** The `event:` field, or "message" when the block names none. */
3
- name: string;
4
- /** The `data:` lines joined by newlines and parsed as JSON. */
5
- data: unknown;
6
- }
7
- export interface SseParser {
8
- push: (text: string) => void;
9
- end: () => void;
10
- }
11
- /**
12
- * An incremental reader for a `text/event-stream` body that arrives in pieces. Each `push` takes
13
- * the next piece of text; only complete events (ended by a blank line) are handed on, and the
14
- * incomplete tail waits for the next piece. `end` flushes a final event the stream closed
15
- * without a blank line after.
16
- *
17
- * Line endings may be `\n`, `\r\n` or `\r`, and a `\r\n` pair may be split across two pieces.
18
- * Comment lines (`:`), `id` and `retry` are ignored. A block whose data is not JSON is reported
19
- * as an `error` event with the code `invalid-response`, so a caller ends the turn instead of
20
- * hanging on it.
21
- */
22
- export declare const createSseParser: (onEvent: (event: SseEvent) => void) => SseParser;
23
- //# sourceMappingURL=sse.d.ts.map
@@ -1,71 +0,0 @@
1
- /** An action the assistant prepared for the person to confirm. Nothing happens without the token. */
2
- export interface SupportAction {
3
- token: string;
4
- kind: "RaiseTicket" | "Reply" | "Reopen";
5
- ticketId: string | null;
6
- ticketNumber: string | null;
7
- category: string | null;
8
- subject: string | null;
9
- body: string | null;
10
- expiresDateTimeUtc: string;
11
- }
12
- /** The ticket a confirmed support action raised, replied on or reopened. */
13
- export interface SupportActionTicket {
14
- id: string;
15
- number: string;
16
- }
17
- export interface ChatTurnInput {
18
- /** The person's question. */
19
- message: string;
20
- /** The conversation to continue; left out or null to start one. */
21
- conversationId?: string | null;
22
- /** Product-defined context about the screen, passed through as is. */
23
- pageContext?: unknown;
24
- }
25
- export type ChatStreamEventName = "delta" | "reset" | "actions";
26
- export interface ChatStreamOptions {
27
- /** Cancels the request. */
28
- signal?: AbortSignal;
29
- /**
30
- * Called for each event before the end of the turn: `delta { text }` to append, `reset {}` to
31
- * discard what was shown, `actions { actions }` for support cards.
32
- */
33
- onEvent?: (name: ChatStreamEventName, data: unknown) => void;
34
- }
35
- /** The `done` event: the turn's outcome of record. */
36
- export interface ChatTurnResult {
37
- conversationId: string;
38
- /** The stored reply's id, for rating; null when storing failed. */
39
- messageId: string | null;
40
- /** The reply of record. It replaces whatever was streamed. */
41
- reply: string;
42
- /** Null when the person has no daily limit. */
43
- messagesLeftToday: number | null;
44
- }
45
- export interface ConversationSummary {
46
- publicId: string;
47
- title: string | null;
48
- createdDateTimeUtc: string;
49
- lastMessageDateTimeUtc: string;
50
- }
51
- export interface ConversationMessage {
52
- publicId: string;
53
- role: "User" | "Assistant";
54
- content: string;
55
- /** The support actions offered with an assistant reply, as a JSON array. */
56
- actionsJson: string | null;
57
- rating: ChatRating | null;
58
- ratingNote: string | null;
59
- createdDateTimeUtc: string;
60
- }
61
- export interface Conversation {
62
- publicId: string;
63
- title: string | null;
64
- messages: ConversationMessage[];
65
- }
66
- export type ChatRating = "Up" | "Down";
67
- export interface ChatRatingInput {
68
- rating: ChatRating;
69
- note?: string | null;
70
- }
71
- //# sourceMappingURL=types.d.ts.map
@@ -1,73 +0,0 @@
1
- import type { ChatRatingInput, ChatStreamOptions, ChatTurnInput, ChatTurnResult, Conversation, ConversationSummary } from "./types.js";
2
- /** A failed chat request. `message` is written for the person and is safe to show as is. */
3
- export declare class ChatApiError extends Error {
4
- /**
5
- * The server's code (`daily_limit`, `assistant_unavailable`, ...), `network` when no response
6
- * arrived, `aborted` when the request was cancelled, `invalid-response`, or `unknown`.
7
- */
8
- readonly code: string;
9
- /** The HTTP status, when a response arrived. */
10
- readonly status: number | undefined;
11
- /** For `daily_limit`: when the allowance comes back, in UTC. */
12
- readonly resetsAtUtc: string | null;
13
- constructor(code: string, message: string, status?: number, resetsAtUtc?: string | null);
14
- }
15
- /** The axios config fields the chat client sets. */
16
- export interface ChatHttpRequestConfig {
17
- headers?: Record<string, string>;
18
- responseType?: "text";
19
- signal?: AbortSignal;
20
- onDownloadProgress?: (progress: unknown) => void;
21
- }
22
- /**
23
- * The slice of an HTTP client the chat client needs. The app's signed-in axios instance
24
- * (mobile-core's `userClient`, or its own) satisfies it as is, so the bearer token, tenant header
25
- * and refresh on 401 apply to chat calls too. Declared structurally so no axios type leaks into
26
- * this package's declarations.
27
- */
28
- export interface ChatHttpClient {
29
- get(url: string, config?: ChatHttpRequestConfig): Promise<{
30
- data: unknown;
31
- }>;
32
- post(url: string, body?: unknown, config?: ChatHttpRequestConfig): Promise<{
33
- data: unknown;
34
- status?: number;
35
- }>;
36
- put(url: string, body?: unknown, config?: ChatHttpRequestConfig): Promise<{
37
- data: unknown;
38
- }>;
39
- delete(url: string, config?: ChatHttpRequestConfig): Promise<{
40
- data: unknown;
41
- }>;
42
- }
43
- export interface ChatClient {
44
- /** `POST {base}/chat`, streamed; resolves with the `done` event. */
45
- sendMessage(input: ChatTurnInput, options?: ChatStreamOptions): Promise<ChatTurnResult>;
46
- /** `GET {base}/allowance`. */
47
- getAllowance(): Promise<{
48
- messagesLeftToday: number | null;
49
- }>;
50
- /** `GET {base}/conversations?skip=&take=`, newest first. */
51
- listConversations(query?: {
52
- skip?: number;
53
- take?: number;
54
- }): Promise<ConversationSummary[]>;
55
- /** `GET {base}/conversations/{id}`. */
56
- getConversation(id: string): Promise<Conversation>;
57
- /** `DELETE {base}/conversations/{id}`. */
58
- deleteConversation(id: string): Promise<void>;
59
- /** `PUT {base}/conversations/{conversationId}/messages/{messageId}/rating`. */
60
- rateMessage(conversationId: string, messageId: string, input: ChatRatingInput): Promise<void>;
61
- }
62
- /**
63
- * Binds the chat HTTP contract to the app's own signed-in axios instance. The package never
64
- * handles auth: tokens, tenant headers and refresh stay in the instance.
65
- *
66
- * @param http The app's axios instance, e.g. mobile-core's `userClient`.
67
- * @param options `base` is the prefix the API maps the chat endpoints under, e.g.
68
- * `/api/assistant` for `POST /api/assistant/chat`.
69
- */
70
- export declare const createChatClient: (http: ChatHttpClient, { base }: {
71
- base: string;
72
- }) => ChatClient;
73
- //# sourceMappingURL=client.d.ts.map
@@ -1,63 +0,0 @@
1
- export interface ChatLabels {
2
- launcher: string;
3
- panelTitle: string;
4
- newChat: string;
5
- close: string;
6
- thread: string;
7
- you: string;
8
- assistant: string;
9
- thinking: string;
10
- emptyTitle: string;
11
- emptyText: string;
12
- composer: string;
13
- placeholder: string;
14
- send: string;
15
- composerHint: string;
16
- allowance: (count: number) => string;
17
- disclaimer: string;
18
- loadingConversation: string;
19
- rateUp: string;
20
- rateDown: string;
21
- rated: string;
22
- ratingNote: string;
23
- ratingNoteHint: string;
24
- ratingNoteSend: string;
25
- ratingNoteSkip: string;
26
- ratingFailed: string;
27
- actionRaiseTicket: string;
28
- actionReply: (ticketNumber: string) => string;
29
- actionReopen: (ticketNumber: string) => string;
30
- actionNote: string;
31
- actionConfirm: string;
32
- actionDismiss: string;
33
- actionDismissed: string;
34
- actionExpired: string;
35
- actionFailed: string;
36
- actionDoneRaiseTicket: (ticketNumber: string) => string;
37
- actionDoneReply: (ticketNumber: string) => string;
38
- actionDoneReopen: (ticketNumber: string) => string;
39
- viewTicket: string;
40
- conversations: string;
41
- conversationsEmptyTitle: string;
42
- conversationsEmptyText: string;
43
- untitled: string;
44
- deleteConversation: string;
45
- deleteConfirmTitle: string;
46
- deleteConfirmMessage: string;
47
- deleteConfirm: string;
48
- deleteFailed: string;
49
- cancel: string;
50
- loadMore: string;
51
- loadFailed: string;
52
- retry: string;
53
- }
54
- /**
55
- * Every word the chat components show, in English, with the same keys as the web assistant's
56
- * labels, so a product passes one label set to both. Pass a `labels` object with any subset to a
57
- * component to change its wording; the rest keep these defaults. The few that take a value are
58
- * functions. `composerHint` describes a hardware keyboard's Enter key and is not shown on a phone.
59
- */
60
- export declare const DEFAULT_CHAT_LABELS: Readonly<ChatLabels>;
61
- /** The defaults with a component's `labels` laid over them. */
62
- export declare const mergeLabels: (labels?: Partial<ChatLabels>) => ChatLabels;
63
- //# sourceMappingURL=labels.d.ts.map
@@ -1,23 +0,0 @@
1
- export interface SseEvent {
2
- /** The `event:` field, or "message" when the block names none. */
3
- name: string;
4
- /** The `data:` lines joined by newlines and parsed as JSON. */
5
- data: unknown;
6
- }
7
- export interface SseParser {
8
- push: (text: string) => void;
9
- end: () => void;
10
- }
11
- /**
12
- * An incremental reader for a `text/event-stream` body that arrives in pieces. Each `push` takes
13
- * the next piece of text; only complete events (ended by a blank line) are handed on, and the
14
- * incomplete tail waits for the next piece. `end` flushes a final event the stream closed
15
- * without a blank line after.
16
- *
17
- * Line endings may be `\n`, `\r\n` or `\r`, and a `\r\n` pair may be split across two pieces.
18
- * Comment lines (`:`), `id` and `retry` are ignored. A block whose data is not JSON is reported
19
- * as an `error` event with the code `invalid-response`, so a caller ends the turn instead of
20
- * hanging on it.
21
- */
22
- export declare const createSseParser: (onEvent: (event: SseEvent) => void) => SseParser;
23
- //# sourceMappingURL=sse.d.ts.map
@@ -1,71 +0,0 @@
1
- /** An action the assistant prepared for the person to confirm. Nothing happens without the token. */
2
- export interface SupportAction {
3
- token: string;
4
- kind: "RaiseTicket" | "Reply" | "Reopen";
5
- ticketId: string | null;
6
- ticketNumber: string | null;
7
- category: string | null;
8
- subject: string | null;
9
- body: string | null;
10
- expiresDateTimeUtc: string;
11
- }
12
- /** The ticket a confirmed support action raised, replied on or reopened. */
13
- export interface SupportActionTicket {
14
- id: string;
15
- number: string;
16
- }
17
- export interface ChatTurnInput {
18
- /** The person's question. */
19
- message: string;
20
- /** The conversation to continue; left out or null to start one. */
21
- conversationId?: string | null;
22
- /** Product-defined context about the screen, passed through as is. */
23
- pageContext?: unknown;
24
- }
25
- export type ChatStreamEventName = "delta" | "reset" | "actions";
26
- export interface ChatStreamOptions {
27
- /** Cancels the request. */
28
- signal?: AbortSignal;
29
- /**
30
- * Called for each event before the end of the turn: `delta { text }` to append, `reset {}` to
31
- * discard what was shown, `actions { actions }` for support cards.
32
- */
33
- onEvent?: (name: ChatStreamEventName, data: unknown) => void;
34
- }
35
- /** The `done` event: the turn's outcome of record. */
36
- export interface ChatTurnResult {
37
- conversationId: string;
38
- /** The stored reply's id, for rating; null when storing failed. */
39
- messageId: string | null;
40
- /** The reply of record. It replaces whatever was streamed. */
41
- reply: string;
42
- /** Null when the person has no daily limit. */
43
- messagesLeftToday: number | null;
44
- }
45
- export interface ConversationSummary {
46
- publicId: string;
47
- title: string | null;
48
- createdDateTimeUtc: string;
49
- lastMessageDateTimeUtc: string;
50
- }
51
- export interface ConversationMessage {
52
- publicId: string;
53
- role: "User" | "Assistant";
54
- content: string;
55
- /** The support actions offered with an assistant reply, as a JSON array. */
56
- actionsJson: string | null;
57
- rating: ChatRating | null;
58
- ratingNote: string | null;
59
- createdDateTimeUtc: string;
60
- }
61
- export interface Conversation {
62
- publicId: string;
63
- title: string | null;
64
- messages: ConversationMessage[];
65
- }
66
- export type ChatRating = "Up" | "Down";
67
- export interface ChatRatingInput {
68
- rating: ChatRating;
69
- note?: string | null;
70
- }
71
- //# sourceMappingURL=types.d.ts.map