@indigoai-us/hq-cloud 6.16.89-alpha.0 → 6.17.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.
- package/dist/bin/outpost-heartbeat.d.ts +16 -0
- package/dist/bin/outpost-heartbeat.d.ts.map +1 -0
- package/dist/bin/outpost-heartbeat.js +86 -0
- package/dist/bin/outpost-heartbeat.js.map +1 -0
- package/dist/bin/outpost-heartbeat.test.d.ts +7 -0
- package/dist/bin/outpost-heartbeat.test.d.ts.map +1 -0
- package/dist/bin/outpost-heartbeat.test.js +84 -0
- package/dist/bin/outpost-heartbeat.test.js.map +1 -0
- package/dist/bin/sync-runner-company.d.ts +0 -2
- package/dist/bin/sync-runner-company.d.ts.map +1 -1
- package/dist/bin/sync-runner-company.js +0 -6
- package/dist/bin/sync-runner-company.js.map +1 -1
- package/dist/bin/sync-runner-watch-loop.d.ts +1 -26
- package/dist/bin/sync-runner-watch-loop.d.ts.map +1 -1
- package/dist/bin/sync-runner-watch-loop.js +3 -217
- package/dist/bin/sync-runner-watch-loop.js.map +1 -1
- package/dist/bin/sync-runner.d.ts +2 -22
- package/dist/bin/sync-runner.d.ts.map +1 -1
- package/dist/bin/sync-runner.js +3 -5
- package/dist/bin/sync-runner.js.map +1 -1
- package/dist/bin/sync-runner.test.js +0 -50
- package/dist/bin/sync-runner.test.js.map +1 -1
- package/dist/cli/share.d.ts +6 -18
- package/dist/cli/share.d.ts.map +1 -1
- package/dist/cli/share.js +47 -92
- package/dist/cli/share.js.map +1 -1
- package/dist/cli/share.test.js +3 -3
- package/dist/cli/share.test.js.map +1 -1
- package/dist/cli/sync.d.ts +4 -17
- package/dist/cli/sync.d.ts.map +1 -1
- package/dist/cli/sync.js +18 -136
- package/dist/cli/sync.js.map +1 -1
- package/dist/cli/sync.test.js +1 -230
- package/dist/cli/sync.test.js.map +1 -1
- package/dist/object-io.d.ts +7 -21
- package/dist/object-io.d.ts.map +1 -1
- package/dist/object-io.js +15 -106
- package/dist/object-io.js.map +1 -1
- package/dist/object-io.test.js +1 -138
- package/dist/object-io.test.js.map +1 -1
- package/dist/outposts/heartbeat-command.d.ts +11 -0
- package/dist/outposts/heartbeat-command.d.ts.map +1 -1
- package/dist/outposts/heartbeat-command.js +53 -48
- package/dist/outposts/heartbeat-command.js.map +1 -1
- package/dist/outposts/person-uid.d.ts +9 -0
- package/dist/outposts/person-uid.d.ts.map +1 -0
- package/dist/outposts/person-uid.js +31 -0
- package/dist/outposts/person-uid.js.map +1 -0
- package/dist/outposts/session-heartbeat-scan.test.d.ts +20 -0
- package/dist/outposts/session-heartbeat-scan.test.d.ts.map +1 -0
- package/dist/outposts/session-heartbeat-scan.test.js +241 -0
- package/dist/outposts/session-heartbeat-scan.test.js.map +1 -0
- package/dist/outposts/session-heartbeat.d.ts +22 -1
- package/dist/outposts/session-heartbeat.d.ts.map +1 -1
- package/dist/outposts/session-heartbeat.js +157 -61
- package/dist/outposts/session-heartbeat.js.map +1 -1
- package/dist/outposts/session-host-command.d.ts +24 -1
- package/dist/outposts/session-host-command.d.ts.map +1 -1
- package/dist/outposts/session-host-command.js +35 -3
- package/dist/outposts/session-host-command.js.map +1 -1
- package/dist/outposts/session-host-command.test.js +33 -1
- package/dist/outposts/session-host-command.test.js.map +1 -1
- package/dist/s3.d.ts +3 -8
- package/dist/s3.d.ts.map +1 -1
- package/dist/s3.js +7 -30
- package/dist/s3.js.map +1 -1
- package/dist/sync/inbound-event-admission.d.ts.map +1 -1
- package/dist/sync/inbound-event-admission.js +0 -3
- package/dist/sync/inbound-event-admission.js.map +1 -1
- package/dist/sync/inbound-event-admission.test.js +0 -6
- package/dist/sync/inbound-event-admission.test.js.map +1 -1
- package/dist/sync-core.d.ts +1 -2
- package/dist/sync-core.d.ts.map +1 -1
- package/dist/sync-core.js +10 -5
- package/dist/sync-core.js.map +1 -1
- package/dist/sync-core.test.js +0 -16
- package/dist/sync-core.test.js.map +1 -1
- package/package.json +3 -2
|
@@ -153,19 +153,6 @@ export class CooperativePassScheduler {
|
|
|
153
153
|
activeFastRealtime = null;
|
|
154
154
|
stopped = false;
|
|
155
155
|
_handoffActive = false;
|
|
156
|
-
/** A chore's payload transfer is in flight while it lends the root lock. */
|
|
157
|
-
networkTransferActive = false;
|
|
158
|
-
detachedChore = null;
|
|
159
|
-
networkTransferClosing = false;
|
|
160
|
-
networkTransferCount = 0;
|
|
161
|
-
networkTransferEpoch = 0;
|
|
162
|
-
networkTransferWaiters = [];
|
|
163
|
-
networkTransferRelease = null;
|
|
164
|
-
resolveNetworkTransferRelease = null;
|
|
165
|
-
/** Successful callers still applying results after the network hand-off. */
|
|
166
|
-
networkTransferCompletionCount = 0;
|
|
167
|
-
networkTransferApplyRelease = null;
|
|
168
|
-
resolveNetworkTransferApplyRelease = null;
|
|
169
156
|
constructor(now, starvationCapMs = CHORE_STARVATION_CAP_MS, options = {}) {
|
|
170
157
|
this.now = now;
|
|
171
158
|
this.starvationCapMs = starvationCapMs;
|
|
@@ -319,7 +306,6 @@ export class CooperativePassScheduler {
|
|
|
319
306
|
return;
|
|
320
307
|
if (this._handoffActive) {
|
|
321
308
|
this.promoteOccupancyArrivals();
|
|
322
|
-
this.admitHandoffBacklog();
|
|
323
309
|
return;
|
|
324
310
|
}
|
|
325
311
|
if (this.active !== null) {
|
|
@@ -429,215 +415,15 @@ export class CooperativePassScheduler {
|
|
|
429
415
|
execute(entry) {
|
|
430
416
|
if (entry.resourceCap)
|
|
431
417
|
this.options.caps?.beginChore();
|
|
432
|
-
const checkpoint = Object.assign(() => this.checkpoint(entry), {
|
|
433
|
-
shouldYieldToRealtime: () => this.shouldYieldToRealtime(entry),
|
|
434
|
-
runChoreNetworkTransfer: (work) => this.runChoreNetworkTransfer(entry, work),
|
|
435
|
-
});
|
|
436
418
|
return entry.task({
|
|
437
|
-
checkpoint,
|
|
419
|
+
checkpoint: () => this.checkpoint(entry),
|
|
438
420
|
signal: entry.controller.signal,
|
|
439
421
|
});
|
|
440
422
|
}
|
|
441
|
-
shouldYieldToRealtime(entry) {
|
|
442
|
-
return !this.stopped &&
|
|
443
|
-
entry.workClass === "chore" &&
|
|
444
|
-
this.active === entry &&
|
|
445
|
-
this.pending.some((pending) => pending.workClass === "realtime");
|
|
446
|
-
}
|
|
447
423
|
withinHandoffAdmission() {
|
|
448
424
|
if (this.handoffDeferredAt === null)
|
|
449
425
|
return false;
|
|
450
|
-
return this.
|
|
451
|
-
this.now() - this.handoffDeferredAt < realtimeDrainBurstMs();
|
|
452
|
-
}
|
|
453
|
-
/**
|
|
454
|
-
* Run payload I/O without owning the pass's durable state. Keep the chore
|
|
455
|
-
* slot reserved while realtime uses the root lock, then wait for active
|
|
456
|
-
* realtime writers before restoring chore ownership.
|
|
457
|
-
*/
|
|
458
|
-
async runChoreNetworkTransfer(entry, work) {
|
|
459
|
-
if (this.detachedChore === entry &&
|
|
460
|
-
this._handoffActive &&
|
|
461
|
-
this.networkTransferActive &&
|
|
462
|
-
!this.networkTransferClosing) {
|
|
463
|
-
return this.joinChoreNetworkTransfer(work);
|
|
464
|
-
}
|
|
465
|
-
if (this.detachedChore === entry &&
|
|
466
|
-
this._handoffActive &&
|
|
467
|
-
this.networkTransferRelease !== null) {
|
|
468
|
-
await this.networkTransferRelease;
|
|
469
|
-
return this.runChoreNetworkTransfer(entry, work);
|
|
470
|
-
}
|
|
471
|
-
if (this.active === entry && this.networkTransferApplyRelease !== null) {
|
|
472
|
-
await this.networkTransferApplyRelease;
|
|
473
|
-
return this.runChoreNetworkTransfer(entry, work);
|
|
474
|
-
}
|
|
475
|
-
if (this.stopped ||
|
|
476
|
-
entry.workClass !== "chore" ||
|
|
477
|
-
this.active !== entry) {
|
|
478
|
-
return { value: await work(), realtimeRan: false, complete: () => undefined };
|
|
479
|
-
}
|
|
480
|
-
this.active = null;
|
|
481
|
-
this._handoffActive = true;
|
|
482
|
-
this.networkTransferActive = true;
|
|
483
|
-
this.detachedChore = entry;
|
|
484
|
-
this.networkTransferClosing = false;
|
|
485
|
-
this.networkTransferCount = 1;
|
|
486
|
-
this.networkTransferCompletionCount = 1;
|
|
487
|
-
const applyReleased = new Promise((resolve) => {
|
|
488
|
-
this.resolveNetworkTransferApplyRelease = resolve;
|
|
489
|
-
});
|
|
490
|
-
this.networkTransferApplyRelease = applyReleased;
|
|
491
|
-
const released = new Promise((resolve) => {
|
|
492
|
-
this.resolveNetworkTransferRelease = resolve;
|
|
493
|
-
});
|
|
494
|
-
this.networkTransferRelease = released;
|
|
495
|
-
this.handoffDeferredAt = this.now();
|
|
496
|
-
this.handoffAdmitted = false;
|
|
497
|
-
this.handoffBacklog = null;
|
|
498
|
-
this.options.caps?.suspendForHandoff();
|
|
499
|
-
let value;
|
|
500
|
-
let failure;
|
|
501
|
-
let failed = false;
|
|
502
|
-
try {
|
|
503
|
-
// Admit an arrival that was queued just before the transfer began.
|
|
504
|
-
this.drain();
|
|
505
|
-
value = await work();
|
|
506
|
-
}
|
|
507
|
-
catch (err) {
|
|
508
|
-
failed = true;
|
|
509
|
-
failure = err;
|
|
510
|
-
}
|
|
511
|
-
finally {
|
|
512
|
-
this.networkTransferClosing = true;
|
|
513
|
-
this.networkTransferCount -= 1;
|
|
514
|
-
this.notifyNetworkTransferChange();
|
|
515
|
-
while (this.networkTransferCount > 0) {
|
|
516
|
-
const seen = this.networkTransferEpoch;
|
|
517
|
-
if (this.networkTransferCount === 0)
|
|
518
|
-
break;
|
|
519
|
-
await this.waitNetworkTransferChange(seen);
|
|
520
|
-
}
|
|
521
|
-
this.networkTransferActive = false;
|
|
522
|
-
// A long transfer may outlive the ordinary realtime burst. Start a new
|
|
523
|
-
// bounded window for arrivals that queued safely during network I/O.
|
|
524
|
-
this.handoffDeferredAt = this.now();
|
|
525
|
-
try {
|
|
526
|
-
this.drain();
|
|
527
|
-
while (!this.stopped &&
|
|
528
|
-
(this.realtimeOccupants.size > 0 || this.withinHandoffAdmission())) {
|
|
529
|
-
if (this.realtimeOccupants.size === 0) {
|
|
530
|
-
this.admitHandoffBacklog();
|
|
531
|
-
if (this.realtimeOccupants.size === 0)
|
|
532
|
-
break;
|
|
533
|
-
}
|
|
534
|
-
const seen = this.occupantEpoch;
|
|
535
|
-
if (this.realtimeOccupants.size === 0)
|
|
536
|
-
break;
|
|
537
|
-
await this.waitOccupantChange(seen);
|
|
538
|
-
this.promoteOccupancyArrivals();
|
|
539
|
-
this.admitHandoffBacklog();
|
|
540
|
-
}
|
|
541
|
-
while (this.realtimeOccupants.size > 0) {
|
|
542
|
-
const seen = this.occupantEpoch;
|
|
543
|
-
if (this.realtimeOccupants.size === 0)
|
|
544
|
-
break;
|
|
545
|
-
await this.waitOccupantChange(seen);
|
|
546
|
-
this.promoteOccupancyArrivals();
|
|
547
|
-
}
|
|
548
|
-
}
|
|
549
|
-
finally {
|
|
550
|
-
this._handoffActive = false;
|
|
551
|
-
this.handoffDeferredAt = null;
|
|
552
|
-
this.handoffBacklog = null;
|
|
553
|
-
this.detachedChore = null;
|
|
554
|
-
if (!this.stopped)
|
|
555
|
-
this.active = entry;
|
|
556
|
-
this.options.caps?.resumeAfterHandoff();
|
|
557
|
-
const resolveRelease = this.resolveNetworkTransferRelease;
|
|
558
|
-
const realtimeRan = this.handoffAdmitted;
|
|
559
|
-
this.networkTransferRelease = null;
|
|
560
|
-
this.resolveNetworkTransferRelease = null;
|
|
561
|
-
this.networkTransferClosing = false;
|
|
562
|
-
resolveRelease?.(realtimeRan);
|
|
563
|
-
}
|
|
564
|
-
}
|
|
565
|
-
const realtimeRan = await released;
|
|
566
|
-
if (failed) {
|
|
567
|
-
this.completeNetworkTransferParticipant();
|
|
568
|
-
throw failure;
|
|
569
|
-
}
|
|
570
|
-
return {
|
|
571
|
-
value,
|
|
572
|
-
realtimeRan,
|
|
573
|
-
complete: this.createNetworkTransferCompletion(),
|
|
574
|
-
};
|
|
575
|
-
}
|
|
576
|
-
async joinChoreNetworkTransfer(work) {
|
|
577
|
-
const released = this.networkTransferRelease;
|
|
578
|
-
if (released === null) {
|
|
579
|
-
throw new Error("network transfer hand-off is missing its release signal");
|
|
580
|
-
}
|
|
581
|
-
this.networkTransferCount += 1;
|
|
582
|
-
this.networkTransferCompletionCount += 1;
|
|
583
|
-
let value;
|
|
584
|
-
let failure;
|
|
585
|
-
let failed = false;
|
|
586
|
-
try {
|
|
587
|
-
value = await work();
|
|
588
|
-
}
|
|
589
|
-
catch (err) {
|
|
590
|
-
failed = true;
|
|
591
|
-
failure = err;
|
|
592
|
-
}
|
|
593
|
-
finally {
|
|
594
|
-
this.networkTransferCount -= 1;
|
|
595
|
-
this.notifyNetworkTransferChange();
|
|
596
|
-
}
|
|
597
|
-
const realtimeRan = await released;
|
|
598
|
-
if (failed) {
|
|
599
|
-
this.completeNetworkTransferParticipant();
|
|
600
|
-
throw failure;
|
|
601
|
-
}
|
|
602
|
-
return {
|
|
603
|
-
value,
|
|
604
|
-
realtimeRan,
|
|
605
|
-
complete: this.createNetworkTransferCompletion(),
|
|
606
|
-
};
|
|
607
|
-
}
|
|
608
|
-
createNetworkTransferCompletion() {
|
|
609
|
-
let completed = false;
|
|
610
|
-
return () => {
|
|
611
|
-
if (completed)
|
|
612
|
-
return;
|
|
613
|
-
completed = true;
|
|
614
|
-
this.completeNetworkTransferParticipant();
|
|
615
|
-
};
|
|
616
|
-
}
|
|
617
|
-
completeNetworkTransferParticipant() {
|
|
618
|
-
if (this.networkTransferCompletionCount <= 0)
|
|
619
|
-
return;
|
|
620
|
-
this.networkTransferCompletionCount -= 1;
|
|
621
|
-
if (this.networkTransferCompletionCount > 0)
|
|
622
|
-
return;
|
|
623
|
-
const resolve = this.resolveNetworkTransferApplyRelease;
|
|
624
|
-
this.resolveNetworkTransferApplyRelease = null;
|
|
625
|
-
this.networkTransferApplyRelease = null;
|
|
626
|
-
resolve?.();
|
|
627
|
-
}
|
|
628
|
-
waitNetworkTransferChange(seenEpoch) {
|
|
629
|
-
if (this.networkTransferEpoch !== seenEpoch)
|
|
630
|
-
return Promise.resolve();
|
|
631
|
-
return new Promise((resolve) => {
|
|
632
|
-
this.networkTransferWaiters.push(resolve);
|
|
633
|
-
});
|
|
634
|
-
}
|
|
635
|
-
notifyNetworkTransferChange() {
|
|
636
|
-
this.networkTransferEpoch += 1;
|
|
637
|
-
const waiters = this.networkTransferWaiters;
|
|
638
|
-
this.networkTransferWaiters = [];
|
|
639
|
-
for (const resolve of waiters)
|
|
640
|
-
resolve();
|
|
426
|
+
return this.now() - this.handoffDeferredAt < realtimeDrainBurstMs();
|
|
641
427
|
}
|
|
642
428
|
waitOccupantChange(seenEpoch) {
|
|
643
429
|
if (this.occupantEpoch !== seenEpoch)
|
|
@@ -1482,7 +1268,7 @@ export async function runWatchLoop(argv, parsed, deps, runtime) {
|
|
|
1482
1268
|
// repair/seed and before fanout. It starts ingress early, but never
|
|
1483
1269
|
// admits a second durable writer: queued realtime still waits for the
|
|
1484
1270
|
// existing scheduler's cooperative hand-off checkpoint.
|
|
1485
|
-
return runPass(passArgvForRun, checkpoint, () => activateEventPushSurfaces(), recordDurableAppliedUpserts
|
|
1271
|
+
return runPass(passArgvForRun, checkpoint, () => activateEventPushSurfaces(), recordDurableAppliedUpserts);
|
|
1486
1272
|
};
|
|
1487
1273
|
// Observe the heap at pass boundaries — a gated checkpoint immediately before
|
|
1488
1274
|
// admitting a pass and immediately after it returns. A pass that runs a long
|