@menuia/core 1.3.0 → 1.4.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/dist/index.d.mts CHANGED
@@ -27,6 +27,8 @@ interface ChatMessage {
27
27
  createdAt: string;
28
28
  mediaUrl?: string;
29
29
  mediaType?: string;
30
+ /** Nome original do arquivo anexado, quando houver. */
31
+ mediaName?: string;
30
32
  toolCalls?: string;
31
33
  toolResults?: string;
32
34
  authorName?: string;
package/dist/index.d.ts CHANGED
@@ -27,6 +27,8 @@ interface ChatMessage {
27
27
  createdAt: string;
28
28
  mediaUrl?: string;
29
29
  mediaType?: string;
30
+ /** Nome original do arquivo anexado, quando houver. */
31
+ mediaName?: string;
30
32
  toolCalls?: string;
31
33
  toolResults?: string;
32
34
  authorName?: string;
package/dist/index.js CHANGED
@@ -282,6 +282,9 @@ var MenuIAClient = class {
282
282
  createdAt: m.createdAt,
283
283
  mediaUrl: m.mediaUrl,
284
284
  mediaType: m.mediaType,
285
+ // ⚠️ O endpoint devolve `mediaName` e o mapeamento o descartava: anexo recarregado do
286
+ // historico aparecia sem o nome do arquivo, mesmo com o nome gravado no banco.
287
+ mediaName: m.mediaName,
285
288
  authorName: m.authorName
286
289
  }));
287
290
  if (messages.length) {
@@ -298,9 +301,10 @@ var MenuIAClient = class {
298
301
  startPolling(intervalMs = 1e4) {
299
302
  this.stopPolling();
300
303
  this.pollInterval = setInterval(async () => {
304
+ const jaVistas = this.lastMessageCount;
301
305
  const messages = await this.loadHistory();
302
- if (messages.length > this.lastMessageCount) {
303
- const newMessages = messages.slice(this.lastMessageCount);
306
+ if (messages.length > jaVistas) {
307
+ const newMessages = messages.slice(jaVistas);
304
308
  for (const msg of newMessages) {
305
309
  if (msg.role === "assistant") {
306
310
  this.config.onMessage?.(msg);
package/dist/index.mjs CHANGED
@@ -256,6 +256,9 @@ var MenuIAClient = class {
256
256
  createdAt: m.createdAt,
257
257
  mediaUrl: m.mediaUrl,
258
258
  mediaType: m.mediaType,
259
+ // ⚠️ O endpoint devolve `mediaName` e o mapeamento o descartava: anexo recarregado do
260
+ // historico aparecia sem o nome do arquivo, mesmo com o nome gravado no banco.
261
+ mediaName: m.mediaName,
259
262
  authorName: m.authorName
260
263
  }));
261
264
  if (messages.length) {
@@ -272,9 +275,10 @@ var MenuIAClient = class {
272
275
  startPolling(intervalMs = 1e4) {
273
276
  this.stopPolling();
274
277
  this.pollInterval = setInterval(async () => {
278
+ const jaVistas = this.lastMessageCount;
275
279
  const messages = await this.loadHistory();
276
- if (messages.length > this.lastMessageCount) {
277
- const newMessages = messages.slice(this.lastMessageCount);
280
+ if (messages.length > jaVistas) {
281
+ const newMessages = messages.slice(jaVistas);
278
282
  for (const msg of newMessages) {
279
283
  if (msg.role === "assistant") {
280
284
  this.config.onMessage?.(msg);
package/package.json CHANGED
@@ -1,11 +1,13 @@
1
1
  {
2
2
  "name": "@menuia/core",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "MenuIA Chat SDK - Core",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
8
- "files": ["dist"],
8
+ "files": [
9
+ "dist"
10
+ ],
9
11
  "scripts": {
10
12
  "build": "tsup src/index.ts --format cjs,esm --dts --clean",
11
13
  "dev": "tsup src/index.ts --format cjs,esm --dts --watch"