@ykurilov/agent-chat-core 0.63.2 → 0.64.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.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  accessRefusedResponse,
3
3
  allowedUser
4
- } from "./chunk-FBULM4V6.js";
4
+ } from "./chunk-5UUWSY6V.js";
5
5
  import {
6
6
  AGENT_NOTICE_PART_TYPE,
7
7
  ANSWERED_BY_MESSAGE,
@@ -174,7 +174,7 @@ import {
174
174
  withoutFileParts,
175
175
  withoutGlueFragments,
176
176
  withoutResetSteps
177
- } from "./chunk-4Y26SCCM.js";
177
+ } from "./chunk-EWEEYX6U.js";
178
178
  import {
179
179
  APP_EVENT_DATA_MAX_BYTES,
180
180
  APP_EVENT_TYPE_MAX_LENGTH,
@@ -183,7 +183,7 @@ import {
183
183
  isTurnRefusalCode,
184
184
  normalizeTurnRefusal,
185
185
  validateAppEvent
186
- } from "./chunk-FOAIG4DY.js";
186
+ } from "./chunk-CVRDB3NM.js";
187
187
 
188
188
  // src/memory/memory-optimization.ts
189
189
  function pauseAfterFailure(rules, failuresInRow) {
@@ -13,8 +13,8 @@ import {
13
13
  extendCatalog,
14
14
  newStoredMessage,
15
15
  standardCatalog
16
- } from "./chunk-4Y26SCCM.js";
17
- import "./chunk-FOAIG4DY.js";
16
+ } from "./chunk-EWEEYX6U.js";
17
+ import "./chunk-CVRDB3NM.js";
18
18
 
19
19
  // src/storage/storage-contract.ts
20
20
  import { jsonSchema } from "ai";
@@ -209,6 +209,17 @@ function describeChatStorageContract(createStorage, options = {}) {
209
209
  expect(saved).toMatchObject({ status: "error", usage, error: { kind: "overloaded" } });
210
210
  expect(saved?.parts).toEqual([{ type: "text", text: "\u0447\u0430\u0441\u0442\u044C", state: "done" }]);
211
211
  });
212
+ it("finishMessage \u0445\u0440\u0430\u043D\u0438\u0442 \u043F\u043E\u0434\u0440\u043E\u0431\u043D\u043E\u0441\u0442\u0438 \u0441\u0431\u043E\u044F \u043F\u0440\u043E\u0432\u0430\u0439\u0434\u0435\u0440\u0430 (error.details) \u0438 \u043E\u0442\u0434\u0430\u0451\u0442 \u0438\u0445 \u043A\u0430\u043A \u0435\u0441\u0442\u044C", async () => {
213
+ const storage = await storageWithChat();
214
+ await storage.insertMessage(userMessage("u1", "2099-01-01T00:00:00.000Z"));
215
+ await storage.insertMessage(streamingAnswer("a1", "u1", "2099-01-01T00:00:01.000Z"));
216
+ const error = {
217
+ kind: "insufficient_funds",
218
+ details: { providerId: "openrouter", modelId: "m", statusCode: 403, reason: "Key limit exceeded", resetsAt: "2099-11-01T00:00:00.000Z" }
219
+ };
220
+ await storage.finishMessage("a1", { status: "error", parts: [], usage: null, error });
221
+ expect((await storage.listMessages(chatInput.id)).find((message) => message.id === "a1")?.error).toEqual(error);
222
+ });
212
223
  it("finishMessage \u0441 providerId \u043C\u0435\u043D\u044F\u0435\u0442 \u043F\u0440\u043E\u0432\u0430\u0439\u0434\u0435\u0440\u0430 \u043E\u0442\u0432\u0435\u0442\u0430, \u0431\u0435\u0437 \u043F\u043E\u043B\u044F \u2014 \u043F\u0440\u043E\u0432\u0430\u0439\u0434\u0435\u0440 \u043F\u0440\u0435\u0436\u043D\u0438\u0439", async () => {
213
224
  const storage = await storageWithChat();
214
225
  await storage.insertMessage(userMessage("u1", "2099-01-01T00:00:00.000Z"));