@elia-assistant/chatui 1.0.9 → 1.0.10

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.
@@ -1,7 +1,13 @@
1
1
  import type { ChatConfig } from '../types/index.ts';
2
2
  export declare class N8nApiError extends Error {
3
3
  readonly status?: number;
4
- constructor(message: string, status?: number);
4
+ /**
5
+ * True when the underlying transport or status code indicates the request can be safely
6
+ * retried (network failure, 408, 429, 502/503/504). 4xx responses (other than 408/429) and
7
+ * any error that occurred after streaming chunks have been written are non-retryable.
8
+ */
9
+ readonly retryable: boolean;
10
+ constructor(message: string, status?: number, retryable?: boolean);
5
11
  }
6
12
  /**
7
13
  * Send a message to the n8n webhook.
@@ -9,9 +15,14 @@ export declare class N8nApiError extends Error {
9
15
  * Non-streaming: expects { output: string } response.
10
16
  * Streaming: SSE; each event contains data: { text: "chunk" } or data: { output: "full" }.
11
17
  *
18
+ * Automatically retries transient transport failures (network errors, 408, 429, 502/503/504)
19
+ * with short backoff. Other 4xx and any error that occurs *after* streaming has begun are
20
+ * surfaced immediately — duplicating partially-delivered content would be worse than failing.
21
+ *
12
22
  * @param config Chat configuration
13
23
  * @param sessionId Current session ID (maps to chatSessionKey)
14
24
  * @param text User message text
25
+ * @param language Optional ISO 639-1 code forwarded to n8n
15
26
  * @param onChunk Called with each streaming chunk (enables streaming mode)
16
27
  * @returns Full bot response text
17
28
  */
@@ -12,6 +12,7 @@ interface ChatState {
12
12
  removeLastBotIfEmpty(sessionId: string): void;
13
13
  setStreaming(val: boolean): void;
14
14
  setAwaitingAgentReply(sessionId: string, val: boolean): void;
15
+ updateMessageStatus(sessionId: string, messageId: string, status: NonNullable<Message['status']>): void;
15
16
  deleteSession(id: string): void;
16
17
  renameSession(id: string, title: string): void;
17
18
  clearMessages(sessionId: string): void;
package/dist/store.js CHANGED
@@ -1,2 +1,2 @@
1
- import { t as e } from "./chunks/settingsStore-Br8PCCHq.js";
1
+ import { t as e } from "./chunks/settingsStore-CpRkCJCy.js";
2
2
  export { e as useSettingsStore };
@@ -119,6 +119,11 @@ export interface Message {
119
119
  role: 'user' | 'bot';
120
120
  content: string;
121
121
  ts: number;
122
+ /**
123
+ * Delivery status for user messages. <c>undefined</c> on persisted history (treated as
124
+ * <c>'sent'</c>) and on every bot message — bots don't have a sender-side delivery state.
125
+ */
126
+ status?: 'sending' | 'sent' | 'failed';
122
127
  }
123
128
  export interface Session {
124
129
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elia-assistant/chatui",
3
- "version": "1.0.9",
3
+ "version": "1.0.10",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,2 +0,0 @@
1
- import { t as e } from "./i18n-Bk--20yp.js";
2
- export { e as default };