@sema-agent/core 1.330.0 → 1.332.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.
@@ -652,27 +652,38 @@ export class Runner {
652
652
  const deliver = item.priority === "later"
653
653
  ? notificationHarness.followUp(xml, { provenance: "engine-note" })
654
654
  : notificationHarness.steer(xml, { provenance: "engine-note" });
655
- void deliver.catch(() => {
655
+ void deliver.then(() => item.onDisposition?.("queued"), () => {
656
656
  if (notificationSessionId !== undefined)
657
657
  this.pendingSessionNotifications.pend(notificationSessionId, item.payload);
658
+ item.onDisposition?.("parked");
658
659
  });
659
660
  }
661
+ else {
662
+ if (notificationSessionId !== undefined)
663
+ this.pendingSessionNotifications.pend(notificationSessionId, item.payload);
664
+ item.onDisposition?.("parked");
665
+ }
660
666
  });
661
667
  const upstreamTaskNotification = internals?.onTaskNotification;
662
668
  const deliveredAtTurnOpen = new Set();
663
669
  const injectTaskNotification = (notification, opts) => {
664
670
  if (deliveredAtTurnOpen.has(taskNotificationDedupKey(notification)))
665
- return;
671
+ return Promise.resolve("dropped_duplicate");
666
672
  if (!notificationLaneLive) {
667
673
  if (notificationSessionId !== undefined)
668
674
  this.pendingSessionNotifications.pend(notificationSessionId, notification);
669
- return;
670
- }
671
- taskNotificationQueue.enqueue({
672
- kind: "task_notification",
673
- priority: opts?.priority ?? "later",
674
- dedupKey: taskNotificationDedupKey(notification),
675
- payload: notification,
675
+ return Promise.resolve("parked");
676
+ }
677
+ return new Promise((resolve) => {
678
+ const accepted = taskNotificationQueue.enqueue({
679
+ kind: "task_notification",
680
+ priority: opts?.priority ?? "later",
681
+ dedupKey: taskNotificationDedupKey(notification),
682
+ payload: notification,
683
+ onDisposition: resolve,
684
+ });
685
+ if (!accepted)
686
+ resolve("queued");
676
687
  });
677
688
  };
678
689
  const prepared = await prepareTask(spec, this.deps, this.sessions, prepareResume, memorySelector, {