@bldrs-ai/conway 1.509.1435 → 1.511.1441

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 (73) hide show
  1. package/compiled/examples/browser-bundled.cjs +410 -16
  2. package/compiled/examples/cli-bundled.cjs +544 -18
  3. package/compiled/examples/cli-step-bundled.cjs +312 -16
  4. package/compiled/examples/validator-bundled.cjs +410 -16
  5. package/compiled/src/compat/web-ifc/ifc_api.d.ts +33 -0
  6. package/compiled/src/compat/web-ifc/ifc_api.d.ts.map +1 -1
  7. package/compiled/src/compat/web-ifc/ifc_api.js +47 -0
  8. package/compiled/src/compat/web-ifc/ifc_api_deferred_open.test.js +29 -0
  9. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough.d.ts +8 -0
  10. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough.d.ts.map +1 -1
  11. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough_factory.d.ts +14 -0
  12. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough_factory.d.ts.map +1 -1
  13. package/compiled/src/compat/web-ifc/ifc_api_model_passthrough_factory.js +33 -0
  14. package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.d.ts +7 -0
  15. package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.d.ts.map +1 -1
  16. package/compiled/src/compat/web-ifc/ifc_api_proxy_ap214.js +16 -0
  17. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts +64 -0
  18. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.d.ts.map +1 -1
  19. package/compiled/src/compat/web-ifc/ifc_api_proxy_ifc.js +293 -30
  20. package/compiled/src/compat/web-ifc/ifc_api_streamed_open.test.js +29 -0
  21. package/compiled/src/ifc/ifc_demand_extraction.test.js +12 -1
  22. package/compiled/src/ifc/ifc_geometry_extraction.d.ts +35 -0
  23. package/compiled/src/ifc/ifc_geometry_extraction.d.ts.map +1 -1
  24. package/compiled/src/ifc/ifc_geometry_extraction.js +142 -2
  25. package/compiled/src/ifc/ifc_step_parser.d.ts +23 -1
  26. package/compiled/src/ifc/ifc_step_parser.d.ts.map +1 -1
  27. package/compiled/src/ifc/ifc_step_parser.js +23 -1
  28. package/compiled/src/ifc/ifc_stream_open.d.ts +28 -1
  29. package/compiled/src/ifc/ifc_stream_open.d.ts.map +1 -1
  30. package/compiled/src/ifc/ifc_stream_open.js +44 -1
  31. package/compiled/src/ifc/ifc_stream_open.test.js +10 -1
  32. package/compiled/src/index.d.ts +3 -2
  33. package/compiled/src/index.d.ts.map +1 -1
  34. package/compiled/src/index.js +3 -2
  35. package/compiled/src/namespace_surface.test.js +3 -0
  36. package/compiled/src/step/parsing/byte_source.d.ts +98 -0
  37. package/compiled/src/step/parsing/byte_source.d.ts.map +1 -1
  38. package/compiled/src/step/parsing/byte_source.js +71 -0
  39. package/compiled/src/step/parsing/byte_source.test.d.ts +2 -0
  40. package/compiled/src/step/parsing/byte_source.test.d.ts.map +1 -0
  41. package/compiled/src/step/parsing/byte_source.test.js +47 -0
  42. package/compiled/src/step/parsing/byte_source_node.d.ts +41 -0
  43. package/compiled/src/step/parsing/byte_source_node.d.ts.map +1 -0
  44. package/compiled/src/step/parsing/byte_source_node.js +54 -0
  45. package/compiled/src/step/parsing/express_ref_scan.d.ts +20 -0
  46. package/compiled/src/step/parsing/express_ref_scan.d.ts.map +1 -0
  47. package/compiled/src/step/parsing/express_ref_scan.js +91 -0
  48. package/compiled/src/step/parsing/express_ref_scan.test.d.ts +2 -0
  49. package/compiled/src/step/parsing/express_ref_scan.test.d.ts.map +1 -0
  50. package/compiled/src/step/parsing/express_ref_scan.test.js +28 -0
  51. package/compiled/src/step/parsing/step_parser.d.ts +7 -4
  52. package/compiled/src/step/parsing/step_parser.d.ts.map +1 -1
  53. package/compiled/src/step/parsing/step_parser.js +25 -6
  54. package/compiled/src/step/parsing/streaming_index_builder.d.ts +3 -3
  55. package/compiled/src/step/parsing/streaming_index_builder.d.ts.map +1 -1
  56. package/compiled/src/step/parsing/streaming_index_builder.js +27 -7
  57. package/compiled/src/step/parsing/streaming_index_builder_async.test.js +13 -1
  58. package/compiled/src/step/step_buffer_provider.d.ts +44 -0
  59. package/compiled/src/step/step_buffer_provider.d.ts.map +1 -1
  60. package/compiled/src/step/step_buffer_provider.js +56 -8
  61. package/compiled/src/step/step_buffer_provider.test.js +14 -0
  62. package/compiled/src/step/step_entity_base.d.ts +15 -0
  63. package/compiled/src/step/step_entity_base.d.ts.map +1 -1
  64. package/compiled/src/step/step_entity_base.js +33 -0
  65. package/compiled/src/step/step_model_base.d.ts +62 -0
  66. package/compiled/src/step/step_model_base.d.ts.map +1 -1
  67. package/compiled/src/step/step_model_base.js +136 -0
  68. package/compiled/src/stream/index.d.ts +3 -2
  69. package/compiled/src/stream/index.d.ts.map +1 -1
  70. package/compiled/src/stream/index.js +3 -2
  71. package/compiled/src/version/version.js +1 -1
  72. package/compiled/tsconfig.tsbuildinfo +1 -1
  73. package/package.json +1 -1
