orchajs 0.23.9 → 0.23.10

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.
@@ -10,6 +10,7 @@ const RELEVANT_EVENTS = new Set([
10
10
  const MAX_BATCH_RUNS = 100;
11
11
  const MAX_KEEPALIVE_BYTES = 48 * 1024;
12
12
  const HEARTBEAT_INTERVAL_MS = 30_000;
13
+ const EVALUATION_FLUSH_TIMEOUT_MS = 5_000;
13
14
  export class AmarsiaTelemetryClient {
14
15
  #key;
15
16
  #baseUrl;
@@ -234,11 +235,17 @@ export function withAmarsiaTelemetry(options) {
234
235
  pending.delete(sessionId);
235
236
  }
236
237
  });
237
- if (events.some((event) => event.type === "run.completed" ||
238
+ const hasTerminalRunEvent = events.some((event) => event.type === "run.completed" ||
238
239
  event.type === "run.failed" ||
239
- event.type === "run.paused")) {
240
+ event.type === "run.paused");
241
+ const hasEvaluationResult = events.some((event) => event.type === "evaluation.completed" ||
242
+ event.type === "evaluation.failed");
243
+ if (hasTerminalRunEvent || hasEvaluationResult) {
240
244
  await processing;
241
245
  }
246
+ if (hasEvaluationResult) {
247
+ await client.drain({ timeoutMs: EVALUATION_FLUSH_TIMEOUT_MS });
248
+ }
242
249
  },
243
250
  };
244
251
  }
@@ -35,6 +35,7 @@ const RELEVANT_EVENTS = /* @__PURE__ */ new Set([
35
35
  const MAX_BATCH_RUNS = 100;
36
36
  const MAX_KEEPALIVE_BYTES = 48 * 1024;
37
37
  const HEARTBEAT_INTERVAL_MS = 3e4;
38
+ const EVALUATION_FLUSH_TIMEOUT_MS = 5e3;
38
39
  class AmarsiaTelemetryClient {
39
40
  #key;
40
41
  #baseUrl;
@@ -249,11 +250,18 @@ function withAmarsiaTelemetry(options) {
249
250
  pending.delete(sessionId);
250
251
  }
251
252
  });
252
- if (events.some(
253
+ const hasTerminalRunEvent = events.some(
253
254
  (event) => event.type === "run.completed" || event.type === "run.failed" || event.type === "run.paused"
254
- )) {
255
+ );
256
+ const hasEvaluationResult = events.some(
257
+ (event) => event.type === "evaluation.completed" || event.type === "evaluation.failed"
258
+ );
259
+ if (hasTerminalRunEvent || hasEvaluationResult) {
255
260
  await processing;
256
261
  }
262
+ if (hasEvaluationResult) {
263
+ await client.drain({ timeoutMs: EVALUATION_FLUSH_TIMEOUT_MS });
264
+ }
257
265
  }
258
266
  };
259
267
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "orchajs",
3
- "version": "0.23.9",
3
+ "version": "0.23.10",
4
4
  "description": "A filesystem-convention, stateful agent framework for JavaScript.",
5
5
  "license": "MIT",
6
6
  "repository": {