@resolveio/server-lib 20.14.46 → 20.14.48

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.
@@ -134,6 +134,11 @@ var AI_ASSISTANT_TOOL_MAX_STEPS = 1;
134
134
  var AI_ASSISTANT_DISPLAY_MAX_COLUMNS = 12;
135
135
  var AI_ASSISTANT_DISPLAY_PREVIEW_MAX_ROWS = 20;
136
136
  var AI_ASSISTANT_DISPLAY_STRING_LIMIT = 160;
137
+ var AI_ASSISTANT_PROGRESS_PLACEHOLDER = 'Thinking...';
138
+ var AI_ASSISTANT_PROGRESS_TICK_MS = 5000;
139
+ var AI_ASSISTANT_PROGRESS_TICKS = [
140
+ 'Drafting response'
141
+ ];
137
142
  var AI_ASSISTANT_DISPLAY_PRIORITY_FIELDS = [
138
143
  'name',
139
144
  'title',
@@ -195,6 +200,7 @@ var AI_ASSISTANT_SYSTEM_PROMPT = [
195
200
  '- Do not guess or invent collections/fields. If unsure, verify in the codebase or run a small Mongo read (limit 1-5) to learn the shape.',
196
201
  '- Prefer running a small Mongo read over asking multiple questions.',
197
202
  '- Ask at most one clarifying question only when required to run a query or resolve missing details.',
203
+ '- If a field starts with id_ and refers to another collection, treat it as a foreign key and look up the related record when needed.',
198
204
  '- Use the codebase context to choose correct collections/fields/workflows and use MONGO_READ/MONGO_AGG to answer with real data when needed.',
199
205
  '- For direct questions, answer first. Ask a single follow-up only if required to proceed.',
200
206
  'Data Presentation:',
@@ -558,7 +564,7 @@ function loadAiTerminalMethods(methodManager) {
558
564
  }
559
565
  function executeAiTerminalRun(payload, context) {
560
566
  return __awaiter(this, void 0, void 0, function () {
561
- var input, message, isSuperAdmin, guardrailsEnabled, guardrail, conversation_1, now_1, userMsg, assistantMsg, conversation, now, attachments, attachmentData, config, systemPrompt, userPromptTemplate, userPrompt, historyLimit, history, _a, messages, openaiSettings, client, response, usage, idClient, userDoc, assistantDoc, insertResult;
567
+ var input, message, requestId, isSuperAdmin, guardrailsEnabled, guardrail, conversation_1, now_1, userMsg, assistantMsg, conversation, now, attachments, attachmentData, config, systemPrompt, userPromptTemplate, userPrompt, historyLimit, history, _a, messages, openaiSettings, client, response, usage, idClient, userDoc, assistantDoc, insertResult;
562
568
  return __generator(this, function (_b) {
563
569
  switch (_b.label) {
564
570
  case 0:
@@ -567,6 +573,7 @@ function executeAiTerminalRun(payload, context) {
567
573
  if (!message) {
568
574
  throw new Error('Message is required.');
569
575
  }
576
+ requestId = normalizeOptionalString(input.request_id);
570
577
  return [4 /*yield*/, resolveIsSuperAdmin(context === null || context === void 0 ? void 0 : context.id_user)];
571
578
  case 1:
572
579
  isSuperAdmin = _b.sent();
@@ -582,6 +589,7 @@ function executeAiTerminalRun(payload, context) {
582
589
  id_conversation: conversation_1._id,
583
590
  role: 'user',
584
591
  content: message,
592
+ metadata: requestId ? { request_id: requestId } : undefined,
585
593
  createdAt: now_1,
586
594
  updatedAt: now_1
587
595
  };
@@ -589,10 +597,7 @@ function executeAiTerminalRun(payload, context) {
589
597
  id_conversation: conversation_1._id,
590
598
  role: 'assistant',
591
599
  content: guardrail.response,
592
- metadata: {
593
- blocked: true,
594
- reason: guardrail.reason
595
- },
600
+ metadata: __assign({ blocked: true, reason: guardrail.reason }, (requestId ? { request_id: requestId } : {})),
596
601
  createdAt: now_1,
597
602
  updatedAt: now_1
598
603
  };
@@ -672,6 +677,7 @@ function executeAiTerminalRun(payload, context) {
672
677
  id_conversation: conversation._id,
673
678
  role: 'user',
674
679
  content: message,
680
+ metadata: input.request_id ? { request_id: input.request_id } : undefined,
675
681
  attachments: attachmentData.attachments,
676
682
  createdAt: now,
677
683
  updatedAt: now
@@ -680,6 +686,7 @@ function executeAiTerminalRun(payload, context) {
680
686
  id_conversation: conversation._id,
681
687
  role: 'assistant',
682
688
  content: response.content,
689
+ metadata: input.request_id ? { request_id: input.request_id } : undefined,
683
690
  usage: {
684
691
  model: response.model || openaiSettings.model,
685
692
  input_tokens: usage.inputTokens,
@@ -781,7 +788,7 @@ function executeAiFormPatch(payload, context) {
781
788
  }
782
789
  function executeAiAssistantCodexRun(payload, context) {
783
790
  return __awaiter(this, void 0, void 0, function () {
784
- var input, message, guardrail, conversation_2, now_2, userMsg, assistantMsg, user, isSuperAdmin, hasInvoiceAccess, customerId, conversation, now, attachments, attachmentData, historyLimit, history, _a, historyLines, assistantContext, prompt, workspaceRoot, codexConfig, runOptions, responseText, directive, cleanedResponseText, assistantContent, toolResult, toolRequest, toolResponse, _b, toolPayload, followupPrompt, followupText, _c, error_1, userDoc, assistantDoc, insertResult;
791
+ var input, message, requestId, guardrail, conversation_2, now_2, userMsg, assistantMsg, user, isSuperAdmin, hasInvoiceAccess, customerId, conversation, now, attachments, attachmentData, historyLimit, history, _a, historyLines, assistantContext, prompt, workspaceRoot, codexConfig, runOptions, userDoc, initialProgress, assistantDoc, insertResult, assistantMessageId, progressTracker, assistantContent, toolResult, responseText, directive, cleanedResponseText, toolRequest, toolResponse, _b, toolPayload, followupPrompt, followupText, _c, error_1, error_2, finalNow, finalMetadata, finalAssistantDoc;
785
792
  var _d, _e;
786
793
  return __generator(this, function (_f) {
787
794
  switch (_f.label) {
@@ -794,6 +801,7 @@ function executeAiAssistantCodexRun(payload, context) {
794
801
  if (!(context === null || context === void 0 ? void 0 : context.id_user)) {
795
802
  throw new Error('Unauthorized.');
796
803
  }
804
+ requestId = normalizeOptionalString(input.request_id);
797
805
  guardrail = evaluateAssistantGuardrails(message);
798
806
  if (!(guardrail === null || guardrail === void 0 ? void 0 : guardrail.blocked)) return [3 /*break*/, 5];
799
807
  return [4 /*yield*/, ensureConversation(input, 'codex')];
@@ -804,6 +812,7 @@ function executeAiAssistantCodexRun(payload, context) {
804
812
  id_conversation: conversation_2._id,
805
813
  role: 'user',
806
814
  content: message,
815
+ metadata: requestId ? { request_id: requestId } : undefined,
807
816
  createdAt: now_2,
808
817
  updatedAt: now_2
809
818
  };
@@ -811,10 +820,7 @@ function executeAiAssistantCodexRun(payload, context) {
811
820
  id_conversation: conversation_2._id,
812
821
  role: 'assistant',
813
822
  content: guardrail.response,
814
- metadata: {
815
- blocked: true,
816
- reason: guardrail.reason
817
- },
823
+ metadata: __assign({ blocked: true, reason: guardrail.reason }, (requestId ? { request_id: requestId } : {})),
818
824
  createdAt: now_2,
819
825
  updatedAt: now_2
820
826
  };
@@ -884,86 +890,120 @@ function executeAiAssistantCodexRun(payload, context) {
884
890
  approvalPolicy: 'never'
885
891
  }
886
892
  };
887
- return [4 /*yield*/, runCodexInWorkerThread(prompt, runOptions, codexConfig)];
893
+ userDoc = {
894
+ id_conversation: conversation._id,
895
+ role: 'user',
896
+ content: message,
897
+ metadata: requestId ? { request_id: requestId } : undefined,
898
+ attachments: attachmentData.attachments,
899
+ createdAt: now,
900
+ updatedAt: now
901
+ };
902
+ initialProgress = ['Thinking'];
903
+ assistantDoc = {
904
+ id_conversation: conversation._id,
905
+ role: 'assistant',
906
+ content: AI_ASSISTANT_PROGRESS_PLACEHOLDER,
907
+ metadata: __assign(__assign({ model: resolveCodexModel() }, (requestId ? { request_id: requestId } : {})), { pending: true, progress: initialProgress }),
908
+ createdAt: now,
909
+ updatedAt: now
910
+ };
911
+ return [4 /*yield*/, ai_terminal_message_collection_1.AiTerminalMessages.insertOne(userDoc)];
888
912
  case 13:
913
+ _f.sent();
914
+ return [4 /*yield*/, ai_terminal_message_collection_1.AiTerminalMessages.insertOne(assistantDoc)];
915
+ case 14:
916
+ insertResult = _f.sent();
917
+ assistantMessageId = (insertResult === null || insertResult === void 0 ? void 0 : insertResult._id) || (insertResult === null || insertResult === void 0 ? void 0 : insertResult.insertedId);
918
+ progressTracker = createAssistantProgressTracker(assistantMessageId, initialProgress);
919
+ assistantContent = '';
920
+ toolResult = null;
921
+ _f.label = 15;
922
+ case 15:
923
+ _f.trys.push([15, 30, 31, 32]);
924
+ return [4 /*yield*/, runCodexInWorkerThread(prompt, runOptions, codexConfig)];
925
+ case 16:
889
926
  responseText = _f.sent();
890
927
  directive = extractAssistantMongoDirective(responseText);
891
928
  cleanedResponseText = (directive === null || directive === void 0 ? void 0 : directive.cleaned) || responseText;
892
929
  assistantContent = sanitizeAssistantResponse(cleanedResponseText);
893
- toolResult = null;
894
- if (!((directive === null || directive === void 0 ? void 0 : directive.payload) && AI_ASSISTANT_TOOL_MAX_STEPS > 0)) return [3 /*break*/, 24];
930
+ if (!((directive === null || directive === void 0 ? void 0 : directive.payload) && AI_ASSISTANT_TOOL_MAX_STEPS > 0)) return [3 /*break*/, 28];
895
931
  toolRequest = buildAssistantToolRequest(directive, input);
896
- _f.label = 14;
897
- case 14:
898
- _f.trys.push([14, 23, , 24]);
899
- if (!(directive.type === 'aggregate')) return [3 /*break*/, 16];
932
+ progressTracker.push('Looking up Data');
933
+ _f.label = 17;
934
+ case 17:
935
+ _f.trys.push([17, 26, , 27]);
936
+ if (!(directive.type === 'aggregate')) return [3 /*break*/, 19];
900
937
  return [4 /*yield*/, executeAiAssistantMongoAggregate(toolRequest, context)];
901
- case 15:
938
+ case 18:
902
939
  _b = _f.sent();
903
- return [3 /*break*/, 18];
904
- case 16: return [4 /*yield*/, executeAiAssistantMongoRead(toolRequest, context)];
905
- case 17:
940
+ return [3 /*break*/, 21];
941
+ case 19: return [4 /*yield*/, executeAiAssistantMongoRead(toolRequest, context)];
942
+ case 20:
906
943
  _b = _f.sent();
907
- _f.label = 18;
908
- case 18:
944
+ _f.label = 21;
945
+ case 21:
909
946
  toolResponse = _b;
910
947
  toolPayload = buildAssistantToolResultPayload(directive, toolResponse);
911
948
  toolResult = toolPayload.result;
949
+ progressTracker.push('Drafting response');
912
950
  followupPrompt = buildAssistantCodexToolFollowupPrompt(message, attachmentData.promptText, historyLines.join('\n'), assistantContext, toolPayload.prompt);
913
- _f.label = 19;
914
- case 19:
915
- _f.trys.push([19, 21, , 22]);
951
+ _f.label = 22;
952
+ case 22:
953
+ _f.trys.push([22, 24, , 25]);
916
954
  return [4 /*yield*/, runCodexInWorkerThread(followupPrompt, runOptions, codexConfig)];
917
- case 20:
955
+ case 23:
918
956
  followupText = _f.sent();
919
957
  assistantContent = sanitizeAssistantResponse(followupText);
920
- return [3 /*break*/, 22];
921
- case 21:
958
+ return [3 /*break*/, 25];
959
+ case 24:
922
960
  _c = _f.sent();
923
961
  assistantContent = buildAssistantToolFallbackResponse(toolPayload.result);
924
- return [3 /*break*/, 22];
925
- case 22: return [3 /*break*/, 24];
926
- case 23:
962
+ return [3 /*break*/, 25];
963
+ case 25: return [3 /*break*/, 27];
964
+ case 26:
927
965
  error_1 = _f.sent();
928
966
  assistantContent = buildAssistantToolErrorMessage(error_1, directive, toolRequest);
929
- return [3 /*break*/, 24];
930
- case 24:
931
- userDoc = {
932
- id_conversation: conversation._id,
933
- role: 'user',
934
- content: message,
935
- attachments: attachmentData.attachments,
936
- createdAt: now,
937
- updatedAt: now
938
- };
939
- assistantDoc = {
940
- id_conversation: conversation._id,
941
- role: 'assistant',
942
- content: assistantContent,
943
- metadata: {
944
- model: resolveCodexModel()
945
- },
946
- createdAt: now,
947
- updatedAt: now
948
- };
949
- if (toolResult) {
950
- assistantDoc.metadata = __assign(__assign({}, (assistantDoc.metadata || {})), { tool_result: toolResult });
967
+ return [3 /*break*/, 27];
968
+ case 27: return [3 /*break*/, 29];
969
+ case 28:
970
+ progressTracker.push('Drafting response');
971
+ _f.label = 29;
972
+ case 29: return [3 /*break*/, 32];
973
+ case 30:
974
+ error_2 = _f.sent();
975
+ assistantContent = buildAssistantCodexErrorMessage(error_2);
976
+ return [3 /*break*/, 32];
977
+ case 31:
978
+ progressTracker.stop();
979
+ return [7 /*endfinally*/];
980
+ case 32:
981
+ if (!assistantContent) {
982
+ assistantContent = buildAssistantCodexErrorMessage(null);
951
983
  }
952
- return [4 /*yield*/, ai_terminal_message_collection_1.AiTerminalMessages.insertOne(userDoc)];
953
- case 25:
984
+ finalNow = new Date();
985
+ finalMetadata = __assign(__assign({ model: resolveCodexModel() }, (requestId ? { request_id: requestId } : {})), (toolResult ? { tool_result: toolResult } : {}));
986
+ finalAssistantDoc = __assign(__assign({}, assistantDoc), { _id: assistantMessageId, content: assistantContent, metadata: finalMetadata, updatedAt: finalNow });
987
+ if (!assistantMessageId) return [3 /*break*/, 34];
988
+ return [4 /*yield*/, ai_terminal_message_collection_1.AiTerminalMessages.updateOne({ _id: assistantMessageId }, {
989
+ $set: {
990
+ content: assistantContent,
991
+ metadata: finalMetadata,
992
+ updatedAt: finalNow
993
+ }
994
+ })];
995
+ case 33:
954
996
  _f.sent();
955
- return [4 /*yield*/, ai_terminal_message_collection_1.AiTerminalMessages.insertOne(assistantDoc)];
956
- case 26:
957
- insertResult = _f.sent();
958
- return [4 /*yield*/, touchConversation(conversation._id, now, insertResult._id)];
959
- case 27:
997
+ _f.label = 34;
998
+ case 34: return [4 /*yield*/, touchConversation(conversation._id, finalNow, assistantMessageId ? String(assistantMessageId) : undefined)];
999
+ case 35:
960
1000
  _f.sent();
961
- if (!(input.delete_files_after_run !== false)) return [3 /*break*/, 29];
1001
+ if (!(input.delete_files_after_run !== false)) return [3 /*break*/, 37];
962
1002
  return [4 /*yield*/, cleanupAttachments(attachmentData.attachments)];
963
- case 28:
1003
+ case 36:
964
1004
  _f.sent();
965
- _f.label = 29;
966
- case 29: return [2 /*return*/, __assign({ conversation: conversation, message: assistantDoc }, (toolResult ? { tool_result: toolResult } : {}))];
1005
+ _f.label = 37;
1006
+ case 37: return [2 /*return*/, __assign({ conversation: conversation, message: finalAssistantDoc }, (toolResult ? { tool_result: toolResult } : {}))];
967
1007
  }
968
1008
  });
969
1009
  });
@@ -1341,6 +1381,135 @@ function buildAssistantToolErrorMessage(error, directive, request) {
1341
1381
  }
1342
1382
  return "I couldn't access the requested data. ".concat(routeLine);
1343
1383
  }
1384
+ function normalizeAssistantProgress(items) {
1385
+ var seen = new Set();
1386
+ var cleaned = [];
1387
+ items.forEach(function (item) {
1388
+ var trimmed = String(item || '').trim();
1389
+ if (!trimmed) {
1390
+ return;
1391
+ }
1392
+ var key = trimmed.toLowerCase();
1393
+ if (seen.has(key)) {
1394
+ return;
1395
+ }
1396
+ seen.add(key);
1397
+ cleaned.push(trimmed);
1398
+ });
1399
+ return cleaned;
1400
+ }
1401
+ function updateAssistantProgress(messageId, progress) {
1402
+ return __awaiter(this, void 0, void 0, function () {
1403
+ var normalized, _a;
1404
+ return __generator(this, function (_b) {
1405
+ switch (_b.label) {
1406
+ case 0:
1407
+ normalized = normalizeAssistantProgress(progress);
1408
+ if (!messageId || !normalized.length) {
1409
+ return [2 /*return*/];
1410
+ }
1411
+ _b.label = 1;
1412
+ case 1:
1413
+ _b.trys.push([1, 3, , 4]);
1414
+ return [4 /*yield*/, ai_terminal_message_collection_1.AiTerminalMessages.updateOne({ _id: messageId, 'metadata.pending': true }, {
1415
+ $set: {
1416
+ 'metadata.pending': true,
1417
+ 'metadata.progress': normalized,
1418
+ updatedAt: new Date()
1419
+ }
1420
+ })];
1421
+ case 2:
1422
+ _b.sent();
1423
+ return [3 /*break*/, 4];
1424
+ case 3:
1425
+ _a = _b.sent();
1426
+ return [3 /*break*/, 4];
1427
+ case 4: return [2 /*return*/];
1428
+ }
1429
+ });
1430
+ });
1431
+ }
1432
+ function createAssistantProgressTracker(messageId, initialProgress) {
1433
+ var _this = this;
1434
+ var progress = normalizeAssistantProgress(initialProgress);
1435
+ var stopped = false;
1436
+ var tickIndex = 0;
1437
+ var updateScheduled = false;
1438
+ var timer = null;
1439
+ var queueProgressUpdate = function () {
1440
+ if (stopped || !messageId || updateScheduled) {
1441
+ return;
1442
+ }
1443
+ updateScheduled = true;
1444
+ setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
1445
+ var _a;
1446
+ return __generator(this, function (_b) {
1447
+ switch (_b.label) {
1448
+ case 0:
1449
+ updateScheduled = false;
1450
+ if (stopped) {
1451
+ return [2 /*return*/];
1452
+ }
1453
+ _b.label = 1;
1454
+ case 1:
1455
+ _b.trys.push([1, 3, , 4]);
1456
+ return [4 /*yield*/, updateAssistantProgress(messageId, progress)];
1457
+ case 2:
1458
+ _b.sent();
1459
+ return [3 /*break*/, 4];
1460
+ case 3:
1461
+ _a = _b.sent();
1462
+ return [3 /*break*/, 4];
1463
+ case 4: return [2 /*return*/];
1464
+ }
1465
+ });
1466
+ }); }, 0);
1467
+ };
1468
+ if (messageId) {
1469
+ timer = setInterval(function () {
1470
+ if (stopped) {
1471
+ if (timer) {
1472
+ clearInterval(timer);
1473
+ timer = null;
1474
+ }
1475
+ return;
1476
+ }
1477
+ if (tickIndex >= AI_ASSISTANT_PROGRESS_TICKS.length) {
1478
+ if (timer) {
1479
+ clearInterval(timer);
1480
+ timer = null;
1481
+ }
1482
+ return;
1483
+ }
1484
+ var next = AI_ASSISTANT_PROGRESS_TICKS[tickIndex++];
1485
+ progress = normalizeAssistantProgress(__spreadArray(__spreadArray([], __read(progress), false), [next], false));
1486
+ queueProgressUpdate();
1487
+ }, AI_ASSISTANT_PROGRESS_TICK_MS);
1488
+ }
1489
+ return {
1490
+ push: function (item) {
1491
+ if (stopped || !messageId) {
1492
+ return;
1493
+ }
1494
+ progress = normalizeAssistantProgress(__spreadArray(__spreadArray([], __read(progress), false), [item], false));
1495
+ queueProgressUpdate();
1496
+ },
1497
+ stop: function () {
1498
+ stopped = true;
1499
+ if (timer) {
1500
+ clearInterval(timer);
1501
+ timer = null;
1502
+ }
1503
+ }
1504
+ };
1505
+ }
1506
+ function buildAssistantCodexErrorMessage(error) {
1507
+ var raw = normalizeOptionalString(error === null || error === void 0 ? void 0 : error.message);
1508
+ if (raw && /timed out/i.test(raw)) {
1509
+ return 'That took longer than expected. Please try again or narrow the request.';
1510
+ }
1511
+ return 'I ran into an internal error while preparing that response. Please try again.';
1512
+ }
1344
1513
  function isAssistantIdField(key) {
1345
1514
  var normalized = String(key || '').trim().toLowerCase();
1346
1515
  if (!normalized) {
@@ -2233,7 +2402,7 @@ var CodexWorkerBootstrapError = /** @class */ (function (_super) {
2233
2402
  }(Error));
2234
2403
  function runCodexInWorkerThread(prompt, runOptions, config) {
2235
2404
  return __awaiter(this, void 0, void 0, function () {
2236
- var codexClient, workerPath, codexClient, error_2, codexClient;
2405
+ var codexClient, workerPath, codexClient, error_3, codexClient;
2237
2406
  return __generator(this, function (_a) {
2238
2407
  switch (_a.label) {
2239
2408
  case 0:
@@ -2253,11 +2422,11 @@ function runCodexInWorkerThread(prompt, runOptions, config) {
2253
2422
  return [4 /*yield*/, runCodexInWorkerThreadInternal(workerPath, prompt, runOptions, config)];
2254
2423
  case 6: return [2 /*return*/, _a.sent()];
2255
2424
  case 7:
2256
- error_2 = _a.sent();
2257
- if (!(error_2 instanceof CodexWorkerBootstrapError)) {
2258
- throw error_2;
2425
+ error_3 = _a.sent();
2426
+ if (!(error_3 instanceof CodexWorkerBootstrapError)) {
2427
+ throw error_3;
2259
2428
  }
2260
- console.error('Codex worker bootstrap failed, falling back to in-process run.', error_2);
2429
+ console.error('Codex worker bootstrap failed, falling back to in-process run.', error_3);
2261
2430
  codexClient = getAssistantCodexClient();
2262
2431
  return [4 /*yield*/, codexClient.run(prompt, runOptions)];
2263
2432
  case 8: return [2 /*return*/, _a.sent()];
@@ -2294,7 +2463,7 @@ function runCodexInWorkerThreadInternal(workerPath, prompt, runOptions, config)
2294
2463
  timeoutMs = ((sanitizedOptions === null || sanitizedOptions === void 0 ? void 0 : sanitizedOptions.timeoutMs) || resolveCodexTimeoutMs()) + 15000;
2295
2464
  timeoutController = new AbortController();
2296
2465
  timeoutPromise = (function () { return __awaiter(_this, void 0, void 0, function () {
2297
- var error_3;
2466
+ var error_4;
2298
2467
  return __generator(this, function (_a) {
2299
2468
  switch (_a.label) {
2300
2469
  case 0:
@@ -2304,11 +2473,11 @@ function runCodexInWorkerThreadInternal(workerPath, prompt, runOptions, config)
2304
2473
  _a.sent();
2305
2474
  return [2 /*return*/, { type: 'timeout' }];
2306
2475
  case 2:
2307
- error_3 = _a.sent();
2308
- if ((error_3 === null || error_3 === void 0 ? void 0 : error_3.name) === 'AbortError') {
2476
+ error_4 = _a.sent();
2477
+ if ((error_4 === null || error_4 === void 0 ? void 0 : error_4.name) === 'AbortError') {
2309
2478
  return [2 /*return*/, { type: 'aborted' }];
2310
2479
  }
2311
- throw error_3;
2480
+ throw error_4;
2312
2481
  case 3: return [2 /*return*/];
2313
2482
  }
2314
2483
  });