@@ -944,7 +944,7 @@ var EntityTypesIfcCount = 909;
944
944
  var entity_types_ifc_gen_default = EntityTypesIfc;
945
945
 
946
946
  // compiled/src/version/version.js
947
- var versionString = "Conway v1.509.1435";
947
+ var versionString = "Conway v1.511.1441";
948
948
 
949
949
  // compiled/dependencies/conway-geom/interface/conway_geometry.js
950
950
  var wasmType = "";
@@ -3523,7 +3523,9 @@ var StepParser = class extends StepHeaderParser {
3523
3523
  if (next.done === true) {
3524
3524
  return next.value;
3525
3525
  }
3526
- onProgress?.(next.value);
3526
+ if (typeof next.value === "number") {
3527
+ onProgress?.(next.value);
3528
+ }
3527
3529
  }
3528
3530
  }
3529
3531
  /**
@@ -3535,7 +3537,8 @@ var StepParser = class extends StepHeaderParser {
3535
3537
  *
3536
3538
  * @param input The input parsing buffer, positioned at the data section.
3537
3539
  * @param onRecordBoundary Called at each top-level record boundary with the
3538
- * buffer; the callback may rebase the buffer's window in place.
3540
+ * buffer; the callback may rebase the buffer's window in place. Must be
3541
+ * synchronous on this driver — a returned Promise is a caller bug.
3539
3542
  * @param onRecordIndexed Called as each top-level record is indexed, with
3540
3543
  * its localID, expressID and typeID (0 for external-mapping records) — the
3541
3544
  * seam for incremental semantic consumers (type index, roots registry,
@@ -3551,6 +3554,9 @@ var StepParser = class extends StepHeaderParser {
3551
3554
  if (next.done === true) {
3552
3555
  return next.value;
3553
3556
  }
3557
+ if (typeof next.value !== "number") {
3558
+ throw new Error("parseDataBlockStreamed: async window slide requires parseDataBlockStreamedAsync");
3559
+ }
3554
3560
  onProgress?.(next.value);
3555
3561
  }
3556
3562
  }
@@ -3563,7 +3569,9 @@ var StepParser = class extends StepHeaderParser {
3563
3569
  *
3564
3570
  * @param input The input parsing buffer, positioned at the data section.
3565
3571
  * @param onRecordBoundary Called at each top-level record boundary with the
3566
- * buffer; the callback may rebase the buffer's window in place.
3572
+ * buffer; the callback may rebase the buffer's window in place. May return
3573
+ * a Promise when the slide itself is I/O (an async ByteSource); this
3574
+ * driver awaits it before the next record is lexed.
3567
3575
  * @param onRecordIndexed Called as each top-level record is indexed — see
3568
3576
  * parseDataBlockStreamed.
3569
3577
  * @param onProgress Optional byte-cursor progress callback.
@@ -3580,6 +3588,10 @@ var StepParser = class extends StepHeaderParser {
3580
3588
  if (next.done === true) {
3581
3589
  return next.value;
3582
3590
  }
3591
+ if (typeof next.value !== "number") {
3592
+ await next.value;
3593
+ continue;
3594
+ }
3583
3595
  onProgress?.(next.value);
3584
3596
  if (Date.now() - lastYield >= yieldIntervalMs) {
3585
3597
  await yieldToEventLoop();
@@ -3607,7 +3619,9 @@ var StepParser = class extends StepHeaderParser {
3607
3619
  if (next.done === true) {
3608
3620
  return next.value;
3609
3621
  }
3610
- onProgress?.(next.value);
3622
+ if (typeof next.value === "number") {
3623
+ onProgress?.(next.value);
3624
+ }
3611
3625
  if (Date.now() - lastYield >= yieldIntervalMs) {
3612
3626
  await yieldToEventLoop();
3613
3627
  lastYield = Date.now();
@@ -3771,7 +3785,10 @@ var StepParser = class extends StepHeaderParser {
3771
3785
  if ((++parsedElementCount & PARSE_PROGRESS_ELEMENT_MASK) === 0) {
3772
3786
  yield input.cursor;
3773
3787
  }
3774
- onRecordBoundary?.(input);
3788
+ const slide = onRecordBoundary?.(input);
3789
+ if (slide !== void 0 && typeof slide.then === "function") {
3790
+ yield slide;
3791
+ }
3775
3792
  if (!charws(HASH2)) {
3776
3793
  if (tokenws(END_SECTION)) {
3777
3794
  return parseResult2(ParseResult.COMPLETE);
@@ -4398,6 +4415,70 @@ var encodedDataEntityTypesIfc = new TextEncoder().encode("IFCSECTIONEDSPINEIFCST
4398
4415
  var EntityTypesIfcSearch = new MinimalPerfectHash(gMapEntityTypesIfc, prefixSumAddressEntityTypesIfc, slotMapEntityTypesIfc, encodedDataEntityTypesIfc);
4399
4416
  var entity_types_search_gen_default = EntityTypesIfcSearch;
4400
4417
 
4418
+ // compiled/src/step/parsing/express_ref_scan.js
4419
+ var HASH3 = 35;
4420
+ var QUOTE4 = 39;
4421
+ var DQUOTE = 34;
4422
+ var ZERO5 = 48;
4423
+ var NINE2 = 57;
4424
+ var SLASH3 = 47;
4425
+ var STAR2 = 42;
4426
+ function scanExpressRefs(bytes, from = 0, length = bytes.length - from) {
4427
+ const refs = [];
4428
+ const seen = /* @__PURE__ */ new Set();
4429
+ const end = Math.min(from + length, bytes.length);
4430
+ let cursor = from;
4431
+ while (cursor < end) {
4432
+ const byte = bytes[cursor];
4433
+ if (byte === QUOTE4) {
4434
+ cursor = skipQuoted_(bytes, cursor + 1, end, QUOTE4, true);
4435
+ continue;
4436
+ }
4437
+ if (byte === DQUOTE) {
4438
+ cursor = skipQuoted_(bytes, cursor + 1, end, DQUOTE, false);
4439
+ continue;
4440
+ }
4441
+ if (byte === SLASH3 && cursor + 1 < end && bytes[cursor + 1] === STAR2) {
4442
+ cursor += 2;
4443
+ while (cursor + 1 < end && !(bytes[cursor] === STAR2 && bytes[cursor + 1] === SLASH3)) {
4444
+ ++cursor;
4445
+ }
4446
+ cursor += 2;
4447
+ continue;
4448
+ }
4449
+ if (byte === HASH3) {
4450
+ let value = 0;
4451
+ let digit = cursor + 1;
4452
+ while (digit < end && bytes[digit] >= ZERO5 && bytes[digit] <= NINE2) {
4453
+ value = value * 10 + (bytes[digit] - ZERO5);
4454
+ ++digit;
4455
+ }
4456
+ if (digit > cursor + 1 && value !== 0 && !seen.has(value)) {
4457
+ seen.add(value);
4458
+ refs.push(value);
4459
+ }
4460
+ cursor = digit;
4461
+ continue;
4462
+ }
4463
+ ++cursor;
4464
+ }
4465
+ return refs;
4466
+ }
4467
+ function skipQuoted_(bytes, from, end, quote, doubledEscape) {
4468
+ let cursor = from;
4469
+ while (cursor < end) {
4470
+ if (bytes[cursor] === quote) {
4471
+ if (doubledEscape && cursor + 1 < end && bytes[cursor + 1] === quote) {
4472
+ cursor += 2;
4473
+ continue;
4474
+ }
4475
+ return cursor + 1;
4476
+ }
4477
+ ++cursor;
4478
+ }
4479
+ return end;
4480
+ }
4481
+
4401
4482
  // compiled/src/step/step_buffer_provider.js
4402
4483
  var DEFAULT_CHUNK_BYTES = 4 * 1024 * 1024;
4403
4484
  var DEFAULT_MAX_RESIDENT_CHUNKS = 16;
@@ -4578,7 +4659,7 @@ var WindowedStepBufferProvider = class {
4578
4659
  const firstChunk = Math.floor(address / chunkBytes);
4579
4660
  const lastChunk = Math.floor((address + Math.max(length, 1) - 1) / chunkBytes);
4580
4661
  for (let chunkIndex = firstChunk; chunkIndex <= lastChunk; ++chunkIndex) {
4581
- this.ensurePins_.set(chunkIndex, (this.ensurePins_.get(chunkIndex) ?? 0) + 1);
4662
+ this.addPin_(chunkIndex, 1);
4582
4663
  }
4583
4664
  try {
4584
4665
  const loads = [];
@@ -4621,15 +4702,63 @@ var WindowedStepBufferProvider = class {
4621
4702
  }
4622
4703
  } finally {
4623
4704
  for (let chunkIndex = firstChunk; chunkIndex <= lastChunk; ++chunkIndex) {
4624
- const pins = this.ensurePins_.get(chunkIndex) ?? 0;
4625
- if (pins <= 1) {
4626
- this.ensurePins_.delete(chunkIndex);
4627
- } else {
4628
- this.ensurePins_.set(chunkIndex, pins - 1);
4629
- }
4705
+ this.addPin_(chunkIndex, -1);
4630
4706
  }
4631
4707
  }
4632
4708
  }
