@delali/narsil 0.3.1-next.156 → 0.3.1-next.157

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 (168) hide show
  1. package/dist/{analysis-change-5BQOQ4BF.mjs → analysis-change-CKEMM2MC.mjs} +9 -9
  2. package/dist/{react-native/chunks/analysis-change-entry-SCVWK6OU.mjs → analysis-change-entry-SEDMJ6MW.mjs} +1 -1
  3. package/dist/browser/{analysis-change-435CUEPZ.mjs → analysis-change-ZKGJFENM.mjs} +38 -29
  4. package/dist/{analysis-change-entry-TXX6JSMX.mjs → browser/analysis-change-entry-5BFUVMHJ.mjs} +1 -1
  5. package/dist/browser/{chunk-BHFQATSC.mjs → chunk-25MTVDYD.mjs} +1 -1
  6. package/dist/browser/{chunk-IZXVW2ZJ.mjs → chunk-3NLMB5CC.mjs} +2 -2
  7. package/dist/browser/{chunk-23XRXIBW.mjs → chunk-5YWB3E2W.mjs} +8 -1
  8. package/dist/browser/chunk-AI5UI46D.mjs +12 -0
  9. package/dist/browser/{chunk-2CFI5VVV.mjs → chunk-BLT4RHCJ.mjs} +2 -2
  10. package/dist/browser/{chunk-4NGKC4H4.mjs → chunk-C26SPCGQ.mjs} +7 -6
  11. package/dist/browser/{chunk-6LWDPLTB.mjs → chunk-C4FJ3WDY.mjs} +1 -1
  12. package/dist/browser/{chunk-MGI4BCXC.mjs → chunk-CXNTHHA7.mjs} +2 -2
  13. package/dist/browser/{chunk-STOWQFT3.mjs → chunk-DUH6QUVU.mjs} +547 -2
  14. package/dist/browser/chunk-EKMGCRSR.mjs +61 -0
  15. package/dist/browser/{chunk-SSTPBZZX.mjs → chunk-GFAZPSWK.mjs} +5 -5
  16. package/dist/browser/{chunk-3SSRJMFN.mjs → chunk-HUCSHDTB.mjs} +1 -1
  17. package/dist/browser/{chunk-K4Q6KX3R.mjs → chunk-K3IPRX6D.mjs} +48 -17
  18. package/dist/browser/{chunk-MOG4OVDK.mjs → chunk-MY2XKH22.mjs} +1 -12
  19. package/dist/browser/{chunk-3V7DNNZL.mjs → chunk-N23GL72Q.mjs} +178 -801
  20. package/dist/browser/{chunk-NQAME3RK.mjs → chunk-UATIJ4KU.mjs} +2 -2
  21. package/dist/browser/{chunk-2TI4SSUP.mjs → chunk-UKOWD2K5.mjs} +3 -3
  22. package/dist/browser/{chunk-7U3WVJUP.mjs → chunk-UTMHUHUV.mjs} +2 -2
  23. package/dist/browser/{chunk-EA63E3D2.mjs → chunk-V43N6TZO.mjs} +5 -5
  24. package/dist/browser/{chunk-CRE3G7F3.mjs → chunk-VY5KW3HN.mjs} +3 -3
  25. package/dist/browser/{chunk-WI4MR75E.mjs → chunk-X7TXYUKO.mjs} +1 -1
  26. package/dist/browser/{chunk-KZWSX6BH.mjs → chunk-Y6IBAUNO.mjs} +2 -86
  27. package/dist/browser/{cold-module-2EHCIV4K.mjs → cold-module-YNUUDNOM.mjs} +12 -10
  28. package/dist/browser/{durability-wiring-A7BVG2DW.mjs → durability-wiring-GVZEE46O.mjs} +64 -21
  29. package/dist/browser/{engine-hooks-E4UD67JD.mjs → engine-hooks-HBVS6YM4.mjs} +5 -4
  30. package/dist/browser/{geo-index-HHWGMNIS.mjs → geo-index-OTV7VPIR.mjs} +2 -1
  31. package/dist/browser/{import-DXYB6756.mjs → import-5ESVMFDJ.mjs} +6 -5
  32. package/dist/browser/{module-NIYMEA5R.mjs → module-NDSQLPMQ.mjs} +11 -9
  33. package/dist/{release-BH3DKW3T.mjs → browser/release-HYXPVJVS.mjs} +0 -1
  34. package/dist/browser/{restore-hooks-YPN4ZFCY.mjs → restore-hooks-IE3GGYHG.mjs} +8 -7
  35. package/dist/browser/{restore-queue-G3RQGL3Y.mjs → restore-queue-LQBBTODR.mjs} +3 -3
  36. package/dist/browser/{retention-ZWVMNC3Q.mjs → retention-TY3L3BFN.mjs} +7 -6
  37. package/dist/browser/{snapshot-VEQNIE6C.mjs → snapshot-5FHPPCNZ.mjs} +16 -14
  38. package/dist/browser/{start-BM442C6R.mjs → start-2UZTOBG5.mjs} +8 -7
  39. package/dist/browser/{write-2EVMZWDE.mjs → write-ULXAN5B4.mjs} +10 -8
  40. package/dist/{capabilities-Da4ywVVl.d.ts → capabilities-D3AoBJoF.d.ts} +2 -2
  41. package/dist/{chunk-K5QFDYST.mjs → chunk-24FNVRKB.mjs} +1 -1
  42. package/dist/{chunk-DP5C7YFQ.mjs → chunk-2ROUFMQX.mjs} +2 -2
  43. package/dist/{chunk-PWC4VB3Q.mjs → chunk-4B7JIGQD.mjs} +2 -2
  44. package/dist/{chunk-FAKFUDZZ.mjs → chunk-4LMSZAK6.mjs} +14 -3
  45. package/dist/{chunk-6I6AYAXS.mjs → chunk-4ZTHGTVX.mjs} +2 -2
  46. package/dist/{chunk-QOW2JPUI.mjs → chunk-BNL5OPRV.mjs} +6 -6
  47. package/dist/{chunk-3HYC4JRF.mjs → chunk-C7XQYG6U.mjs} +2 -2
  48. package/dist/{chunk-WX4LAO6M.mjs → chunk-CQZXZ75V.mjs} +3 -97
  49. package/dist/{chunk-4KKXNJM6.mjs → chunk-CWS55TEX.mjs} +2 -2
  50. package/dist/{chunk-2UV4QBHW.mjs → chunk-EYD7K3H6.mjs} +5 -5
  51. package/dist/{chunk-EFBDHH5P.mjs → chunk-FEZVDOWX.mjs} +160 -245
  52. package/dist/{chunk-XAXKV65G.mjs → chunk-FUD5XSZ5.mjs} +1 -1
  53. package/dist/{chunk-JDJBQLRO.mjs → chunk-GPWMUPCA.mjs} +10 -10
  54. package/dist/{chunk-25KDNIZZ.mjs → chunk-IIRIG7H5.mjs} +1 -1
  55. package/dist/{chunk-TZTRKM33.mjs → chunk-JSV6OQ4C.mjs} +1 -1
  56. package/dist/{chunk-NF4DT3IH.mjs → chunk-JTYPJF3T.mjs} +8 -1
  57. package/dist/chunk-KCQYFO4K.mjs +62 -0
  58. package/dist/{chunk-CSLGFPFQ.mjs → chunk-LDNCLRZU.mjs} +1 -1
  59. package/dist/{chunk-MQOJIO5B.mjs → chunk-MW6BR4QP.mjs} +2 -2
  60. package/dist/{react-native/chunks/chunk-MUWD2H2S.mjs → chunk-MWD5VPN7.mjs} +2 -2
  61. package/dist/{chunk-XXHN7J46.mjs → chunk-ODYKO5TO.mjs} +1 -1
  62. package/dist/{chunk-RDXO6JST.mjs → chunk-OG7UGJ6F.mjs} +2 -2
  63. package/dist/{chunk-FYOVBEMM.mjs → chunk-OQLD2BSW.mjs} +2 -2
  64. package/dist/{chunk-I53G4JAU.mjs → chunk-OYABFKTW.mjs} +2 -2
  65. package/dist/{chunk-TZ3355VS.mjs → chunk-P5LANSH6.mjs} +1 -1
  66. package/dist/{chunk-P5ZI2P2W.mjs → chunk-PIH5SJ4N.mjs} +3 -3
  67. package/dist/{chunk-HFPMMRQT.mjs → chunk-PSZI4O24.mjs} +51 -4
  68. package/dist/{chunk-L6V6BST3.mjs → chunk-PV2CG7EJ.mjs} +3 -552
  69. package/dist/{chunk-SA5LOGO3.mjs → chunk-PWGYQXML.mjs} +1 -1
  70. package/dist/{chunk-BWZ3P4MU.mjs → chunk-QLDABJZM.mjs} +3 -3
  71. package/dist/{chunk-JWRUUCWD.mjs → chunk-RCX4WNLC.mjs} +2 -2
  72. package/dist/{chunk-DWEPMFJE.mjs → chunk-RIHIVFIQ.mjs} +5 -5
  73. package/dist/{chunk-FNGAM5B7.mjs → chunk-RWURUDSP.mjs} +8 -8
  74. package/dist/{chunk-I2KPOLOZ.mjs → chunk-SMOOSIAW.mjs} +3 -3
  75. package/dist/{chunk-TGS5UXBE.mjs → chunk-SOI6LTHM.mjs} +3 -3
  76. package/dist/{chunk-YTWZVGCB.mjs → chunk-UD5HIS4U.mjs} +1 -1
  77. package/dist/{chunk-46KY2PJD.mjs → chunk-UJDJB3NE.mjs} +37 -29
  78. package/dist/{chunk-Z2KAFCRT.mjs → chunk-VSLSGASN.mjs} +2 -2
  79. package/dist/{chunk-VTTRFF2C.mjs → chunk-VZ2ONHEE.mjs} +9 -5
  80. package/dist/chunk-W5EB5XKI.mjs +741 -0
  81. package/dist/{chunk-7LXHHCXZ.mjs → chunk-W7OSSKH5.mjs} +46 -16
  82. package/dist/{chunk-ZKP7G7TV.mjs → chunk-XXJZMTZT.mjs} +1 -1
  83. package/dist/{chunk-FRBFVQFN.mjs → chunk-ZPZ3YGXV.mjs} +4 -4
  84. package/dist/{client-DRv7UVeY.d.ts → client-kqSMevVi.d.ts} +15 -3
  85. package/dist/client.d.ts +6 -6
  86. package/dist/client.mjs +4 -0
  87. package/dist/{cold-module-6MO2XJF2.mjs → cold-module-VOJXMNZB.mjs} +13 -12
  88. package/dist/{config-DMwffLKn.d.ts → config-B4v_Htpu.d.ts} +1 -1
  89. package/dist/{config-CoSig5Ox.d.ts → config-CTP01fns.d.ts} +1 -1
  90. package/dist/{direct-executor-FTMYY3TI.mjs → direct-executor-V5DRIECI.mjs} +5 -5
  91. package/dist/distribution.d.ts +4 -4
  92. package/dist/distribution.mjs +72 -64
  93. package/dist/{durability-wiring-VIF5MOSY.mjs → durability-wiring-3TD62MBI.mjs} +38 -30
  94. package/dist/{engine-CFxPYqEk.d.ts → engine-CkPn2PWE.d.ts} +1 -1
  95. package/dist/{engine-hooks-EGUGNZYE.mjs → engine-hooks-HA3SBOBR.mjs} +8 -8
  96. package/dist/{import-XKDPJQDP.mjs → import-GPKLTSKA.mjs} +8 -8
  97. package/dist/index.browser.mjs +4 -3
  98. package/dist/index.d.ts +4 -4
  99. package/dist/index.mjs +7 -7
  100. package/dist/index.react-native.mjs +3 -3
  101. package/dist/{long-query-thread-YA4IAYSY.mjs → long-query-thread-QDFQSJD6.mjs} +13 -13
  102. package/dist/{module-FQ4JWNQJ.mjs → module-JYHFTVPS.mjs} +12 -11
  103. package/dist/{paged-partition-archive-PXW5XAYU.mjs → paged-partition-archive-RLRGOXDX.mjs} +14 -14
  104. package/dist/partial-words.mjs +3 -3
  105. package/dist/persistence/durability/checkpoint-worker.mjs +13 -12
  106. package/dist/query-suggestions/merge-worker.mjs +9 -9
  107. package/dist/query-suggestions.browser.mjs +9 -8
  108. package/dist/query-suggestions.d.ts +1 -1
  109. package/dist/query-suggestions.mjs +17 -17
  110. package/dist/react-native/chunks/{analysis-change-LT5QBQ3H.mjs → analysis-change-QUVDNABS.mjs} +37 -29
  111. package/dist/{browser/analysis-change-entry-HZXKPPGV.mjs → react-native/chunks/analysis-change-entry-OC4XASBF.mjs} +1 -1
  112. package/dist/react-native/chunks/{chunk-KV46CT4D.mjs → chunk-4AV5PPH6.mjs} +2 -2
  113. package/dist/react-native/chunks/{chunk-GXX3DQXP.mjs → chunk-4COWCEY7.mjs} +188 -163
  114. package/dist/react-native/chunks/{chunk-G43IPIDG.mjs → chunk-4NWR3NGS.mjs} +2 -2
  115. package/dist/react-native/chunks/{chunk-3JWDECAZ.mjs → chunk-5MSX5FRT.mjs} +5 -5
  116. package/dist/react-native/chunks/{chunk-6WA3C3DV.mjs → chunk-6OFDUYVX.mjs} +8 -1
  117. package/dist/react-native/chunks/{chunk-NB3LP33V.mjs → chunk-6ZELFCK5.mjs} +2 -2
  118. package/dist/react-native/chunks/{chunk-4JYO3JD2.mjs → chunk-BITYFZSZ.mjs} +2 -2
  119. package/dist/react-native/chunks/{chunk-ZXZFN7FI.mjs → chunk-DMIFXZ3Q.mjs} +1 -1
  120. package/dist/{chunk-KF4EXSM4.mjs → react-native/chunks/chunk-IAENKE2D.mjs} +2 -2
  121. package/dist/react-native/chunks/{chunk-ZLWVW734.mjs → chunk-KSBYEMCB.mjs} +1 -1
  122. package/dist/react-native/chunks/chunk-KU646XXT.mjs +164 -0
  123. package/dist/react-native/chunks/{chunk-MIP4SOR6.mjs → chunk-OCSLSH27.mjs} +164 -244
  124. package/dist/react-native/chunks/chunk-OXM66LO6.mjs +62 -0
  125. package/dist/react-native/chunks/{chunk-VWUDIOT6.mjs → chunk-TORU2OHQ.mjs} +1 -1
  126. package/dist/react-native/chunks/{chunk-PDRWWPKV.mjs → chunk-WVWJNUMN.mjs} +48 -18
  127. package/dist/react-native/chunks/{chunk-UQ4OAXKU.mjs → chunk-WW2X2AEI.mjs} +4 -4
  128. package/dist/react-native/chunks/{chunk-QUKQNI3H.mjs → chunk-ZNZ6CPAZ.mjs} +2 -87
  129. package/dist/react-native/chunks/{chunk-TP6KCKER.mjs → chunk-ZVQMBF2H.mjs} +2 -2
  130. package/dist/react-native/chunks/{chunk-POPDAGH6.mjs → chunk-ZWAIN4GG.mjs} +6 -6
  131. package/dist/react-native/chunks/{cold-module-KVZYUGRY.mjs → cold-module-N6KFNNZA.mjs} +9 -8
  132. package/dist/react-native/chunks/{durability-wiring-34OYO32E.mjs → durability-wiring-RN64S2TL.mjs} +63 -21
  133. package/dist/react-native/chunks/{engine-hooks-M7JV46NH.mjs → engine-hooks-CWA5CKCA.mjs} +4 -4
  134. package/dist/react-native/chunks/{import-H6AQREWI.mjs → import-5UAWBRJP.mjs} +4 -4
  135. package/dist/react-native/chunks/{module-LBZPGOWH.mjs → module-6RP4ZCBW.mjs} +8 -7
  136. package/dist/react-native/chunks/{release-D7ZTIANM.mjs → release-2SIHZWDO.mjs} +0 -1
  137. package/dist/react-native/chunks/{restore-hooks-IBGIY3DR.mjs → restore-hooks-ENFMDTWC.mjs} +7 -7
  138. package/dist/react-native/chunks/{restore-queue-ZZX54AH7.mjs → restore-queue-4R6AASE5.mjs} +3 -3
  139. package/dist/react-native/chunks/{retention-EW4TTDFB.mjs → retention-5GTFT3GR.mjs} +6 -6
  140. package/dist/react-native/chunks/{snapshot-REYVIN3X.mjs → snapshot-5LGPQXFS.mjs} +15 -14
  141. package/dist/react-native/chunks/{start-BQK6KN3R.mjs → start-ZQJVZ5DN.mjs} +7 -7
  142. package/dist/react-native/chunks/{write-FQAYCZF5.mjs → write-6BRYIIZ7.mjs} +7 -6
  143. package/dist/react-native/partial-words.mjs +2 -2
  144. package/dist/react-native/query-suggestions.mjs +8 -8
  145. package/dist/react-native/sync.mjs +44 -10
  146. package/dist/react.d.ts +7 -7
  147. package/dist/{browser/release-76MXRPGV.mjs → release-SMR4WJD4.mjs} +0 -1
  148. package/dist/{restore-hooks-CDERDEF4.mjs → restore-hooks-HXLIEB4A.mjs} +12 -12
  149. package/dist/{restore-queue-7NNSTROA.mjs → restore-queue-LZH7LMLR.mjs} +3 -3
  150. package/dist/{retention-QSVBBNRM.mjs → retention-3K7ARGAG.mjs} +12 -12
  151. package/dist/server.d.ts +10 -8
  152. package/dist/server.mjs +37 -29
  153. package/dist/{snapshot-RH4NSKIZ.mjs → snapshot-O7ICP7NJ.mjs} +24 -23
  154. package/dist/{start-MCKCOGIW.mjs → start-S4PFP6RS.mjs} +14 -14
  155. package/dist/sync/filesystem.d.ts +2 -2
  156. package/dist/sync/indexeddb.d.ts +2 -2
  157. package/dist/sync.browser.mjs +44 -10
  158. package/dist/sync.d.ts +3 -3
  159. package/dist/sync.mjs +44 -10
  160. package/dist/{tasks-qrJojgST.d.ts → tasks-CoNjxbop.d.ts} +2 -2
  161. package/dist/{thread-O4SBJJJS.mjs → thread-YLJ3ZPQ3.mjs} +12 -12
  162. package/dist/{types-BZCGjfLn.d.ts → types-DPMjfOr_.d.ts} +1 -1
  163. package/dist/workers/entry.mjs +5 -5
  164. package/dist/{write-3FK7NG3Y.mjs → write-2OBJGLFS.mjs} +11 -10
  165. package/openapi.json +71 -0
  166. package/package.json +7 -7
  167. package/dist/chunk-BU4SAIC4.mjs +0 -196
  168. package/dist/react-native/chunks/chunk-DNXOMPAQ.mjs +0 -191
@@ -1,19 +1,18 @@
1
- import { DEFAULT_BLOCK_WRITES_ABOVE, DEFAULT_RESUME_WRITES_BELOW, validateWorkerConfig, validateIndexName, validatePatternValueLimit, requireSurfaceFormsForPartialFields, validateBM25Params, validatePartitionConfig, executeQuery, lazyQueryBinding, executePreflight, executeSuggest, executeListDocuments, validateBatchList, ENGINE_MEMORY_FIGURES_MAX_AGE_MS, validateDocId, storedBM25Params, readEngineMemoryFigures, FULL_MEMORY_COLLECTION_INTERVAL_MS } from './chunk-I53G4JAU.mjs';
1
+ import { DEFAULT_BLOCK_WRITES_ABOVE, DEFAULT_RESUME_WRITES_BELOW, validateWorkerConfig, validateIndexName, validatePatternValueLimit, requireSurfaceFormsForPartialFields, validateBM25Params, validatePartitionConfig, executeQuery, lazyQueryBinding, executePreflight, executeSuggest, executeListDocuments, validateBatchList, ENGINE_MEMORY_FIGURES_MAX_AGE_MS, validateDocId, storedBM25Params, readEngineMemoryFigures, FULL_MEMORY_COLLECTION_INTERVAL_MS } from './chunk-OYABFKTW.mjs';
2
2
  import { DEFAULT_MAX_RERANK_WINDOW, DEFAULT_RERANK_TIMEOUT_MS } from './chunk-HJSN7UYG.mjs';
3
3
  import { detectRuntime, resolveWorkerEntry, missingWorkerEntry, workerResourceLimits } from './chunk-LHKOSI2J.mjs';
4
4
  import { collectYoungGenerationBeforeRefusal, collectGarbageBeforeRefusal } from './chunk-XIHUI4KB.mjs';
5
5
  import { splitWorkerBudget, resolveWorkerCount, resolveRequestThreadCount, DEFAULT_REQUEST_TIMEOUT_MS, DEFAULT_BACKPRESSURE_LIMIT, SHUTDOWN_TIMEOUT_MS, CONSECUTIVE_TIMEOUTS_BEFORE_DEATH } from './chunk-3MXV3VHR.mjs';
6
6
  import { MAX_INDEX_CONFIGURATION_BYTES, BATCH_CHUNK_SIZE, MAX_SWEEP_INTERVAL_MS, MIN_SWEEP_INTERVAL_MS, STATISTICS_BROADCAST_INTERVAL_MS, HEAP_PRESSURE_WARNING_FRACTION, FOREIGN_STATS_TTL_MS, MIN_DOCUMENTS_FOR_SEGMENTS, HEAP_PRESSURE_REARM_FRACTION } from './chunk-EEBCDP36.mjs';
7
- import { resolvePartialWordAnalysis, resolvePartitionInsertOptions, isEmptySynonymSet, synonymModule, createDirectExecutor, generateId, createPartitionRouter, loadSchemaCodeFor, availableSynonymModule, mergeFrozenSegments, createSharedFrozenSegment, freezeSegmentShared, createFrozenSegment } from './chunk-VTTRFF2C.mjs';
8
- import { requirePatternSearchFor, requirePartialWordSearchFor, collectQueryTermStats, createPartitionIndex, mergePartitionStats, oversampledFacetConfig, availablePatternSearch, PATTERN_HOST, kWayMerge, mergeFacets, isCompositePartition, encodeSegmentState } from './chunk-P5ZI2P2W.mjs';
7
+ import { resolvePartialWordAnalysis, resolvePartitionInsertOptions, isEmptySynonymSet, synonymModule, createDirectExecutor, generateId, createPartitionRouter, loadSchemaCodeFor, availableSynonymModule, mergeFrozenSegments, createSharedFrozenSegment, freezeSegmentShared, createFrozenSegment } from './chunk-VZ2ONHEE.mjs';
8
+ import { requirePatternSearchFor, requirePartialWordSearchFor, collectQueryTermStats, createPartitionIndex, mergePartitionStats, oversampledFacetConfig, availablePatternSearch, PATTERN_HOST, kWayMerge, mergeFacets, isCompositePartition, encodeSegmentState } from './chunk-PIH5SJ4N.mjs';
9
9
  import { INDEX_CONFIGURATION_ENVELOPE_VERSION } from './chunk-GH4WQ22V.mjs';
10
10
  import { requireWithinFileLimit, HEADER_SIZE, payloadByteLength, checksumOfChunks, packEnvelopeWithEngineVersion } from './chunk-3OH67G7R.mjs';
11
11
  import { readHeapStatistics } from './chunk-IPN7S4KX.mjs';
12
12
  import { fnv1a } from './chunk-KAKQ74LS.mjs';
13
13
  import { countEngineThread } from './chunk-Q2UL2TPC.mjs';
14
14
  import { DEFAULT_PATTERN_WORK_CAP, MATCHER_STATE_BUDGET_BYTES } from './chunk-CITFCZKF.mjs';
15
- import { raiseEarlierReleaseGraphSetting, getNestedValue, messagePackUpperBoundBytes, validateVectorPromotion, validateVectorStorage, validateTextStorage, validateRequiredFields, requireDocumentWithinSizeLimit, validateDocument, validateDocumentStrict } from './chunk-L6V6BST3.mjs';
16
- import { flattenSchema, validateSchema, requireCreatableSchema, schemaFieldsOf, extractVectorFieldsFromSchema } from './chunk-BU4SAIC4.mjs';
15
+ import { flattenSchema, raiseEarlierReleaseGraphSetting, getNestedValue, messagePackUpperBoundBytes, validateSchema, requireCreatableSchema, validateVectorPromotion, validateVectorStorage, validateTextStorage, schemaFieldsOf, extractVectorFieldsFromSchema, validateRequiredFields, requireDocumentWithinSizeLimit, validateDocument, validateDocumentStrict } from './chunk-W5EB5XKI.mjs';
17
16
  import { isSingleStringFieldType } from './chunk-I54T6CQP.mjs';
18
17
  import { emitSyncChange, withOpenIndex, oneAtATime } from './chunk-Y4WPNHMC.mjs';
19
18
  import { getLanguage } from './chunk-RZWWB2XR.mjs';
@@ -615,7 +614,7 @@ var TEXT_REBUILD_SWITCH_BACKLOG_DOCUMENTS = 1e3;
615
614
  // src/partitioning/rewrite-spill-of.ts
616
615
  async function rewriteSpillOf(storage, manager, target) {
617
616
  if (storage === void 0 || (target?.config ?? manager.config).textStorage !== "disk") return null;
618
- const { openRewriteSpill } = await import('./module-FQ4JWNQJ.mjs');
617
+ const { openRewriteSpill } = await import('./module-JYHFTVPS.mjs');
619
618
  return openRewriteSpill(storage, manager, target);
620
619
  }
621
620
 
