@bldrs-ai/conway 1.511.1441 → 1.513.1447

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.
Files changed (39) hide show
  1. package/compiled/examples/browser-bundled.cjs +82 -16
  2. package/compiled/examples/cli-bundled.cjs +98 -23
  3. package/compiled/examples/cli-step-bundled.cjs +82 -16
  4. package/compiled/examples/validator-bundled.cjs +82 -16
  5. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts +3 -2
  6. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts.map +1 -1
  7. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.js +69 -25
  8. package/compiled/src/compat/web-ifc/parse_aabb_imposter.d.ts +41 -0
  9. package/compiled/src/compat/web-ifc/parse_aabb_imposter.d.ts.map +1 -0
  10. package/compiled/src/compat/web-ifc/parse_aabb_imposter.js +161 -0
  11. package/compiled/src/compat/web-ifc/parse_aabb_imposter.test.d.ts +2 -0
  12. package/compiled/src/compat/web-ifc/parse_aabb_imposter.test.d.ts.map +1 -0
  13. package/compiled/src/compat/web-ifc/parse_aabb_imposter.test.js +39 -0
  14. package/compiled/src/compat/web-ifc/streamed_preview_channel.d.ts +13 -0
  15. package/compiled/src/compat/web-ifc/streamed_preview_channel.d.ts.map +1 -1
  16. package/compiled/src/core/progress.d.ts +8 -1
  17. package/compiled/src/core/progress.d.ts.map +1 -1
  18. package/compiled/src/core/progress.js +9 -4
  19. package/compiled/src/core/progress_log.d.ts +1 -0
  20. package/compiled/src/core/progress_log.d.ts.map +1 -1
  21. package/compiled/src/core/progress_log.js +7 -2
  22. package/compiled/src/core/progress_log.test.js +21 -0
  23. package/compiled/src/ifc/ifc_stream_open.test.js +60 -0
  24. package/compiled/src/step/parsing/step_parser.d.ts +2 -2
  25. package/compiled/src/step/parsing/step_parser.d.ts.map +1 -1
  26. package/compiled/src/step/parsing/step_parser.js +8 -2
  27. package/compiled/src/step/parsing/streaming_index_builder.d.ts +4 -4
  28. package/compiled/src/step/parsing/streaming_index_builder.d.ts.map +1 -1
  29. package/compiled/src/step/step_buffer_provider.d.ts +4 -3
  30. package/compiled/src/step/step_buffer_provider.d.ts.map +1 -1
  31. package/compiled/src/step/step_buffer_provider.js +4 -3
  32. package/compiled/src/step/step_entity_base.d.ts.map +1 -1
  33. package/compiled/src/step/step_entity_base.js +9 -0
  34. package/compiled/src/step/step_model_base.d.ts +9 -0
  35. package/compiled/src/step/step_model_base.d.ts.map +1 -1
  36. package/compiled/src/step/step_model_base.js +72 -13
  37. package/compiled/src/version/version.js +1 -1
  38. package/compiled/tsconfig.tsbuildinfo +1 -1
  39. package/package.json +1 -1