4709
+ /**
4710
+ * Hold a range against LRU eviction until {@link unpinRange}.
4711
+ *
4712
+ * @param address Absolute start of the range.
4713
+ * @param length Length of the range.
4714
+ */
4715
+ pinRange(address, length) {
4716
+ for (const chunkIndex of this.chunkSpan_(address, length)) {
4717
+ this.addPin_(chunkIndex, 1);
4718
+ }
4719
+ }
4720
+ /**
4721
+ * Drop one {@link pinRange} hold.
4722
+ *
4723
+ * @param address Absolute start of the range.
4724
+ * @param length Length of the range.
4725
+ */
4726
+ unpinRange(address, length) {
4727
+ for (const chunkIndex of this.chunkSpan_(address, length)) {
4728
+ this.addPin_(chunkIndex, -1);
4729
+ }
4730
+ }
4731
+ /**
4732
+ * Chunk indices covering `[address, address + length)`.
4733
+ *
4734
+ * @param address Absolute start.
4735
+ * @param length Length in bytes.
4736
+ * @return {number[]} Inclusive chunk indices.
4737
+ */
4738
+ chunkSpan_(address, length) {
4739
+ const chunkBytes = this.chunkBytes_;
4740
+ const firstChunk = Math.floor(address / chunkBytes);
4741
+ const lastChunk = Math.floor((address + Math.max(length, 1) - 1) / chunkBytes);
4742
+ const span = [];
4743
+ for (let chunkIndex = firstChunk; chunkIndex <= lastChunk; ++chunkIndex) {
4744
+ span.push(chunkIndex);
4745
+ }
4746
+ return span;
4747
+ }
4748
+ /**
4749
+ * Adjust a chunk's pin count, deleting the entry at zero.
4750
+ *
4751
+ * @param chunkIndex The chunk.
4752
+ * @param delta +1 pin or -1 unpin.
4753
+ */
4754
+ addPin_(chunkIndex, delta) {
4755
+ const pins = (this.ensurePins_.get(chunkIndex) ?? 0) + delta;
4756
+ if (pins <= 0) {
4757
+ this.ensurePins_.delete(chunkIndex);
4758
+ } else {
4759
+ this.ensurePins_.set(chunkIndex, pins);
4760
+ }
4761
+ }
4633
4762
  };
4634
4763
 
4635
4764
  // compiled/src/step/parsing/step_vtable_builder.js