@@ -1074,7 +1073,7 @@ async function createIndexFromMetadata(deps, metadata, loadData) {
1074
1073
  const existing = deps.indexRegistry.get(metadata.indexName);
1075
1074
  if (existing !== void 0) {
1076
1075
  if ((metadata.analysisGeneration ?? 0) > existing.analysisGeneration) {
1077
- const { adoptSavedAnalysis } = await import('./analysis-change-5BQOQ4BF.mjs');
1076
+ const { adoptSavedAnalysis } = await import('./analysis-change-CKEMM2MC.mjs');
1078
1077
  adoptSavedAnalysis(deps.executor.getManager(metadata.indexName), existing, metadata);
1079
1078
  }
1080
1079
  if (loadData && deps.executor.getManager(metadata.indexName) === void 0) {
@@ -2313,16 +2312,16 @@ function documentWeight(action) {
2313
2312
  }
2314
2313
  return 1;
2315
2314
  }
2315
+ var NO_VECTOR_FIELDS = /* @__PURE__ */ new Set();
2316
2316
  function vectorFieldPathsOf(state, indexName) {
2317
- const entry = state.indexRegistry.get(indexName);
2318
- if (entry === void 0) return /* @__PURE__ */ new Set();
2319
- return new Set(extractVectorFieldsFromSchema(entry.config.schema).keys());
2317
+ return state.indexRegistry.get(indexName)?.vectorFieldPaths ?? NO_VECTOR_FIELDS;
2320
2318
  }
2321
2319
  function withoutVectors(document, fieldPaths) {
2320
+ if (fieldPaths.size === 0) return document;
2322
2321
  return prepareDocumentVectors(document, fieldPaths).partitionDoc;
2323
2322
  }
2324
2323
  function detachCallerDocuments(state, action) {
2325
- if (!("indexName" in action)) return action;
2324
+ if (action.type !== "insert" && action.type !== "update" && action.type !== "mergeSegments") return action;
2326
2325
  const fieldPaths = vectorFieldPathsOf(state, action.indexName);
2327
2326
  if (action.type === "insert") {
2328
2327
  const stripped = withoutVectors(action.document, fieldPaths);
@@ -2333,17 +2332,14 @@ function detachCallerDocuments(state, action) {
2333
2332
  const stripped = withoutVectors(action.document, fieldPaths);
2334
2333
  return { ...action, document: stripped !== action.document ? stripped : structuredClone(stripped) };
2335
2334
  }
2336
- if (action.type === "mergeSegments") {
2337
- return {
2338
- ...action,
2339
- segments: action.segments.map((segment) => {
2340
- const documents = segment.documents.map((document) => withoutVectors(document, fieldPaths));
2341
- const cloned = action.skipClone === true || fieldPaths.size > 0 ? documents : structuredClone(documents);
2342
- return { ...segment, documents: cloned };
2343
- })
2344
- };
2345
- }
2346
- return action;
2335
+ return {
2336
+ ...action,
2337
+ segments: action.segments.map((segment) => {
2338
+ const documents = segment.documents.map((document) => withoutVectors(document, fieldPaths));
2339
+ const cloned = action.skipClone === true || fieldPaths.size > 0 ? documents : structuredClone(documents);
2340
+ return { ...segment, documents: cloned };
2341
+ })
2342
+ };
2347
2343
  }
2348
2344
  function partitionLedger(state, indexName, partitionId) {
2349
2345
  let byPartition = state.segmentLedger.get(indexName);
@@ -2359,6 +2355,10 @@ function partitionLedger(state, indexName, partitionId) {
2359
2355
  return entries;
2360
2356
  }
2361
2357
  function recordSegmentBroadcast(state, action) {
2358
+ if (action.type === "clear") {
2359
+ state.segmentLedger.delete(action.indexName);
2360
+ return;
2361
+ }
2362
2362
  if (action.type === "attachSegments") {
2363
2363
  for (const segment of action.segments) {
2364
2364
  partitionLedger(state, action.indexName, segment.partitionId).push({
@@ -2442,19 +2442,9 @@ async function replicateToWorkers(state, action) {
2442
2442
  await dispatchToWorkers(state, action);
2443
2443
  return;
2444
2444
  }
2445
- if (!copiesWillReceive(state, action.indexName)) return;
2446
- const detached = detachCallerDocuments(state, action);
2447
- const loading = state.copyLoadBuffers.get(action.indexName);
2448
- if (loading !== void 0) {
2449
- queueForCopies(state, detached);
2450
- if (loading.length % LOAD_BUFFER_YIELD_INTERVAL === 0) await yieldToEventLoop();
2451
- return;
2452
- }
2453
- const queue = state.replicationQueues.get(action.indexName);
2454
- if (queue !== void 0 && queue.pendingDocuments + documentWeight(detached) > MAX_PENDING_REPLICATION_DOCUMENTS) {
2455
- await new Promise((resume) => queue.drainWaiters.push(resume));
2456
- }
2457
- queueForCopies(state, detached);
2445
+ recordMainWrite(state, action);
2446
+ const waiting = replicationRoomWait(state, action.indexName);
2447
+ if (waiting !== null) await waiting;
2458
2448
  }
2459
2449
  function queueForCopies(state, action) {
2460
2450
  if (!("indexName" in action)) return;
@@ -2466,6 +2456,22 @@ function queueForCopies(state, action) {
2466
2456
  if (state.workerPool === null || !state.scaledOutIndexes.has(action.indexName)) return;
2467
2457
  enqueueReplication(state, action.indexName, action);
2468
2458
  }
2459
+ function recordMainWrite(state, action) {
2460
+ if (!("indexName" in action) || !copiesWillReceive(state, action.indexName)) return;
2461
+ queueForCopies(state, detachCallerDocuments(state, action));
2462
+ }
2463
+ function replicationRoomWait(state, indexName) {
2464
+ const loading = state.copyLoadBuffers.get(indexName);
2465
+ if (loading !== void 0) {
2466
+ const lastYield = state.copyLoadBufferYieldMarks.get(loading) ?? 0;
2467
+ if (loading.length - lastYield < LOAD_BUFFER_YIELD_INTERVAL) return null;
2468
+ state.copyLoadBufferYieldMarks.set(loading, loading.length);
2469
+ return yieldToEventLoop();
2470
+ }
2471
+ const queue = state.replicationQueues.get(indexName);
2472
+ if (queue === void 0 || queue.pendingDocuments < MAX_PENDING_REPLICATION_DOCUMENTS) return null;
2473
+ return new Promise((resume) => queue.drainWaiters.push(resume));
2474
+ }
2469
2475
  function settled(queue) {
2470
2476
  return Promise.all([...queue.inFlight, queue.tail]).then(() => void 0);
2471
2477
  }
@@ -2542,6 +2548,7 @@ function freezeLiveTail(state, indexName, manager, partitionId, floor) {
2542
2548
  }
2543
2549
  }
2544
2550
  function flushGrownTails(state, indexName) {
2551
+ if (!state.scaledOutIndexes.has(indexName)) return;
2545
2552
  const manager = state.executor.getManager(indexName);
2546
2553
  if (manager === void 0) return;
2547
2554
  for (let partitionId = 0; partitionId < manager.partitionCount; partitionId++) {
@@ -2564,25 +2571,10 @@ function mainCompositeOf(manager, partitionId) {
2564
2571
  const partition = manager.getPartition(partitionId);
2565
2572
  return isCompositePartition(partition) ? partition : null;
2566
2573
  }
2567
- function holdUnbroadcastSegments(state, indexName, segmentIds) {
2568
- let held = state.unbroadcastSegments.get(indexName);
2569
- if (held === void 0) {
2570
- held = /* @__PURE__ */ new Set();
2571
- state.unbroadcastSegments.set(indexName, held);
2572
- }
2573
- for (const segmentId of segmentIds) held.add(segmentId);
2574
- }
2575
- function releaseUnbroadcastSegments(state, indexName, segmentIds) {
2576
- const held = state.unbroadcastSegments.get(indexName);
2577
- if (held === void 0) return;
2578
- for (const segmentId of segmentIds) held.delete(segmentId);
2579
- if (held.size === 0) state.unbroadcastSegments.delete(indexName);
2580
- }
2581
2574
  function candidateSegmentIds(state, indexName, manager, partitionId, policy) {
2582
- const unbroadcast = state.unbroadcastSegments.get(indexName);
2583
2575
  const composite = mainCompositeOf(manager, partitionId);
2584
2576
  if (composite !== null) {
2585
- const sizes = composite.frozenSegmentSizes().filter((size) => unbroadcast === void 0 || !unbroadcast.has(size.segmentId)).map((size) => ({ segmentId: size.segmentId, documentCount: size.liveDocumentCount }));
2577
+ const sizes = composite.frozenSegmentSizes().map((size) => ({ segmentId: size.segmentId, documentCount: size.liveDocumentCount }));
2586
2578
  const picks = pickSegmentIds(sizes, policy);
2587
2579
  if (picks !== null) return picks;
2588
2580
  }
@@ -2616,6 +2608,17 @@ async function compactOnWorker(state, indexName, partitionId, segmentIds) {
2616
2608
  lease.release();
2617
2609
  }
2618
2610
  }
2611
+ function ledgerHoldsAll(state, indexName, partitionId, segmentIds) {
2612
+ const entries = state.segmentLedger.get(indexName)?.get(partitionId);
2613
+ if (entries === void 0) return false;
2614
+ const held = new Set(entries.map((entry) => entry.segmentId));
2615
+ return segmentIds.every((segmentId) => held.has(segmentId));
2616
+ }
2617
+ function segmentsStillHeld(state, indexName, manager, partitionId, segmentIds, mergedOnMain) {
2618
+ if (state.executor.getManager(indexName) !== manager) return false;
2619
+ if (mergedOnMain === null) return ledgerHoldsAll(state, indexName, partitionId, segmentIds);
2620
+ return mainCompositeOf(manager, partitionId) === mergedOnMain && mainHoldsAll(mergedOnMain, segmentIds);
2621
+ }
2619
2622
  function forgetLedgerSegments(state, indexName, partitionId, segmentIds) {
2620
2623
  const entries = state.segmentLedger.get(indexName)?.get(partitionId);
2621
2624
  if (entries === void 0) return;
@@ -2641,8 +2644,10 @@ async function compactPartitionSegments(state, indexName, manager, partitionId,
2641
2644
  if (!mainCanMerge) forgetLedgerSegments(state, indexName, partitionId, segmentIds);
2642
2645
  return false;
2643
2646
  }
2644
- const removedSpellings = mainCanMerge && composite !== null ? composite.swapFrozenSegments(segmentIds, createSharedFrozenSegment(snapshot)) : void 0;
2645
- await replicateToWorkers(state, {
2647
+ const mergedOnMain = mainCanMerge ? composite : null;
2648
+ if (!segmentsStillHeld(state, indexName, manager, partitionId, segmentIds, mergedOnMain)) return false;
2649
+ const removedSpellings = mergedOnMain?.swapFrozenSegments(segmentIds, createSharedFrozenSegment(snapshot));
2650
+ recordMainWrite(state, {
2646
2651
  type: "swapSegments",
2647
2652
  indexName,
2648
2653
  partitionId,
@@ -2684,19 +2689,34 @@ function maybeCompactSegments(state, indexName, policy = "ingest") {
2684
2689
  });
2685
2690
  state.compactionsInFlight.set(indexName, run);
2686
2691
  }
2687
- function scheduleIdleMerge(state, indexName) {
2688
- cancelIdleMerge(state, indexName);
2692
+ function armIdleMerge(state, indexName, dueAt, delayMs) {
2689
2693
  const timer = setTimeout(() => {
2694
+ const pending = state.idleMergeTimers.get(indexName);
2695
+ if (pending === void 0 || pending.timer !== timer) return;
2696
+ const remainingMs = pending.dueAt - Date.now();
2697
+ if (remainingMs > 0) {
2698
+ armIdleMerge(state, indexName, pending.dueAt, remainingMs);
2699
+ return;
2700
+ }
2690
2701
  state.idleMergeTimers.delete(indexName);
2691
2702
  maybeCompactSegments(state, indexName, "idle");
2692
- }, IDLE_MERGE_DELAY_MS);
2703
+ }, delayMs);
2693
2704
  if (typeof timer.unref === "function") timer.unref();
2694
- state.idleMergeTimers.set(indexName, timer);
2705
+ state.idleMergeTimers.set(indexName, { timer, dueAt });
2706
+ }
2707
+ function scheduleIdleMerge(state, indexName) {
2708
+ const dueAt = Date.now() + IDLE_MERGE_DELAY_MS;
2709
+ const pending = state.idleMergeTimers.get(indexName);
2710
+ if (pending !== void 0) {
2711
+ pending.dueAt = dueAt;
2712
+ return;
2713
+ }
2714
+ armIdleMerge(state, indexName, dueAt, IDLE_MERGE_DELAY_MS);
2695
2715
  }
2696
2716
  function cancelIdleMerge(state, indexName) {
2697
- const timer = state.idleMergeTimers.get(indexName);
2698
- if (timer === void 0) return;
2699
- clearTimeout(timer);
2717
+ const pending = state.idleMergeTimers.get(indexName);
2718
+ if (pending === void 0) return;
2719
+ clearTimeout(pending.timer);
2700
2720
  state.idleMergeTimers.delete(indexName);
2701
2721
  }
2702
2722
  async function awaitCompactions(state) {
@@ -3661,13 +3681,13 @@ function createWorkerOrchestrator(config, executor, indexRegistry, callbacks, ve
3661
3681
  desyncedIndexes: /* @__PURE__ */ new Set(),
3662
3682
  copyReleaseHolds: /* @__PURE__ */ new Map(),
3663
3683
  copyLoadBuffers: /* @__PURE__ */ new Map(),
3684
+ copyLoadBufferYieldMarks: /* @__PURE__ */ new WeakMap(),
3664
3685
  copyTransitions: /* @__PURE__ */ new Map(),
3665
3686
  droppedCopies: /* @__PURE__ */ new Map(),
3666
3687
  lastAccessAt: /* @__PURE__ */ new Map(),
3667
3688
  copyReloadCounts: /* @__PURE__ */ new Map(),
3668
3689
  replicationQueues: /* @__PURE__ */ new Map(),
3669
3690
  segmentLedger: /* @__PURE__ */ new Map(),
3670
- unbroadcastSegments: /* @__PURE__ */ new Map(),
3671
3691
  compactionsInFlight: /* @__PURE__ */ new Map(),
3672
3692
  idleMergeTimers: /* @__PURE__ */ new Map(),
3673
3693
  sharedVectorFields: /* @__PURE__ */ new Map(),
@@ -3822,7 +3842,6 @@ function createWorkerOrchestrator(config, executor, indexRegistry, callbacks, ve
3822
3842
  state.lastAccessAt.delete(indexName);
3823
3843
  state.replicationQueues.delete(indexName);
3824
3844
  state.segmentLedger.delete(indexName);
3825
- state.unbroadcastSegments.delete(indexName);
3826
3845
  }
3827
3846
  async function replicate(action) {
3828
3847
  await replicateToWorkers(state, action);
@@ -3833,10 +3852,31 @@ function createWorkerOrchestrator(config, executor, indexRegistry, callbacks, ve
3833
3852
  scheduleIdleMerge(state, action.indexName);
3834
3853
  }
3835
3854
  }
3855
+ function afterMainWrites(indexName, growth) {
3856
+ if (growth === "segments") maybeCompactSegments(state, indexName);
3857
+ if (growth === "liveTail") flushGrownTails(state, indexName);
3858
+ if (state.scaledOutIndexes.has(indexName) || state.copyLoadBuffers.has(indexName)) {
3859
+ scheduleIdleMerge(state, indexName);
3860
+ }
3861
+ }
3862
+ function copiesFollow(indexName) {
3863
+ return state.scaledOutIndexes.has(indexName) || state.copyLoadBuffers.has(indexName) || state.replicationQueues.has(indexName);
3864
+ }
3865
+ function settleMainWrites(indexName, growth = "liveTail") {
3866
+ if (growth !== "segments" && !copiesFollow(indexName)) return null;
3867
+ const waiting = replicationRoomWait(state, indexName);
3868
+ if (waiting === null) {
3869
+ afterMainWrites(indexName, growth);
3870
+ return null;
3871
+ }
3872
+ return waiting.then(() => afterMainWrites(indexName, growth));
3873
+ }
3836
3874
  return {
3837
3875
  scaleOutReadyIndexes: () => scaleOutReadyIndexes(state),
3838
3876
  scaleOutBeforeBatch: (indexName, incomingCount) => scaleOutBeforeBatch(state, indexName, incomingCount),
3839
3877
  replicateToWorkers: replicate,
3878
+ recordMainWrite: (action) => recordMainWrite(state, action),
3879
+ settleMainWrites,
3840
3880
  awaitReplication: (indexName) => awaitReplicationIdle(state, indexName),
3841
3881
  queueDiskAdoption: (action) => queueForCopies(state, action),
3842
3882
  awaitWrites: (indexName) => awaitWritesApplied(state, indexName),
@@ -3846,8 +3886,6 @@ function createWorkerOrchestrator(config, executor, indexRegistry, callbacks, ve
3846
3886
  isIndexBusy: (indexName) => isIndexBusy(state, indexName),
3847
3887
  buildSegments: (requests) => buildSegments(state, requests),
3848
3888
  segmentBuildConcurrency: (indexName) => segmentBuildConcurrency(state, indexName),
3849
- holdUnbroadcastSegments: (indexName, segmentIds) => holdUnbroadcastSegments(state, indexName, segmentIds),
3850
- releaseUnbroadcastSegments: (indexName, segmentIds) => releaseUnbroadcastSegments(state, indexName, segmentIds),
3851
3889
  searchViaWorker: (indexName, params, globalStats, partitionIds, patternWork, bm25) => searchViaWorker(state, indexName, params, globalStats, partitionIds, patternWork, bm25),
3852
3890
  hasWorkerPool: () => state.workerPool !== null,
3853
3891
  mainCopyQueries: () => state.mainCopyQueries ?? "lone",
@@ -3870,11 +3908,11 @@ function createWorkerOrchestrator(config, executor, indexRegistry, callbacks, ve
3870
3908
  if (hold === void 0) state.copyReleaseHolds.set(indexName, { holders: 1, reloads: false });
3871
3909
  else hold.holders += 1;
3872
3910
  state.desyncedIndexes.add(indexName);
3873
- const { releaseIndexCopies } = await import('./release-BH3DKW3T.mjs');
3911
+ const { releaseIndexCopies } = await import('./release-SMR4WJD4.mjs');
3874
3912
  return releaseIndexCopies(state, indexName, copyReleaseSteps);
3875
3913
  },
3876
3914
  async endCopyRelease(indexName, reloads) {
3877
- const { endCopyRelease } = await import('./release-BH3DKW3T.mjs');
3915
+ const { endCopyRelease } = await import('./release-SMR4WJD4.mjs');
3878
3916
  await endCopyRelease(state, indexName, reloads, copyReleaseSteps);
3879
3917
  },
3880
3918
  resyncIndex,
@@ -3923,12 +3961,13 @@ async function createEngineCore(config, hooks, capacityScope = "index") {
3923
3961
  if (config?.lifecycle !== void 0 && durabilityTier === null) {
3924
3962
  throw new NarsilError(ErrorCodes.CONFIG_INVALID, "Index lifecycle settings require durability");
3925
3963
  }
3926
- const durabilityWiring = durabilityTier === null ? null : await import('./durability-wiring-VIF5MOSY.mjs');
3964
+ const durabilityWiring = durabilityTier === null ? null : await import('./durability-wiring-3TD62MBI.mjs');
3927
3965
  const filesystemDurability = durabilityTier?.kind === "wal";
3928
3966
  const executor = createDirectExecutor({
3929
3967
  vectorWorkerCopies: vectorCopyPolicy,
3930
3968
  vectorStorage: filesystemDurability ? "disk" : "memory",
3931
- onVectorGraphRepaired: (indexName) => void durability?.manager.checkpointAfterInFlight(indexName)
3969
+ onVectorGraphRepaired: (indexName) => void durability?.manager.checkpointAfterInFlight(indexName),
3970
+ onDocumentWrite: (action) => orchestrator.recordMainWrite(action)
3932
3971
  });
3933
3972
  const pluginRegistry = createPluginRegistry();
3934
3973
  if (config?.plugins) {
@@ -4067,7 +4106,7 @@ async function createEngineCore(config, hooks, capacityScope = "index") {
4067
4106
  reloadIndex: (indexName) => emitWriteEventAfter(
4068
4107
  { eventHandlers, mutationCtx },
4069
4108
  indexName,
4070
- durability?.manager.reloadIndex?.(indexName) ?? Promise.resolve()
4109
+ durabilityWiring?.reloadIndexAndCopies(orchestrator, durability, indexName) ?? Promise.resolve()
4071
4110
  ),
4072
4111
  onError(error) {
4073
4112
  if (emitEngineEvent(eventHandlers, "invalidationError", { error }) === 0) {
@@ -4109,7 +4148,7 @@ async function createEngineCore(config, hooks, capacityScope = "index") {
4109
4148
  requireManager,
4110
4149
  resumeChange: async (indexName) => {
4111
4150
  if ((indexRegistry.get(indexName)?.pendingAnalysis ?? null) === null) return;
4112
- await (await import('./analysis-change-entry-TXX6JSMX.mjs')).resumeChangeOf(engineCore, indexName);
4151
+ await (await import('./analysis-change-entry-SEDMJ6MW.mjs')).resumeChangeOf(engineCore, indexName);
4113
4152
  },
4114
4153
  onClose: hooks?.onIndexClose,
4115
4154
  onOpen: (indexName) => {
@@ -4195,7 +4234,7 @@ async function startEngineCore(core, config) {
4195
4234
  checkHeapAfterRecovery(core);
4196
4235
  }
4197
4236
  if (core.invalidation) await core.invalidation.start();
4198
- if (core.durability) await (await import('./analysis-change-entry-TXX6JSMX.mjs')).resumeEveryChange(core);
4237
+ if (core.durability) await (await import('./analysis-change-entry-SEDMJ6MW.mjs')).resumeEveryChange(core);
4199
4238
  if (config?.lifecycle === void 0) await core.analysisRebuild.reviewStaleIndexes();
4200
4239
  } catch (err) {
4201
4240
  await core.durability?.manager.shutdown().catch(() => void 0);
@@ -4512,7 +4551,7 @@ async function dropEngineIndex(core, name) {
4512
4551
  const entry = core.requireIndex(name);
4513
4552
  const changeRecorded = () => entry.pendingAnalysis !== null || entry.durableAnalysis !== null;
4514
4553
  const abandonChange = async () => {
4515
- await (await import('./analysis-change-entry-TXX6JSMX.mjs')).abandonChangeOf(core, name);
4554
+ await (await import('./analysis-change-entry-SEDMJ6MW.mjs')).abandonChangeOf(core, name);
4516
4555
  };
4517
4556
  if (changeRecorded()) await abandonChange();
4518
4557
  await core.indexState.drop(name, async () => {
@@ -5068,14 +5107,8 @@ async function insertDocument(ctx, indexName, document, docId, options) {
5068
5107
  } catch (err) {
5069
5108
  console.warn("afterInsert plugin hook error:", err instanceof Error ? err.message : String(err));
5070
5109
  }
5071
- await ctx.orchestrator.replicateToWorkers({
5072
- type: "insert",
5073
- indexName,
5074
- docId: resolvedDocId,
5075
- document: partitionDoc,
5076
- requestId: `replicate-insert-${resolvedDocId}`,
5077
- skipClone: options?.skipClone
5078
- });
5110
+ const roomForCopies = ctx.orchestrator.settleMainWrites(indexName);
5111
+ if (roomForCopies !== null) await roomForCopies;
5079
5112
  for (const fieldPath of extractedVectors.keys()) {
5080
5113
  const vecIndex = insertVecIndexes.get(fieldPath);
5081
5114
  if (vecIndex) {
@@ -5286,6 +5319,8 @@ async function applyAdmittedDocuments(ctx, indexName, admitted, options, failed)
5286
5319
  }
5287
5320
  succeeded.push(doc.docId);
5288
5321
  }
5322
+ const roomForCopies = ctx.orchestrator.settleMainWrites(indexName);
5323
+ if (roomForCopies !== null) await roomForCopies;
5289
5324
  const applied = chunkStart + BATCH_CHUNK_SIZE;
5290
5325
  if (applied < admitted.length) {
5291
5326
  ctx.checkHeapPressure(indexName);
@@ -5330,75 +5365,34 @@ function buildSegmentRequests(indexName, docIds, documents, partitionCount, skip
5330
5365
  }
5331
5366
  return { requests, memberIndexes };
5332
5367
  }
5333
- function freezeSegmentsForAttach(segments) {
5334
- const frozen = [];
5335
- for (const segment of segments) {
5336
- const snapshot = segment.snapshot ?? (segment.payload === null ? null : freezeSegmentShared(segment.payload, segment.documents, segment.segmentId));
5337
- if (snapshot === null) return null;
5338
- frozen.push({ partitionId: segment.partitionId, snapshot });
5339
- }
5340
- return frozen;
5341
- }
5342
- function tryFreezeSegmentsForAttach(segments) {
5368
+ function sharedSnapshotOf(segment) {
5369
+ if (segment.snapshot !== null) return segment.snapshot;
5370
+ if (segment.payload === null) return null;
5343
5371
  try {
5344
- return freezeSegmentsForAttach(segments);
5372
+ return freezeSegmentShared(segment.payload, segment.documents, segment.segmentId);
5345
5373
  } catch (err) {
5346
5374
  console.warn("Segment freeze failed, replicating by merge instead:", err);
5347
5375
  return null;
5348
5376
  }
5349
5377
  }
5350
- function payloadSegments(segments) {
5351
- const plain = [];
5352
- for (const segment of segments) {
5353
- if (segment.payload !== null) {
5354
- plain.push({ partitionId: segment.partitionId, payload: segment.payload, documents: segment.documents });
5355
- }
5356
- }
5357
- return plain;
5358
- }
5359
- function snapshotSegments(segments) {
5360
- const shared = [];
5361
- for (const segment of segments) {
5362
- if (segment.snapshot !== null) shared.push({ partitionId: segment.partitionId, snapshot: segment.snapshot });
5363
- }
5364
- return shared;
5365
- }
5366
- function attachSegments(orchestrator, indexName, segments) {
5367
- return orchestrator.replicateToWorkers({
5368
- type: "attachSegments",
5369
- indexName,
5370
- segments,
5371
- requestId: `attach-segments-${indexName}-${segments.length}`
5372
- });
5373
- }
5374
- async function broadcastBuiltSegments(orchestrator, indexName, segments, skipClone) {
5375
- const frozen = tryFreezeSegmentsForAttach(segments);
5376
- if (frozen !== null) {
5377
- await attachSegments(orchestrator, indexName, frozen);
5378
- return;
5378
+ function copyActionOfSegment(indexName, segment, skipClone) {
5379
+ const snapshot = sharedSnapshotOf(segment);
5380
+ if (snapshot !== null) {
5381
+ return {
5382
+ type: "attachSegments",
5383
+ indexName,
5384
+ segments: [{ partitionId: segment.partitionId, snapshot }],
5385
+ requestId: `attach-segments-${indexName}-${segment.segmentId}`
5386
+ };
5379
5387
  }
5380
- const shared = snapshotSegments(segments);
5381
- if (shared.length > 0) await attachSegments(orchestrator, indexName, shared);
5382
- const plain = payloadSegments(segments);
5383
- if (plain.length === 0) return;
5384
- await orchestrator.replicateToWorkers({
5388
+ if (segment.payload === null) return null;
5389
+ return {
5385
5390
  type: "mergeSegments",
5386
5391
  indexName,
5387
- segments: plain,
5388
- requestId: `merge-segments-${indexName}-${plain.length}`,
5392
+ segments: [{ partitionId: segment.partitionId, payload: segment.payload, documents: segment.documents }],
5393
+ requestId: `merge-segments-${indexName}-${segment.segmentId}`,
5389
5394
  skipClone: skipClone === true ? true : void 0
5390
- });
5391
- }
5392
- async function replicateAsSegments(ctx, indexName, docIds, documents, skipClone) {
5393
- if (docIds.length < MIN_DOCUMENTS_FOR_SEGMENTS) return false;
5394
- const workers = ctx.orchestrator.segmentBuildConcurrency(indexName);
5395
- if (workers <= 0) return false;
5396
- const manager = ctx.requireManager(indexName);
5397
- const { requests } = buildSegmentRequests(indexName, docIds, documents, manager.partitionCount, skipClone);
5398
- const built = await ctx.orchestrator.buildSegments(requests);
5399
- if (built === null || built.length === 0) return false;
5400
- await broadcastBuiltSegments(ctx.orchestrator, indexName, built, skipClone);
5401
- return true;
5395
+ };
5402
5396
  }
5403
5397
 
5404
5398
  // src/engine/mutations/insert-batch-segments.ts
@@ -5406,26 +5400,11 @@ function mainStoreDocument(doc, options) {
5406
5400
  if (doc.extractedVectors.size > 0 || options?.skipClone === true) return doc.partitionDoc;
5407
5401
  return structuredClone(doc.partitionDoc);
5408
5402
  }
5409
- async function replicateDocuments(ctx, indexName, docs, options) {
5410
- for (const doc of docs) {
5411
- await ctx.orchestrator.replicateToWorkers({
5412
- type: "insert",
5413
- indexName,
5414
- docId: doc.docId,
5415
- document: doc.partitionDoc,
5416
- requestId: `replicate-insert-${doc.docId}`,
5417
- skipClone: options?.skipClone
5418
- });
5419
- }
5420
- }
5421
5403
  async function applyIndividually(ctx, indexName, admitted, options, failed) {
5422
5404
  const applied = await applyAdmittedDocuments(ctx, indexName, admitted, options, failed);
5423
- const succeededIds = new Set(applied.succeeded);
5424
- const replicable = admitted.filter((doc) => succeededIds.has(doc.docId) && !applied.buffered.has(doc.docId));
5425
- await replicateDocuments(ctx, indexName, replicable, options);
5426
5405
  return { succeeded: applied.succeeded, touchedVectorFields: applied.touchedVectorFields };
5427
5406
  }
5428
- function attachOnce(manager, attachment) {
5407
+ function attachOnce(ctx, manager, attachment) {
5429
5408
  if (attachment.failure !== void 0) throw attachment.failure;
5430
5409
  if (attachment.attached) return;
5431
5410
  try {
@@ -5437,11 +5416,12 @@ function attachOnce(manager, attachment) {
5437
5416
  attachment.failure = error;
5438
5417
  throw error;
5439
5418
  }
5419
+ if (attachment.copyAction !== null) ctx.orchestrator.recordMainWrite(attachment.copyAction);
5440
5420
  }
5441
5421
  function applyOfMergedDocument(ctx, indexName, doc, attachment, progress) {
5442
5422
  const manager = ctx.requireManager(indexName);
5443
5423
  const attachToIndex = async () => {
5444
- attachOnce(manager, attachment);
5424
+ attachOnce(ctx, manager, attachment);
5445
5425
  progress.applied = true;
5446
5426
  try {
5447
5427
  insertDocumentVectors(
@@ -5465,13 +5445,14 @@ function applyOfMergedDocument(ctx, indexName, doc, attachment, progress) {
5465
5445
  };
5466
5446
  return indexChangeOutsideExternalWaits(attachToIndex);
5467
5447
  }
5468
- function chunksOfWholeSegments(built, frozen, memberIndexes, admitted) {
5448
+ function chunksOfWholeSegments(indexName, built, frozen, memberIndexes, admitted, options) {
5469
5449
  const chunks = [];
5470
5450
  let chunk = { docs: [], attachmentOf: /* @__PURE__ */ new Map() };
5471
5451
  for (let i = 0; i < built.length; i++) {
5472
5452
  const attachment = {
5473
5453
  partitionId: built[i].partitionId,
5474
5454
  segments: [frozen[i]],
5455
+ copyAction: copyActionOfSegment(indexName, built[i], options?.skipClone),
5475
5456
  attached: false,
5476
5457
  failure: void 0
5477
5458
  };
@@ -5488,12 +5469,12 @@ function chunksOfWholeSegments(built, frozen, memberIndexes, admitted) {
5488
5469
  if (chunk.docs.length > 0) chunks.push(chunk);
5489
5470
  return chunks;
5490
5471
  }
5491
- async function recordMergedDocuments(ctx, indexName, built, frozen, memberIndexes, admitted, failed) {
5472
+ async function recordMergedDocuments(ctx, indexName, built, frozen, memberIndexes, admitted, options, failed) {
5492
5473
  const hasAfterHook = ctx.pluginRegistry.hasHooks("afterInsert");
5493
5474
  const succeededIds = /* @__PURE__ */ new Set();
5494
5475
  const errorOf = /* @__PURE__ */ new Map();
5495
5476
  const touchedVectorFields = /* @__PURE__ */ new Set();
5496
- const chunks = chunksOfWholeSegments(built, frozen, memberIndexes, admitted);
5477
+ const chunks = chunksOfWholeSegments(indexName, built, frozen, memberIndexes, admitted, options);
5497
5478
  for (let index = 0; index < chunks.length; index++) {
5498
5479
  const { docs, attachmentOf } = chunks[index];
5499
5480
  const progress = docs.map(() => ({ applied: false }));
@@ -5528,40 +5509,23 @@ async function recordMergedDocuments(ctx, indexName, built, frozen, memberIndexe
5528
5509
  }
5529
5510
  succeededIds.add(doc.docId);
5530
5511
  }
5512
+ const roomForCopies = ctx.orchestrator.settleMainWrites(indexName, "segments");
5513
+ if (roomForCopies !== null) await roomForCopies;
5531
5514
  if (index + 1 < chunks.length) {
5532
5515
  ctx.checkHeapPressure(indexName);
5533
5516
  await new Promise((r) => setTimeout(r, 0));
5534
5517
  }
5535
5518
  }
5536
5519
  const succeeded = [];
5537
- const failedDocIds = /* @__PURE__ */ new Set();
5538
5520
  for (const doc of admitted) {
5539
5521
  if (succeededIds.has(doc.docId)) {
5540
5522
  succeeded.push(doc.docId);
5541
5523
  continue;
5542
5524
  }
5543
5525
  if (!errorOf.has(doc.docId)) continue;
5544
- failedDocIds.add(doc.docId);
5545
5526
  failed.push({ docId: doc.docId, error: asBatchInsertError(errorOf.get(doc.docId)) });
5546
5527
  }
5547
- return { succeeded, touchedVectorFields, failedDocIds };
5548
- }
5549
- async function broadcastSegments(ctx, indexName, built, memberIndexes, admitted, failedDocIds, options) {
5550
- const clean = [];
5551
- const retryDocs = [];
5552
- for (let i = 0; i < built.length; i++) {
5553
- const members = memberIndexes[i].map((m) => admitted[m]);
5554
- if (members.some((doc) => failedDocIds.has(doc.docId))) {
5555
- retryDocs.push(...members.filter((doc) => !failedDocIds.has(doc.docId)));
5556
- continue;
5557
- }
5558
- clean.push(built[i]);
5559
- }
5560
- if (clean.length > 0) {
5561
- await broadcastBuiltSegments(ctx.orchestrator, indexName, clean, options?.skipClone);
5562
- }
5563
- await replicateDocuments(ctx, indexName, retryDocs, options);
5564
- return clean.map((segment) => segment.segmentId);
5528
+ return { succeeded, touchedVectorFields };
5565
5529
  }
5566
5530
  function frozenSegmentOf(segment, members, options) {
5567
5531
  if (segment.snapshot !== null) return createSharedFrozenSegment(segment.snapshot);
@@ -5615,20 +5579,7 @@ async function ingestAdmitted(ctx, indexName, admitted, options, failed) {
5615
5579
  for (const doc of admitted) {
5616
5580
  if (manager.has(doc.docId)) return applyIndividually(ctx, indexName, admitted, options, failed);
5617
5581
  }
5618
- const segmentIds = built.map((segment) => segment.segmentId);
5619
- ctx.orchestrator.holdUnbroadcastSegments(indexName, segmentIds);
5620
- const recorded = await recordMergedDocuments(ctx, indexName, built, frozen, memberIndexes, admitted, failed);
5621
- const broadcast = await broadcastSegments(
5622
- ctx,
5623
- indexName,
5624
- built,
5625
- memberIndexes,
5626
- admitted,
5627
- recorded.failedDocIds,
5628
- options
5629
- );
5630
- ctx.orchestrator.releaseUnbroadcastSegments(indexName, broadcast);
5631
- return { succeeded: recorded.succeeded, touchedVectorFields: recorded.touchedVectorFields };
5582
+ return recordMergedDocuments(ctx, indexName, built, frozen, memberIndexes, admitted, options, failed);
5632
5583
  }
5633
5584
  async function insertBatchViaSegments(ctx, indexName, documents, options) {
5634
5585
  const failed = [];
@@ -5656,7 +5607,6 @@ async function insertDocumentBatch(ctx, indexName, documents, options) {
5656
5607
  return insertBatchViaSegments(ctx, indexName, documents, options);
5657
5608
  }
5658
5609
  const succeeded = [];
5659
- const succeededDocs = [];
5660
5610
  const failed = [];
5661
5611
  const hasBeforeHook = ctx.pluginRegistry.hasHooks("beforeInsert");
5662
5612
  const hasAfterHook = ctx.pluginRegistry.hasHooks("afterInsert");
@@ -5665,7 +5615,6 @@ async function insertDocumentBatch(ctx, indexName, documents, options) {
5665
5615
  const batchVecIndexes = batchManager.getVectorIndexes();
5666
5616
  const batchVectorFieldPaths = batchVecIndexes.size > 0 ? entry.vectorFieldPaths : /* @__PURE__ */ new Set();
5667
5617
  const touchedVectorFields = /* @__PURE__ */ new Set();
5668
- const bufferedDocIds = /* @__PURE__ */ new Set();
5669
5618
  for (let chunkStart = 0; chunkStart < documents.length; chunkStart += BATCH_CHUNK_SIZE) {
5670
5619
  if (ctx.abortController.signal.aborted) break;
5671
5620
  const chunkEnd = Math.min(chunkStart + BATCH_CHUNK_SIZE, documents.length);
@@ -5693,9 +5642,7 @@ async function insertDocumentBatch(ctx, indexName, documents, options) {
5693
5642
  continue;
5694
5643
  }
5695
5644
  if (application.status === "buffered") {
5696
- bufferedDocIds.add(doc.docId);
5697
5645
  succeeded.push(doc.docId);
5698
- succeededDocs.push(doc.partitionDoc);
5699
5646
  continue;
5700
5647
  }
5701
5648
  for (const fieldPath of doc.extractedVectors.keys()) {
@@ -5709,7 +5656,6 @@ async function insertDocumentBatch(ctx, indexName, documents, options) {
5709
5656
  }
5710
5657
  }
5711
5658
  succeeded.push(doc.docId);
5712
- succeededDocs.push(doc.partitionDoc);
5713
5659
  }
5714
5660
  }
5715
5661
  const prepared = [];
@@ -5743,32 +5689,13 @@ async function insertDocumentBatch(ctx, indexName, documents, options) {
5743
5689
  }
5744
5690
  }
5745
5691
  if (prepared.length > 0) await applyPrepared(prepared);
5692
+ const roomForCopies = ctx.orchestrator.settleMainWrites(indexName);
5693
+ if (roomForCopies !== null) await roomForCopies;
5746
5694
  if (chunkEnd < documents.length) {
5747
5695
  ctx.checkHeapPressure(indexName);
5748
5696
  await new Promise((r) => setTimeout(r, 0));
5749
5697
  }
5750
5698
  }
5751
- const replicableIds = [];
5752
- const replicableDocs = [];
5753
- for (let i = 0; i < succeeded.length; i++) {
5754
- if (bufferedDocIds.has(succeeded[i])) continue;
5755
- replicableIds.push(succeeded[i]);
5756
- replicableDocs.push(succeededDocs[i]);
5757
- }
5758
- const replicatedAsSegments = copiesBuildSegments && await replicateAsSegments(ctx, indexName, replicableIds, replicableDocs, options?.skipClone);
5759
- if (!replicatedAsSegments) {
5760
- for (let i = 0; i < replicableIds.length; i++) {
5761
- if (turnsAreBudgeted && turnIsSpent()) await yieldTurn();
5762
- await ctx.orchestrator.replicateToWorkers({
5763
- type: "insert",
5764
- indexName,
5765
- docId: replicableIds[i],
5766
- document: replicableDocs[i],
5767
- requestId: `replicate-insert-${replicableIds[i]}`,
5768
- skipClone: options?.skipClone
5769
- });
5770
- }
5771
- }
5772
5699
  for (const fieldPath of touchedVectorFields) {
5773
5700
  const vecIndex = batchVecIndexes.get(fieldPath);
5774
5701
  if (vecIndex) {
@@ -5824,19 +5751,14 @@ function applyOfRemoval(ctx, indexName, prepared) {
5824
5751
  return indexChangeOutsideExternalWaits(removeFromIndex);
5825
5752
  }
5826
5753
  async function settleRemoval(ctx, indexName, prepared) {
5827
- const { docId, removedSpellings } = prepared;
5754
+ const { docId } = prepared;
5828
5755
  try {
5829
5756
  await ctx.pluginRegistry.runHook("afterRemove", { indexName, docId });
5830
5757
  } catch (err) {
5831
5758
  console.warn("afterRemove plugin hook error:", err instanceof Error ? err.message : String(err));
5832
5759
  }
5833
- await ctx.orchestrator.replicateToWorkers({
5834
- type: "remove",
5835
- indexName,
5836
- docId,
5837
- requestId: `replicate-remove-${docId}`,
5838
- removedSpellings
5839
- });
5760
+ const roomForCopies = ctx.orchestrator.settleMainWrites(indexName, "none");
5761
+ if (roomForCopies !== null) await roomForCopies;
5840
5762
  }
5841
5763
  async function removeDocument(ctx, indexName, docId, options) {
5842
5764
  ctx.guardShutdown();
@@ -5934,14 +5856,8 @@ async function settleUpdate(ctx, indexName, prepared) {
5934
5856
  } catch (err) {
5935
5857
  console.warn("afterUpdate plugin hook error:", err instanceof Error ? err.message : String(err));
5936
5858
  }
5937
- await ctx.orchestrator.replicateToWorkers({
5938
- type: "update",
5939
- indexName,
5940
- docId: prepared.docId,
5941
- document: prepared.partitionDoc,
5942
- requestId: `replicate-update-${prepared.docId}`,
5943
- removedSpellings: prepared.removedSpellings
5944
- });
5859
+ const roomForCopies = ctx.orchestrator.settleMainWrites(indexName);
5860
+ if (roomForCopies !== null) await roomForCopies;
5945
5861
  const vecIndexes = ctx.requireManager(indexName).getVectorIndexes();
5946
5862
  for (const [fieldPath, vec] of prepared.extractedVectors) {
5947
5863
  if (vec === null) continue;
@@ -6288,7 +6204,6 @@ async function withRenewedSyncEpoch(core, indexName, change) {
6288
6204
  function clearEngineIndex(core, indexName) {
6289
6205
  return withRenewedSyncEpoch(core, indexName, async () => {
6290
6206
  await core.executor.execute({ type: "clear", indexName, requestId: indexName });
6291
- await core.orchestrator.replicateToWorkers({ type: "clear", indexName, requestId: `replicate-clear-${indexName}` });
6292
6207
  core.watermarkNotifier.forget(indexName);
6293
6208
  const durable = core.durability?.manager;
6294
6209
  await (durable?.checkpointFromMemory?.(indexName) ?? durable?.checkpoint(indexName));
@@ -6406,7 +6321,7 @@ function portabilityOperations(core, config, engine) {
6406
6321
  const { restoresInFlight } = core;
6407
6322
  const previous = restoresInFlight.get(indexName) ?? Promise.resolve();
6408
6323
  const restored = previous.then(async () => {
6409
- const { runRestore } = await import('./restore-queue-7NNSTROA.mjs');
6324
+ const { runRestore } = await import('./restore-queue-LZH7LMLR.mjs');
6410
6325
  await runRestore(core, restoreHost, indexName, data, engine());
6411
6326
  });
6412
6327
  const settled2 = restored.then(
@@ -6437,7 +6352,7 @@ function portabilityOperations(core, config, engine) {
6437
6352
  return {
6438
6353
  snapshot(indexName, options) {
6439
6354
  return withOpenIndex2(indexName, async () => {
6440
- const { createSnapshot } = await import('./snapshot-RH4NSKIZ.mjs');
6355
+ const { createSnapshot } = await import('./snapshot-O7ICP7NJ.mjs');
6441
6356
  return createSnapshot(snapshotDepsOf(indexName), options?.queryHistory === true ? core : null);
6442
6357
  });
6443
6358
  },
@@ -6450,8 +6365,8 @@ function portabilityOperations(core, config, engine) {
6450
6365
  exportDocuments(indexName) {
6451
6366
  return withOpenIndex2(indexName, async () => {
6452
6367
  const [{ checkpointForArchive }, { documentExportStream }] = await Promise.all([
6453
- import('./snapshot-RH4NSKIZ.mjs'),
6454
- import('./write-3FK7NG3Y.mjs')
6368
+ import('./snapshot-O7ICP7NJ.mjs'),
6369
+ import('./write-2OBJGLFS.mjs')
6455
6370
  ]);
6456
6371
  const header = indexConfigurationOf(core.requireIndex(indexName));
6457
6372
  return documentExportStream(header, await checkpointForArchive(snapshotDepsOf(indexName)));
@@ -6459,7 +6374,7 @@ function portabilityOperations(core, config, engine) {
6459
6374
  },
6460
6375
  importDocumentExport(indexName, data) {
6461
6376
  core.guardShutdown();
6462
- const imported = import('./import-XKDPJQDP.mjs').then(
6377
+ const imported = import('./import-GPKLTSKA.mjs').then(
6463
6378
  ({ readDocumentExport }) => readDocumentExport(engine(), indexName, data)
6464
6379
  );
6465
6380
  return emitWriteEventAfter(core, indexName, imported);
@@ -6903,7 +6818,7 @@ function createNarsilFromCore(core, config) {
6903
6818
  const entry = requireIndex(indexName);
6904
6819
  await withOpenIndexWrite(indexName, async () => {
6905
6820
  if (entry.pendingAnalysis === null) return core.analysisRebuild.rebuild(indexName);
6906
- return (await import('./analysis-change-5BQOQ4BF.mjs')).resumeAnalysisChange(core, indexName);
6821
+ return (await import('./analysis-change-CKEMM2MC.mjs')).resumeAnalysisChange(core, indexName);
6907
6822
  });
6908
6823
  },
6909
6824
  async changeAnalysis(indexName, change) {
@@ -6911,7 +6826,7 @@ function createNarsilFromCore(core, config) {
6911
6826
  requireIndex(indexName);
6912
6827
  const changed = withOpenIndex2(
6913
6828
  indexName,
6914
- async () => (await import('./analysis-change-5BQOQ4BF.mjs')).changeIndexAnalysis(core, indexName, change)
6829
+ async () => (await import('./analysis-change-CKEMM2MC.mjs')).changeIndexAnalysis(core, indexName, change)
6915
6830
  );
6916
6831
  await emitWriteEventAfter(core, indexName, changed);
6917
6832
  },
@@ -6946,7 +6861,7 @@ function createNarsilFromCore(core, config) {
6946
6861
  const rebalanced = withOpenIndex2(
6947
6862
  indexName,
6948
6863
  () => withRenewedSyncEpoch(core, indexName, async () => {
6949
- const { executeRebalance } = await import('./analysis-change-5BQOQ4BF.mjs');
6864
+ const { executeRebalance } = await import('./analysis-change-CKEMM2MC.mjs');
6950
6865
  const running = executeRebalance(requireManager(indexName), indexName, targetPartitionCount, rebalanceCtx);
6951
6866
  releaseWrites();
6952
6867
  await running;
@@ -7070,7 +6985,7 @@ async function createNarsil(config) {
7070
6985
  await startEngineCore(core, runnableConfig);
7071
6986
  const engine = createNarsilFromCore(core, runnableConfig);
7072
6987
  if (runnableConfig?.querySuggestions !== void 0 || core.durability !== null) {
7073
- await (await import('./engine-hooks-EGUGNZYE.mjs')).startQuerySuggestions(core, engine, runnableConfig);
6988
+ await (await import('./engine-hooks-HA3SBOBR.mjs')).startQuerySuggestions(core, engine, runnableConfig);
7074
6989
  }
7075
6990
  return engine;
7076
6991
  }