@holon-run/agentinbox 1.9.0 → 1.9.1

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.
@@ -4005,6 +4005,35 @@ function summarizeSourceEvent(sourceType, sourceKey, eventVariant, metadata = {}
4005
4005
  }
4006
4006
  return summaryParts.join(":");
4007
4007
  }
4008
+ if (sourceType === "email_mailbox") {
4009
+ const sender = asNonEmptyString(metadata.from);
4010
+ const senderName = asNonEmptyString(metadata.fromName);
4011
+ const senderLabel = senderName && sender
4012
+ ? `${senderName} <${sender}>`
4013
+ : senderName ?? sender;
4014
+ const subject = asNonEmptyString(metadata.subject);
4015
+ const textPreview = asNonEmptyString(metadata.textPreview);
4016
+ const attachmentCount = typeof metadata.attachmentCount === "number"
4017
+ && Number.isInteger(metadata.attachmentCount)
4018
+ && metadata.attachmentCount > 0
4019
+ ? metadata.attachmentCount
4020
+ : null;
4021
+ const hasAttachments = metadata.hasAttachments === true || attachmentCount !== null;
4022
+ const attachmentLabel = hasAttachments
4023
+ ? attachmentCount === 1
4024
+ ? "1 attachment"
4025
+ : attachmentCount !== null
4026
+ ? `${attachmentCount} attachments`
4027
+ : "attachments"
4028
+ : null;
4029
+ const details = [
4030
+ senderLabel ? `from ${senderLabel}` : null,
4031
+ subject ? `"${truncateSummary(compactSummaryText(subject), 160)}"` : null,
4032
+ textPreview ? `— ${truncateSummary(compactSummaryText(textPreview), 240)}` : null,
4033
+ attachmentLabel ? `with ${attachmentLabel}` : null,
4034
+ ].filter((value) => value != null);
4035
+ return `${sourceType}:${sourceKey}${details.length > 0 ? ` ${details.join(" ")}` : `:${eventVariant}`}`;
4036
+ }
4008
4037
  return `${sourceType}:${sourceKey}:${eventVariant}`;
4009
4038
  }
4010
4039
  function asNonEmptyString(value) {
@@ -4020,6 +4049,9 @@ function truncateSummary(value, maxChars) {
4020
4049
  }
4021
4050
  return `${value.slice(0, Math.max(0, maxChars - 3)).trimEnd()}...`;
4022
4051
  }
4052
+ function compactSummaryText(value) {
4053
+ return value.replace(/\s+/g, " ").trim();
4054
+ }
4023
4055
  function summarizeDirectInboxMessage(sender) {
4024
4056
  if (sender) {
4025
4057
  return `direct_text_message:${sender}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@holon-run/agentinbox",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "description": "Local event subscription and delivery service for agents.",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {