@neotx/core 0.1.0-alpha.20 → 0.1.0-alpha.21

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
@@ -1092,7 +1092,11 @@ var WebhookDispatcher = class {
1092
1092
  headers["X-Neo-Signature"] = sign(body, webhook.secret);
1093
1093
  }
1094
1094
  if (RETRY_EVENT_TYPES.has(event.type)) {
1095
- const p = sendWithRetry(webhook.url, headers, body, webhook.timeoutMs).catch(() => {
1095
+ const p = sendWithRetry(webhook.url, headers, body, webhook.timeoutMs).catch((err) => {
1096
+ console.debug(
1097
+ `[neo] Webhook delivery failed for ${event.type} to ${webhook.url}:`,
1098
+ err
1099
+ );
1096
1100
  }).finally(() => this.pending.delete(p));
1097
1101
  this.pending.add(p);
1098
1102
  } else {
@@ -1101,7 +1105,8 @@ var WebhookDispatcher = class {
1101
1105
  headers,
1102
1106
  body,
1103
1107
  signal: AbortSignal.timeout(webhook.timeoutMs)
1104
- }).catch(() => {
1108
+ }).catch((err) => {
1109
+ console.debug(`[neo] Webhook delivery failed for ${event.type} to ${webhook.url}:`, err);
1105
1110
  });
1106
1111
  }
1107
1112
  }
@@ -2740,7 +2745,8 @@ var Orchestrator = class extends NeoEventEmitter {
2740
2745
  emit(event) {
2741
2746
  super.emit(event);
2742
2747
  if (this.eventJournal) {
2743
- this.eventJournal.append(event).catch(() => {
2748
+ this.eventJournal.append(event).catch((err) => {
2749
+ console.debug("[neo] Event journal append failed:", err);
2744
2750
  });
2745
2751
  }
2746
2752
  if (this.webhookDispatcher) {
@@ -2866,6 +2872,11 @@ var Orchestrator = class extends NeoEventEmitter {
2866
2872
  if (sessionPath) {
2867
2873
  await this.finalizeSession(sessionPath, ctx);
2868
2874
  }
2875
+ for (const mw of this.userMiddleware) {
2876
+ if ("cleanup" in mw && typeof mw.cleanup === "function") {
2877
+ mw.cleanup(sessionId);
2878
+ }
2879
+ }
2869
2880
  this.semaphore.release(sessionId);
2870
2881
  this._activeSessions.delete(sessionId);
2871
2882
  this.abortControllers.delete(sessionId);
@@ -3054,7 +3065,8 @@ var Orchestrator = class extends NeoEventEmitter {
3054
3065
  durationMs: Date.now() - ctx.startedAt,
3055
3066
  repo: ctx.input.repo
3056
3067
  };
3057
- this.costJournal.append(costEntry).catch(() => {
3068
+ this.costJournal.append(costEntry).catch((err) => {
3069
+ console.debug("[neo] Cost journal append failed:", err);
3058
3070
  });
3059
3071
  }
3060
3072
  this.emit({
@@ -3720,7 +3732,8 @@ var EventQueue = class {
3720
3732
  watchJsonlFile(filePath, kind) {
3721
3733
  try {
3722
3734
  const watcher = watch2(filePath, () => {
3723
- this.readNewLines(filePath, kind).catch(() => {
3735
+ this.readNewLines(filePath, kind).catch((err) => {
3736
+ console.debug(`[neo] Failed to read new lines from ${filePath}:`, err);
3724
3737
  });
3725
3738
  });
3726
3739
  this.watchers.push(watcher);