@@ -4699,7 +4828,7 @@ var StepVtableBuilder = class {
4699
4828
  var OPEN_PAREN3 = parsing_constants_default.OPEN_PAREN;
4700
4829
  var CLOSE_PAREN3 = parsing_constants_default.CLOSE_PAREN;
4701
4830
  var COMMA3 = parsing_constants_default.COMMA;
4702
- var ZERO5 = parsing_constants_default.ZERO;
4831
+ var ZERO6 = parsing_constants_default.ZERO;
4703
4832
  var WHITESPACE4 = parsing_constants_default.WHITE_SPACE_SET;
4704
4833
  function extractIntegerArrayAt(buffer, cursor, endCursor, sink) {
4705
4834
  const marked = sink.length;
@@ -4768,7 +4897,7 @@ function extractUnsignedIntegerListAt(buffer, cursor, endCursor, sink) {
4768
4897
  return void 0;
4769
4898
  }
4770
4899
  }
4771
- const digit = buffer[cursor] - ZERO5;
4900
+ const digit = buffer[cursor] - ZERO6;
4772
4901
  if (digit < 0 || digit > 9) {
4773
4902
  sink.truncate(marked);
4774
4903
  return void 0;
@@ -4776,7 +4905,7 @@ function extractUnsignedIntegerListAt(buffer, cursor, endCursor, sink) {
4776
4905
  let value = digit;
4777
4906
  ++cursor;
4778
4907
  while (cursor < endCursor) {
4779
- const next = buffer[cursor] - ZERO5;
4908
+ const next = buffer[cursor] - ZERO6;
4780
4909
  if (next < 0 || next > 9) {
4781
4910
  break;
4782
4911
  }
@@ -5571,6 +5700,141 @@ var StepModelBase = class {
5571
5700
  }
5572
5701
  await this.ensureResidentByLocalID(localID);
5573
5702
  }
5703
+ /**
5704
+ * Page in the byte ranges a record *and every `#ref` reachable from
5705
+ * its text* will need, so a following synchronous extract of that
5706
+ * subgraph succeeds on a windowed source. Inverse relationships
5707
+ * (not written in the record) are not discovered — callers that
5708
+ * need them (rel-voids, styled items) pass their local IDs as
5709
+ * `extraLocalIDs`.
5710
+ *
5711
+ * No-op while the source is fully resident.
5712
+ *
5713
+ * @param localID Seed record.
5714
+ * @param extraLocalIDs Additional seeds (voids, styles, materials).
5715
+ * @param seen Optional set to extend (also skips already-pinned IDs).
5716
+ * @return {Promise<Set<number>>} The local IDs that were visited.
5717
+ */
5718
+ async ensureResidentClosureByLocalID(localID, extraLocalIDs, seen = /* @__PURE__ */ new Set()) {
5719
+ if (!this.isSourceExternal) {
5720
+ return seen;
5721
+ }
5722
+ const stack = [localID];
5723
+ if (extraLocalIDs !== void 0) {
5724
+ for (const extra of extraLocalIDs) {
5725
+ stack.push(extra);
5726
+ }
5727
+ }
5728
+ while (stack.length > 0) {
5729
+ const id = stack.pop();
5730
+ if (seen.has(id) || id >= this.count_) {
5731
+ continue;
5732
+ }
5733
+ seen.add(id);
5734
+ await this.ensureResidentByLocalID(id);
5735
+ this.pinByLocalID(id);
5736
+ for (const expressID of this.scanRecordRefs_(id)) {
5737
+ const referenced = this.expressIDMap_.get(expressID);
5738
+ if (referenced !== void 0 && !seen.has(referenced)) {
5739
+ stack.push(referenced);
5740
+ }
5741
+ }
5742
+ }
5743
+ return seen;
5744
+ }
5745
+ /**
5746
+ * Hold a record's source range against windowed LRU eviction until
5747
+ * {@link unpinByLocalID}. No-op while the source is fully resident.
5748
+ *
5749
+ * @param localID The record to pin.
5750
+ */
5751
+ pinByLocalID(localID) {
5752
+ if (!this.isSourceExternal || localID >= this.count_) {
5753
+ return;
5754
+ }
5755
+ this.bufferProvider_.pinRange?.(this.address_[localID], this.length_[localID]);
5756
+ }
5757
+ /**
5758
+ * Drop one {@link pinByLocalID} hold.
5759
+ *
5760
+ * @param localID The record to unpin.
5761
+ */
5762
+ unpinByLocalID(localID) {
5763
+ if (!this.isSourceExternal || localID >= this.count_) {
5764
+ return;
5765
+ }
5766
+ this.bufferProvider_.unpinRange?.(this.address_[localID], this.length_[localID]);
5767
+ }
5768
+ /**
5769
+ * Unpin every local ID in `localIDs` (best-effort; missing IDs are
5770
+ * ignored). Use after {@link ensureResidentClosureByLocalID}, which
5771
+ * pins as it walks.
5772
+ *
5773
+ * @param localIDs The records to unpin.
5774
+ */
5775
+ unpinLocalIDs(localIDs) {
5776
+ for (const localID of localIDs) {
5777
+ this.unpinByLocalID(localID);
5778
+ }
5779
+ }
5780
+ /**
5781
+ * Express-ID twin of {@link ensureResidentClosureByLocalID}. Unknown
5782
+ * IDs resolve to an empty visit set.
5783
+ *
5784
+ * @param expressID Seed record.
5785
+ * @param extraLocalIDs Additional seeds (local IDs).
5786
+ * @return {Promise<Set<number>>} The local IDs that were visited.
5787
+ */
5788
+ async ensureResidentClosureByExpressID(expressID, extraLocalIDs, seen) {
5789
+ if (!this.isSourceExternal) {
5790
+ return seen ?? /* @__PURE__ */ new Set();
5791
+ }
5792
+ const localID = this.expressIDMap_.get(expressID);
5793
+ if (localID === void 0) {
5794
+ return seen ?? /* @__PURE__ */ new Set();
5795
+ }
5796
+ return this.ensureResidentClosureByLocalID(localID, extraLocalIDs, seen);
5797
+ }
5798
+ /**
5799
+ * Express IDs referenced by a resident record (`#<id>` tokens in its
5800
+ * text, including multi-mapped class records). The record itself
5801
+ * must already be resident.
5802
+ *
5803
+ * @param localID The record to scan.
5804
+ * @return {number[]} Distinct referenced express IDs.
5805
+ */
5806
+ referencedExpressIDs(localID) {
5807
+ return this.scanRecordRefs_(localID);
5808
+ }
5809
+ /**
5810
+ * Scan a resident record's bytes for `#<expressID>` references.
5811
+ *
5812
+ * @param localID The record to scan.
5813
+ * @return {number[]} Distinct referenced express IDs.
5814
+ */
5815
+ scanRecordRefs_(localID) {
5816
+ const address = this.address_[localID];
5817
+ const length = this.length_[localID];
5818
+ const acquisition = this.bufferProvider_.acquire(address, length);
5819
+ const viewStart = address - acquisition.offset;
5820
+ const refs = scanExpressRefs(acquisition.buffer, viewStart, length);
5821
+ const complex = this.complexEntries_?.get(localID);
5822
+ if (complex?.multiMapping === void 0) {
5823
+ return refs;
5824
+ }
5825
+ const seen = new Set(refs);
5826
+ for (const mapped of complex.multiMapping) {
5827
+ const mappedAcquisition = this.bufferProvider_.acquire(mapped.address, mapped.length);
5828
+ const mappedStart = mapped.address - mappedAcquisition.offset;
5829
+ for (const expressID of scanExpressRefs(mappedAcquisition.buffer, mappedStart, mapped.length)) {
5830
+ if (!seen.has(expressID)) {
5831
+ seen.add(expressID);
5832
+ refs.push(expressID);
5833
+ }
5834
+ }
5835
+ }
5836
+ return refs;
5837
+ }
5574
5838
  /**
5575
5839
  * Get the number of elements/entities in this model.
5576
5840
  *
@@ -10727,6 +10991,38 @@ var StepEntityBase = class {
10727
10991
  }
10728
10992
  return value;
10729
10993
  }
10994
+ /**
10995
+ * Resolve a single reference field to its local ID without
10996
+ * constructing the target entity. Prep maps that only store
10997
+ * `Item.localID` (IfcStyledItem → faceset) must not hydrate the
10998
+ * target: on a windowed source that would pin the faceset record
10999
+ * (often megabytes) for every styled item at once.
11000
+ *
11001
+ * @param offset The offset in the vtable to extract from.
11002
+ * @param baseOffset The base offset of the class in the vtable.
11003
+ * @param depth The depth in the inheritance hierarchy.
11004
+ * @param optional Is this an optional field?
11005
+ * @return {number | null} The referenced local ID, or null if the
11006
+ * field is unset/optional-null.
11007
+ */
11008
+ extractReferenceLocalID(offset, baseOffset, depth, optional) {
11009
+ const [cursor, endCursor, buffer] = this.getOffsetAndEndCursor(offset, baseOffset, depth);
11010
+ const expressID = stepExtractReference(buffer, cursor, endCursor);
11011
+ if (expressID !== void 0) {
11012
+ return this.model.resolveExpressID(expressID) ?? null;
11013
+ }
11014
+ const inline = this.model.getInlineElementByAddress(extractInlineElementAddress(buffer, cursor, endCursor));
11015
+ if (inline !== void 0) {
11016
+ return inline.localID;
11017
+ }
11018
+ if (!optional) {
11019
+ throw new Error("Value in STEP was incorrectly typed");
11020
+ }
11021
+ if (!this.model.nullOnErrors && stepExtractOptional(buffer, cursor, endCursor) !== null) {
11022
+ throw new Error("Value in STEP was incorrectly typed");
11023
+ }
11024
+ return null;
11025
+ }
10730
11026
  /**
10731
11027
  *
10732
11028
  * @param buffer
@@ -71436,11 +71732,88 @@ function buildIndexStreaming(source, parser211, pool3, onRecordIndexed, sink) {
71436
71732
  }
71437
71733
  }
71438
71734
  var MIN_WINDOW = 4 * 1024;
71735
+ async function readSource(source, offset, length, into, intoOffset) {
71736
+ return await source.read(offset, length, into, intoOffset);
71737
+ }
71738
+ async function buildIndexStreamingAsync(source, parser211, pool3, onRecordIndexed, sink, onProgress, yieldIntervalMs) {
71739
+ const fileSize = source.byteLength;
71740
+ let windowBytes = Math.max(pool3, MIN_WINDOW);
71741
+ for (; ; ) {
71742
+ const window2 = new Uint8Array(windowBytes);
71743
+ let windowStartFile = 0;
71744
+ let windowLen = await readSource(source, 0, windowBytes, window2, 0);
71745
+ let bytesRead = windowLen;
71746
+ const input = new ParsingBuffer(window2, 0, windowLen);
71747
+ const [header, headerResult] = parser211.parseHeader(input);
71748
+ if (headerResult !== ParseResult.COMPLETE) {
71749
+ return {
71750
+ header,
71751
+ elements: [],
71752
+ result: headerResult,
71753
+ stats: { pool: pool3, windowBytes, slides: 0, maxRecordLen: 0, bytesRead }
71754
+ };
71755
+ }
71756
+ const slideThreshold = windowBytes >> 1;
71757
+ let slides = 0;
71758
+ let maxRecordLen = 0;
71759
+ let prevBoundaryFile = windowStartFile + input.cursor;
71760
+ const onRecordBoundary = (buffer) => {
71761
+ const cursor = buffer.cursor;
71762
+ const recordFileStart = windowStartFile + cursor;
71763
+ const recordLen = recordFileStart - prevBoundaryFile;
71764
+ if (recordLen > maxRecordLen) {
71765
+ maxRecordLen = recordLen;
71766
+ }
71767
+ prevBoundaryFile = recordFileStart;
71768
+ if (windowStartFile + windowLen >= fileSize) {
71769
+ return;
71770
+ }
71771
+ if (cursor < slideThreshold) {
71772
+ return;
71773
+ }
71774
+ const tail = windowLen - cursor;
71775
+ window2.copyWithin(0, cursor, windowLen);
71776
+ const want = windowBytes - tail;
71777
+ const fillAt = windowStartFile + windowLen;
71778
+ return readSource(source, fillAt, want, window2, tail).then((got) => {
71779
+ bytesRead += got;
71780
+ windowLen = tail + got;
71781
+ windowStartFile = recordFileStart;
71782
+ buffer.rebaseWindow(window2, 0, windowLen, windowStartFile);
71783
+ ++slides;
71784
+ });
71785
+ };
71786
+ const progressTick = onProgress !== void 0 ? (cursor) => onProgress(windowStartFile + cursor) : void 0;
71787
+ const [index, result] = await parser211.parseDataBlockStreamedAsync(input, onRecordBoundary, onRecordIndexed, progressTick, sink, yieldIntervalMs);
71788
+ const stoppedShort = result !== ParseResult.COMPLETE;
71789
+ const notAtEof = windowStartFile + windowLen < fileSize;
71790
+ if (stoppedShort && notAtEof) {
71791
+ windowBytes *= 2;
71792
+ sink?.reset();
71793
+ continue;
71794
+ }
71795
+ const lastRecordLen = windowStartFile + input.cursor - prevBoundaryFile;
71796
+ if (lastRecordLen > maxRecordLen) {
71797
+ maxRecordLen = lastRecordLen;
71798
+ }
71799
+ return {
71800
+ header,
71801
+ elements: index.elements,
71802
+ result,
71803
+ stats: { pool: pool3, windowBytes, slides, maxRecordLen, bytesRead }
71804
+ };
71805
+ }
71806
+ }
71439
71807
  function buildColumnarIndexStreaming(source, parser211, pool3, onRecordIndexed) {
71440
71808
  const sink = new ColumnarIndexSink();
71441
71809
  const { header, result, stats } = buildIndexStreaming(source, parser211, pool3, onRecordIndexed, sink);
71442
71810
  return { header, columns: sink.finalize(), result, stats };
71443
71811
  }
71812
+ async function buildColumnarIndexStreamingAsync(source, parser211, pool3, onRecordIndexed, onProgress, yieldIntervalMs) {
71813
+ const sink = new ColumnarIndexSink();
71814
+ const { header, result, stats } = await buildIndexStreamingAsync(source, parser211, pool3, onRecordIndexed, sink, onProgress, yieldIntervalMs);
71815
+ return { header, columns: sink.finalize(), result, stats };
71816
+ }
71444
71817
 
71445
71818
  // compiled/src/ifc/ifc_step_parser.js
71446
71819
  var DEFAULT_STREAM_POOL_BYTES = 1024 * 1024;
@@ -71510,6 +71883,27 @@ var IfcStepParser = class extends StepParser {
71510
71883
  const provider = new WindowedStepBufferProvider(store, opts?.chunkBytes, opts?.maxResidentChunks);
71511
71884
  return [result, new IfcStepModel(void 0, columns, provider)];
71512
71885
  }
71886
+ /**
71887
+ * Cooperative twin of {@link parseStreamToModel}: the index build
71888
+ * yields to the event loop and can fill windows from an async
71889
+ * {@link ReadableByteSource} (an OPFS `File.slice()` store). The
71890
+ * model is still windowed — geometry extract must
71891
+ * `ensureResident` first.
71892
+ *
71893
+ * @param source Sync or async byte source feeding the parse.
71894
+ * @param store Async external store backing the windowed model.
71895
+ * @param opts Optional window sizing plus parse progress.
71896
+ * @return {Promise<[ParseResult, IfcStepModel | undefined]>} The
71897
+ * parse result and the windowed model.
71898
+ */
71899
+ async parseStreamToModelAsync(source, store, opts) {
71900
+ if (store.byteLength !== source.byteLength) {
71901
+ throw new Error(`Streaming store byteLength ${store.byteLength} does not match source byteLength ${source.byteLength}`);
71902
+ }
71903
+ const { columns, result } = await buildColumnarIndexStreamingAsync(source, this, opts?.pool ?? DEFAULT_STREAM_POOL_BYTES, void 0, opts?.onProgress);
71904
+ const provider = new WindowedStepBufferProvider(store, opts?.chunkBytes, opts?.maxResidentChunks);
71905
+ return [result, new IfcStepModel(void 0, columns, provider)];
71906
+ }
71513
71907
  };
71514
71908
  IfcStepParser.Instance = new IfcStepParser();
71515
71909
  var ifc_step_parser_default = IfcStepParser;
@@ -200,6 +200,23 @@ export declare class IfcAPI {
200
200
  * @return {Promise<number>} model ID
201
201
  */
202
202
  OpenModelStreamed(data: Uint8Array, settings?: Loadersettings): Promise<number>;
203
+ /**
204
+ * M1b store-backed open (conway extension; feature-detect with
205
+ * `typeof api.OpenModelStream === 'function'`). Parses through a
206
+ * moving window over `store` and keeps the model windowed from
207
+ * birth — the source is never one JS `ArrayBuffer`. Geometry
208
+ * extract on the deferred path must use
209
+ * {@link ExtractGeometryBatchAsync} so product closures can be
210
+ * paged in.
211
+ *
212
+ * IFC only; other formats return -1 (caller should fall back to
213
+ * buffering + OpenModelStreamed).
214
+ *
215
+ * @param store External store holding the source bytes (OPFS File).
216
+ * @param settings settings for loading the model
217
+ * @return {Promise<number>} model ID, or -1 on failure
218
+ */
219
+ OpenModelStream(store: StepExternalByteStore, settings?: Loadersettings): Promise<number>;
203
220
  /**
204
221
  * Set conway's console-echo log threshold, web-ifc compatible surface
205
222
  * (numeric LogLevel enum). Embedders (e.g. Share) use this to quiet a
@@ -403,6 +420,22 @@ export declare class IfcAPI {
403
420
  extracted: number;
404
421
  remaining: number;
405
422
  };
423
+ /**
424
+ * Async twin of {@link ExtractGeometryBatch}: pages each product's
425
+ * source-byte closure before extracting it. Required for models
426
+ * opened with {@link OpenModelStream}; a no-op-prefetch on a
427
+ * resident-source deferred open. Feature-detect with
428
+ * `typeof api.ExtractGeometryBatchAsync === 'function'`.
429
+ *
430
+ * @param modelID handle retrieved by OpenModelStream / OpenModelStreamed
431
+ * @param batchSize max products to extract this call
432
+ * @param meshCallback receives each newly-extracted product's mesh
433
+ * @return {Promise<object>} `{extracted, remaining}`
434
+ */
435
+ ExtractGeometryBatchAsync(modelID: number, batchSize: number, meshCallback?: (mesh: FlatMesh) => void): Promise<{
436
+ extracted: number;
437
+ remaining: number;
438
+ }>;
406
439
  /**
407
440
  * Conway extension: free a model's native geometry once the consumer
408
441
  * has built its own scene from the meshes — every canonical mesh the
@@ -1 +1 @@
1
- {"version":3,"file":"ifc_api.d.ts","sourceRoot":"","sources":["../../../../src/compat/web-ifc/ifc_api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,IAAI,mBAAmB,EAEjE,MAAM,aAAa,CAAA;AAGrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAA;AAEnD,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAA;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAA;AACvE,OAAO,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAEpE,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AACzC,OAAO,K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D;;;;OAIG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,UAAQ;IAM1C,sDAAsD;IACtD,gBAAgB,IAAI,MAAM;IAI1B,2FAA2F;IAC3F,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,GAAG;CAGpC"}
@@ -214,6 +214,31 @@ export class IfcAPI {
214
214
  this.models.set(modelIdResult, result);
215
215
  return modelIdResult;
216
216
  }
217
+ /**
218
+ * M1b store-backed open (conway extension; feature-detect with
219
+ * `typeof api.OpenModelStream === 'function'`). Parses through a
220
+ * moving window over `store` and keeps the model windowed from
221
+ * birth — the source is never one JS `ArrayBuffer`. Geometry
222
+ * extract on the deferred path must use
223
+ * {@link ExtractGeometryBatchAsync} so product closures can be
224
+ * paged in.
225
+ *
226
+ * IFC only; other formats return -1 (caller should fall back to
227
+ * buffering + OpenModelStreamed).
228
+ *
229
+ * @param store External store holding the source bytes (OPFS File).
230
+ * @param settings settings for loading the model
231
+ * @return {Promise<number>} model ID, or -1 on failure
232
+ */
233
+ async OpenModelStream(store, settings) {
234
+ const modelIdResult = this.globalModelIDCounter++;
235
+ const result = await IfcApiModelPassthroughFactory.fromStore(modelIdResult, store, this.wasmModule, settings);
236
+ if (result === void 0) {
237
+ return -1;
238
+ }
239
+ this.models.set(modelIdResult, result);
240
+ return modelIdResult;
241
+ }
217
242
  /**
218
243
  * Set conway's console-echo log threshold, web-ifc compatible surface
219
244
  * (numeric LogLevel enum). Embedders (e.g. Share) use this to quiet a
@@ -595,6 +620,28 @@ export class IfcAPI {
595
620
  }
596
621
  return result.extractGeometryBatch(batchSize, meshCallback);
597
622
  }
623
+ /**
624
+ * Async twin of {@link ExtractGeometryBatch}: pages each product's
625
+ * source-byte closure before extracting it. Required for models
626
+ * opened with {@link OpenModelStream}; a no-op-prefetch on a
627
+ * resident-source deferred open. Feature-detect with
628
+ * `typeof api.ExtractGeometryBatchAsync === 'function'`.
629
+ *
630
+ * @param modelID handle retrieved by OpenModelStream / OpenModelStreamed
631
+ * @param batchSize max products to extract this call
632
+ * @param meshCallback receives each newly-extracted product's mesh
633
+ * @return {Promise<object>} `{extracted, remaining}`
634
+ */
635
+ async ExtractGeometryBatchAsync(modelID, batchSize, meshCallback) {
636
+ const result = this.models.get(modelID);
637
+ if (result?.extractGeometryBatchAsync !== void 0) {
638
+ return result.extractGeometryBatchAsync(batchSize, meshCallback);
639
+ }
640
+ if (result?.extractGeometryBatch === void 0) {
641
+ return { extracted: 0, remaining: 0 };
642
+ }
643
+ return result.extractGeometryBatch(batchSize, meshCallback);
644
+ }
598
645
  /**
599
646
  * Conway extension: free a model's native geometry once the consumer
600
647
  * has built its own scene from the meshes — every canonical mesh the