overlord-cli 0.2608172109.0 → 0.2608180731.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.
package/dist/index.js CHANGED
@@ -17452,6 +17452,41 @@ var init_latch_events = __esm({
17452
17452
  }
17453
17453
  });
17454
17454
 
17455
+ // ../packages/core/dist/service/latch-harness-ingest.js
17456
+ function encodedEventSize(event) {
17457
+ return new TextEncoder().encode(JSON.stringify(event)).length;
17458
+ }
17459
+ function chunkLatchHarnessEventsForIngest({ events, from, maxBytes = HARNESS_EVENT_INGEST_MAX_BYTES }) {
17460
+ if (events.length === 0)
17461
+ return [];
17462
+ const chunks = [];
17463
+ let chunk = [];
17464
+ let chunkFrom = from;
17465
+ let used = 2;
17466
+ for (const event of events) {
17467
+ const size = encodedEventSize(event);
17468
+ const extra = (chunk.length === 0 ? 0 : 1) + size;
17469
+ if (chunk.length > 0 && used + extra > maxBytes) {
17470
+ chunks.push({ events: chunk, from: chunkFrom });
17471
+ chunkFrom += chunk.length;
17472
+ chunk = [event];
17473
+ used = 2 + size;
17474
+ continue;
17475
+ }
17476
+ chunk.push(event);
17477
+ used += extra;
17478
+ }
17479
+ chunks.push({ events: chunk, from: chunkFrom });
17480
+ return chunks;
17481
+ }
17482
+ var HARNESS_EVENT_INGEST_MAX_BYTES;
17483
+ var init_latch_harness_ingest = __esm({
17484
+ "../packages/core/dist/service/latch-harness-ingest.js"() {
17485
+ "use strict";
17486
+ HARNESS_EVENT_INGEST_MAX_BYTES = 64 * 1024;
17487
+ }
17488
+ });
17489
+
17455
17490
  // ../packages/core/dist/service/util.js
17456
17491
  function nowIso() {
17457
17492
  return (/* @__PURE__ */ new Date()).toISOString();
@@ -24241,14 +24276,20 @@ async function postLatchHarnessEventsAfterLaunch({
24241
24276
  from: 0
24242
24277
  });
24243
24278
  if (collected.events.length === 0) return;
24244
- await backend.post({
24245
- path: `/api/runner/requests/${requestId}/harness-events`,
24246
- body: {
24247
- providerSessionId,
24248
- events: collected.events,
24249
- from: collected.from
24250
- }
24279
+ const chunks = chunkLatchHarnessEventsForIngest({
24280
+ events: collected.events,
24281
+ from: collected.from
24251
24282
  });
24283
+ for (const chunk of chunks) {
24284
+ await backend.post({
24285
+ path: `/api/runner/requests/${requestId}/harness-events`,
24286
+ body: {
24287
+ providerSessionId,
24288
+ events: chunk.events,
24289
+ from: chunk.from
24290
+ }
24291
+ });
24292
+ }
24252
24293
  } catch {
24253
24294
  }
24254
24295
  }
@@ -24258,6 +24299,7 @@ var init_commands = __esm({
24258
24299
  "use strict";
24259
24300
  init_dist2();
24260
24301
  init_latch_events();
24302
+ init_latch_harness_ingest();
24261
24303
  init_project_metadata();
24262
24304
  init_local_target_mutation_runner();
24263
24305
  init_terminal_profile_types2();