@automagik/omni 2.260624.2 → 2.260624.3

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
@@ -62387,7 +62387,8 @@ class AgnoAgentProvider {
62387
62387
  });
62388
62388
  const response = await this.client.run(request);
62389
62389
  const customerContent = toSafeCustomerFallback(response.content);
62390
- if (customerContent !== response.content) {
62390
+ const customerErrorBlocked = customerContent !== response.content;
62391
+ if (customerErrorBlocked) {
62391
62392
  log8.error("Blocked provider error from customer-facing Agno response", {
62392
62393
  agentId: this.config.agentId,
62393
62394
  runId: response.runId,
@@ -62414,7 +62415,8 @@ class AgnoAgentProvider {
62414
62415
  cost: response.metrics ? {
62415
62416
  inputTokens: response.metrics.inputTokens,
62416
62417
  outputTokens: response.metrics.outputTokens
62417
- } : undefined
62418
+ } : undefined,
62419
+ customerErrorBlocked
62418
62420
  }
62419
62421
  };
62420
62422
  }
@@ -125002,7 +125004,7 @@ import { fileURLToPath } from "url";
125002
125004
  // package.json
125003
125005
  var package_default = {
125004
125006
  name: "@automagik/omni",
125005
- version: "2.260624.2",
125007
+ version: "2.260624.3",
125006
125008
  description: "LLM-optimized CLI for Omni",
125007
125009
  type: "module",
125008
125010
  bin: {
@@ -30720,7 +30720,8 @@ class AgnoAgentProvider {
30720
30720
  });
30721
30721
  const response = await this.client.run(request);
30722
30722
  const customerContent = toSafeCustomerFallback(response.content);
30723
- if (customerContent !== response.content) {
30723
+ const customerErrorBlocked = customerContent !== response.content;
30724
+ if (customerErrorBlocked) {
30724
30725
  log8.error("Blocked provider error from customer-facing Agno response", {
30725
30726
  agentId: this.config.agentId,
30726
30727
  runId: response.runId,
@@ -30747,7 +30748,8 @@ class AgnoAgentProvider {
30747
30748
  cost: response.metrics ? {
30748
30749
  inputTokens: response.metrics.inputTokens,
30749
30750
  outputTokens: response.metrics.outputTokens
30750
- } : undefined
30751
+ } : undefined,
30752
+ customerErrorBlocked
30751
30753
  }
30752
30754
  };
30753
30755
  }
@@ -225289,7 +225291,7 @@ var init_sentry_scrub = __esm(() => {
225289
225291
  var require_package7 = __commonJS((exports, module) => {
225290
225292
  module.exports = {
225291
225293
  name: "@omni/api",
225292
- version: "2.260624.2",
225294
+ version: "2.260624.3",
225293
225295
  type: "module",
225294
225296
  exports: {
225295
225297
  ".": {
@@ -338466,6 +338468,68 @@ async function sendErrorFeedback(channel5, instanceId, chatId, error3, message2)
338466
338468
  log99.error("agent_dispatch_error", { channel: channel5, instanceId, chatId, error: errorMsg });
338467
338469
  await sendTextMessage5(channel5, instanceId, chatId, message2);
338468
338470
  }
338471
+ function resolveErrorHandoffMessage(env2 = process.env) {
338472
+ return env2.OMNI_AGENT_ERROR_HANDOFF_MESSAGE?.trim() || DEFAULT_ERROR_HANDOFF_MESSAGE;
338473
+ }
338474
+ async function triggerErrorHandoff(services, db2, channel5, instance4, chatId, message2) {
338475
+ const plugin7 = await getPlugin(channel5);
338476
+ if (plugin7?.capabilities?.canHandoff !== true)
338477
+ return false;
338478
+ let sendResult;
338479
+ try {
338480
+ sendResult = await plugin7.sendMessage(instance4.id, {
338481
+ to: chatId,
338482
+ content: { type: "text", text: message2 },
338483
+ metadata: { isHandoff: true, motivoHandoff: "agent_dispatch_error" }
338484
+ });
338485
+ } catch (err) {
338486
+ log99.error("agent_dispatch_error_handoff_failed", { instanceId: instance4.id, chatId, error: String(err) });
338487
+ return false;
338488
+ }
338489
+ if (!sendResult?.success) {
338490
+ log99.error("agent_dispatch_error_handoff_delivery_failed", {
338491
+ instanceId: instance4.id,
338492
+ chatId,
338493
+ error: sendResult?.error
338494
+ });
338495
+ return false;
338496
+ }
338497
+ try {
338498
+ const chat2 = await services.chats.findByExternalIdSmart(instance4.id, chatId);
338499
+ if (chat2) {
338500
+ const settings = chat2.settings ?? {};
338501
+ await services.chats.update(chat2.id, { settings: { ...settings, agentPaused: true } });
338502
+ await services.followUpLifecycle.disarm({ chatId: chat2.id, instanceId: instance4.id, reason: "handoff" });
338503
+ await db2.insert(handoffLogs).values({
338504
+ instanceId: instance4.id,
338505
+ chatUuid: chat2.id,
338506
+ chatId,
338507
+ toPhone: chatId,
338508
+ text: message2,
338509
+ extraInfo: null,
338510
+ agentId: instance4.agentId ?? null,
338511
+ externalMessageId: sendResult?.messageId ?? null,
338512
+ handoffFields: null,
338513
+ sentAt: new Date,
338514
+ metadata: { instanceChannel: channel5, channelHandoffSupported: true, motivoHandoff: "agent_dispatch_error" }
338515
+ });
338516
+ }
338517
+ } catch (err) {
338518
+ log99.warn("agent_dispatch_error_handoff_side_effects_failed", {
338519
+ instanceId: instance4.id,
338520
+ chatId,
338521
+ error: String(err)
338522
+ });
338523
+ }
338524
+ log99.info("agent_dispatch_error_handoff", { instanceId: instance4.id, chatId, channel: channel5 });
338525
+ return true;
338526
+ }
338527
+ async function handleDispatchFailure(services, db2, channel5, instance4, chatId, error3) {
338528
+ const handedOff = await triggerErrorHandoff(services, db2, channel5, instance4, chatId, resolveErrorHandoffMessage());
338529
+ if (handedOff)
338530
+ return;
338531
+ await sendErrorFeedback(channel5, instance4.id, chatId, error3, resolveDispatchErrorMessage(null)).catch(() => {});
338532
+ }
338469
338533
  function sleep5(ms) {
338470
338534
  return new Promise((resolve3) => setTimeout(resolve3, ms));
338471
338535
  }
@@ -339567,7 +339631,11 @@ async function dispatchViaProvider(services, instance4, messages4, triggerType,
339567
339631
  }
339568
339632
  const chatAfterRun = await services.chats.findByExternalIdSmart(instance4.id, chatId);
339569
339633
  const handoffTriggered = chatAfterRun?.settings?.agentPaused === true;
339570
- if (result && result.parts.length > 0 && !handoffTriggered) {
339634
+ let errorHandoffDone = false;
339635
+ if (result?.metadata.customerErrorBlocked === true && !handoffTriggered) {
339636
+ errorHandoffDone = await triggerErrorHandoff(services, db2, channel5, instance4, chatId, resolveErrorHandoffMessage());
339637
+ }
339638
+ if (result && result.parts.length > 0 && !handoffTriggered && !errorHandoffDone) {
339571
339639
  const selfChat = isSelfChat(chatId, instance4.ownerIdentifier);
339572
339640
  const rawParts = selfChat ? result.parts.map((p2) => `${BOT_PREFIX}${p2}`) : result.parts;
339573
339641
  const parts = await Promise.all(rawParts.map((part) => executeBeforeMessageWriteHooks(instance4.id, chatId, part)));
@@ -340071,7 +340139,7 @@ async function processAgentResponse(services, instance4, messages4, triggerType,
340071
340139
  error: String(error3),
340072
340140
  traceId
340073
340141
  });
340074
- sendErrorFeedback(channel5, instance4.id, chatId, error3, resolveDispatchErrorMessage(null)).catch(() => {});
340142
+ await handleDispatchFailure(services, db2, channel5, instance4, chatId, error3);
340075
340143
  } finally {
340076
340144
  ackHandle.remove();
340077
340145
  }
@@ -341198,7 +341266,7 @@ async function setupAgentDispatcher(eventBus, services, db2) {
341198
341266
  log99.info("Agent dispatcher shutdown complete");
341199
341267
  };
341200
341268
  }
341201
- var import_api32, log99, agentDispatchLimiter, _natsGenieProviderCtor, QUOTED_MESSAGE_MAX_CHARS = 4000, DM_HISTORY_LIMIT = 20, LIFECYCLE_PREVIEW_MAX_CHARS = 160, LIFECYCLE_SENSITIVE_KEY_PARTS, DEFAULT_DISPATCH_ERROR_MESSAGE = "\u26A0\uFE0F Sorry, I ran into an issue processing your message. Please try again.", TRANSIENT_DISPATCH_ERROR_PATTERNS, TRANSIENT_DISPATCH_RETRY_DELAYS_MS, CHANNEL_MESSAGE_LIMITS, DEFAULT_MESSAGE_LIMIT = 4000, MEDIA_BASE_PATH3, MEDIA_ICONS, MEDIA_WAIT_NULL, mediaCompletions, mediaResultCache, MEDIA_WAIT_TIMEOUT_MS = 30000, DEFAULT_SEND_MEDIA_PATH_TYPES, BOT_PREFIX = "\uD83E\uDD16 ", activeStreams, sessionActivityStore, PROC_REACT_START, PROC_REACT_DONE = "\u2705", providerCache, openclawClientPool, nullFilterWarnedInstances, ACTIVE_OWNER_IDENTIFIER_CACHE_TTL_MS = 1e4, cachedActiveOwnerIdentifiers = null, cachedActiveOwnerIdentifiersAt = 0, DEFAULT_GATE_MODEL = "gemini-3-flash-preview", GATE_TIMEOUT_MS = 3000, setupAgentResponder;
341269
+ var import_api32, log99, agentDispatchLimiter, _natsGenieProviderCtor, QUOTED_MESSAGE_MAX_CHARS = 4000, DM_HISTORY_LIMIT = 20, LIFECYCLE_PREVIEW_MAX_CHARS = 160, LIFECYCLE_SENSITIVE_KEY_PARTS, DEFAULT_DISPATCH_ERROR_MESSAGE = "\u26A0\uFE0F Sorry, I ran into an issue processing your message. Please try again.", DEFAULT_ERROR_HANDOFF_MESSAGE = "T\xF4 com um probleminha t\xE9cnico aqui agora. Logo algu\xE9m do time vai entrar em contato com voc\xEA.", TRANSIENT_DISPATCH_ERROR_PATTERNS, TRANSIENT_DISPATCH_RETRY_DELAYS_MS, CHANNEL_MESSAGE_LIMITS, DEFAULT_MESSAGE_LIMIT = 4000, MEDIA_BASE_PATH3, MEDIA_ICONS, MEDIA_WAIT_NULL, mediaCompletions, mediaResultCache, MEDIA_WAIT_TIMEOUT_MS = 30000, DEFAULT_SEND_MEDIA_PATH_TYPES, BOT_PREFIX = "\uD83E\uDD16 ", activeStreams, sessionActivityStore, PROC_REACT_START, PROC_REACT_DONE = "\u2705", providerCache, openclawClientPool, nullFilterWarnedInstances, ACTIVE_OWNER_IDENTIFIER_CACHE_TTL_MS = 1e4, cachedActiveOwnerIdentifiers = null, cachedActiveOwnerIdentifiersAt = 0, DEFAULT_GATE_MODEL = "gemini-3-flash-preview", GATE_TIMEOUT_MS = 3000, setupAgentResponder;
341202
341270
  var init_agent_dispatcher = __esm(() => {
341203
341271
  init_src2();
341204
341272
  init_src();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@automagik/omni",
3
- "version": "2.260624.2",
3
+ "version": "2.260624.3",
4
4
  "description": "LLM-optimized CLI for Omni",
5
5
  "type": "module",
6
6
  "bin": {