@@ -307,6 +307,9 @@ export default class StepModelBase {
307
307
  if (element.vtableIndex === void 0 && !this.populateVtableEntryRaw(element)) {
308
308
  return void 0;
309
309
  }
310
+ if (element.buffer === void 0) {
311
+ this.populateBufferEntry(localID);
312
+ }
310
313
  const vtable = element.vtable;
311
314
  const buffer = element.buffer;
312
315
  if (vtable === void 0 || buffer === void 0 ||
@@ -383,6 +386,12 @@ export default class StepModelBase {
383
386
  const element = this.entry(localID);
384
387
  element.buffer =
385
388
  this.bufferProvider_.acquire(element.address, element.length).buffer;
389
+ if (element.multiMapping !== void 0) {
390
+ for (const mapped of element.multiMapping) {
391
+ mapped.buffer =
392
+ this.bufferProvider_.acquire(mapped.address, mapped.length).buffer;
393
+ }
394
+ }
386
395
  }
387
396
  /**
388
397
  * Get the size in bytes of the backing buffer for this.
@@ -504,24 +513,45 @@ export default class StepModelBase {
504
513
  if (!this.isSourceExternal) {
505
514
  return seen;
506
515
  }
507
- const stack = [localID];
516
+ // BFS by hop: page a whole frontier in parallel so a product whose
517
+ // #refs sit in different OPFS chunks is one round-trip, not one
518
+ // await per record. Claim `seen` before the await so overlapping
519
+ // walks (a batch of products sharing mapped geometry) pin once.
520
+ const frontier = [];
521
+ const enqueue = (id) => {
522
+ if (id < this.count_ && !seen.has(id)) {
523
+ frontier.push(id);
524
+ }
525
+ };
526
+ enqueue(localID);
508
527
  if (extraLocalIDs !== void 0) {
509
528
  for (const extra of extraLocalIDs) {
510
- stack.push(extra);
529
+ enqueue(extra);
511
530
  }
512
531
  }
513
- while (stack.length > 0) {
514
- const id = stack.pop();
515
- if (seen.has(id) || id >= this.count_) {
516
- continue;
532
+ while (frontier.length > 0) {
533
+ const wave = [];
534
+ for (const id of frontier) {
535
+ if (seen.has(id) || id >= this.count_) {
536
+ continue;
537
+ }
538
+ // Claim + pin before the await so a sibling ensure cannot
539
+ // evict this range once its own ensurePins_ drop.
540
+ seen.add(id);
541
+ this.pinByLocalID(id);
542
+ wave.push(id);
543
+ }
544
+ frontier.length = 0;
545
+ if (wave.length === 0) {
546
+ break;
517
547
  }
518
- seen.add(id);
519
- await this.ensureResidentByLocalID(id);
520
- this.pinByLocalID(id);
521
- for (const expressID of this.scanRecordRefs_(id)) {
522
- const referenced = this.expressIDMap_.get(expressID);
523
- if (referenced !== void 0 && !seen.has(referenced)) {
524
- stack.push(referenced);
548
+ await Promise.all(wave.map((id) => this.ensureResidentByLocalID(id)));
549
+ for (const id of wave) {
550
+ for (const expressID of this.scanRecordRefs_(id)) {
551
+ const referenced = this.expressIDMap_.get(expressID);
552
+ if (referenced !== void 0 && !seen.has(referenced)) {
553
+ frontier.push(referenced);
554
+ }
525
555
  }
526
556
  }
527
557
  }
@@ -550,6 +580,35 @@ export default class StepModelBase {
550
580
  }
551
581
  this.bufferProvider_.unpinRange?.(this.address_[localID], this.length_[localID]);
552
582
  }
583
+ /**
584
+ * Drop captured source-window views on `localIDs` so the LRU can
585
+ * evict those chunks. Vtables stay — `acquire` of the same
586
+ * `(address, length)` is at a stable base. The next
587
+ * `ensureResident` + field read rematerialises the view.
588
+ *
589
+ * @param localIDs Records whose `buffer` views to drop.
590
+ */
591
+ releaseSourceViews(localIDs) {
592
+ if (!this.isSourceExternal) {
593
+ return;
594
+ }
595
+ for (const localID of localIDs) {
596
+ if (localID >= this.count_) {
597
+ continue;
598
+ }
599
+ const item = this.complexEntries_?.get(localID) ?? this.descriptorCache_[localID];
600
+ if (item === void 0) {
601
+ continue;
602
+ }
603
+ item.buffer = void 0;
604
+ if (item.multiMapping !== void 0) {
605
+ for (const mapped of item.multiMapping) {
606
+ mapped.buffer = void 0;
607
+ }
608
+ }
609
+ }
610
+ releaseScratchParsingBuffer();
611
+ }
553
612
  /**
554
613
  * Unpin every local ID in `localIDs` (best-effort; missing IDs are
555
614
  * ignored). Use after {@link ensureResidentClosureByLocalID}, which
@@ -5,5 +5,5 @@
5
5
  // only the first segment (major) is meaningful and is the one CI carries forward.
6
6
  // Must stay in `vN.N.N` shape: the CI stamp regex, scripts/updateVersion.mjs, and
7
7
  // statistics.ts all match `v\d+\.\d+\.\d+`.
8
- const versionString = 'Conway v1.511.1441';
8
+ const versionString = 'Conway v1.513.1447';
9
9
  export { versionString };