@cortexkit/pi-magic-context 0.49.20 → 0.49.21

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 (48) hide show
  1. package/dist/auto-search-worker.js +6 -6
  2. package/dist/chunk-embedding-write-worker.js +9 -9
  3. package/dist/{compaction-marker-candidates-fnm47jat.js → compaction-marker-candidates-p1kqkqhq.js} +2 -2
  4. package/dist/compaction-marker-candidates-worker.js +2 -2
  5. package/dist/{compartment-chunk-embedding-81qesfjs.js → compartment-chunk-embedding-y01m95c2.js} +5 -5
  6. package/dist/{embedding-backfill-56e871c6.js → embedding-backfill-2vh6m3bg.js} +11 -11
  7. package/dist/embedding-worker-process.js +1 -1
  8. package/dist/embedding-worker.js +4 -4
  9. package/dist/{index-dzem6gn9.js → index-29nw7n1r.js} +1 -1
  10. package/dist/{index-hws5f0z9.js → index-2qtx0q6h.js} +213 -4
  11. package/dist/{index-5vgt1zeh.js → index-3c3ztwgc.js} +2 -2
  12. package/dist/{index-rgfb753z.js → index-579m1751.js} +2 -2
  13. package/dist/{index-kqb3d8bs.js → index-5j6vwg4z.js} +148 -11
  14. package/dist/{index-6kb2xpw7.js → index-6wdwv3a6.js} +1 -1
  15. package/dist/{index-rfyvax95.js → index-at6py2k3.js} +1 -1
  16. package/dist/{index-bxmf4dhr.js → index-ccanzg8p.js} +2367 -1243
  17. package/dist/{index-mtvvhcw4.js → index-dbgg6hsf.js} +24 -10
  18. package/dist/{index-af9t637y.js → index-ftvm2acc.js} +121 -38
  19. package/dist/{index-zhwwp8zz.js → index-gqjxy2p7.js} +14 -4
  20. package/dist/{index-jxjr7kz9.js → index-gwxaz0z5.js} +2 -4
  21. package/dist/{index-p63nwn5v.js → index-hxp6q5f8.js} +1 -1
  22. package/dist/{index-qerzchrs.js → index-j3pz3a1b.js} +1 -1
  23. package/dist/{index-bttctq07.js → index-n8e5e9fp.js} +6 -3
  24. package/dist/{index-b8am7tns.js → index-pe5gz5c4.js} +4 -4
  25. package/dist/{index-tb3d9trm.js → index-st4gwt64.js} +1 -1
  26. package/dist/{index-5n5zxs8e.js → index-vx6f7wff.js} +2 -2
  27. package/dist/{index-v2epyzbm.js → index-w1twp2kp.js} +9 -7
  28. package/dist/{index-jt0g3hn0.js → index-w6r3ggnp.js} +35 -17
  29. package/dist/{index-vdy273xw.js → index-wgmhk91m.js} +10 -4
  30. package/dist/{index-e19qtjj0.js → index-wqpjhx1p.js} +35 -4
  31. package/dist/index.js +224 -206
  32. package/dist/{message-fts-rowid-map-bpexnsdj.js → message-fts-rowid-map-59y476bk.js} +3 -3
  33. package/dist/{message-index-mvag9crh.js → message-index-3snxf11x.js} +9 -9
  34. package/dist/{message-index-bounded-d4r3weh0.js → message-index-bounded-4ngt600v.js} +9 -9
  35. package/dist/{message-time-backfill-kc10yrcj.js → message-time-backfill-e3r8ddh1.js} +1 -1
  36. package/dist/migration-worker.js +6 -6
  37. package/dist/{project-embedding-registry-cfrg952x.js → project-embedding-registry-hfyzs654.js} +10 -10
  38. package/dist/raw-ordinal-warmup-worker.js +8 -8
  39. package/dist/{read-session-chunk-7g4zvpd8.js → read-session-chunk-5dmc77q2.js} +5 -5
  40. package/dist/{read-session-raw-0fsjh10f.js → read-session-raw-yxv2fv34.js} +2 -2
  41. package/dist/{search-archive-qbhp7e89.js → search-archive-3daj5ttc.js} +6 -6
  42. package/dist/{search-hp4g3g9v.js → search-jhfh3tsj.js} +17 -17
  43. package/dist/{sqlite-d67n6dtr.js → sqlite-v89bj0yy.js} +7 -1
  44. package/dist/{storage-memory-9g882j7a.js → storage-memory-0ndn65fm.js} +2 -2
  45. package/dist/{storage-tags-m2qcp1g2.js → storage-tags-r48vxthe.js} +2 -2
  46. package/dist/subagent-entry.js +22 -21
  47. package/dist/tag-snapshot-worker-pi.js +8 -8
  48. package/package.json +5 -2
@@ -24,15 +24,15 @@ var [
24
24
  { Database, registerSqliteDiagnosticSink },
25
25
  { log }
26
26
  ] = await Promise.all([
27
- import("./embedding-backfill-56e871c6.js"),
27
+ import("./embedding-backfill-2vh6m3bg.js"),
28
28
  import("./embedding-cache-7rp4gqzr.js"),
29
- import("./storage-memory-9g882j7a.js"),
30
- import("./project-embedding-registry-cfrg952x.js"),
31
- import("./search-hp4g3g9v.js"),
32
- import("./compartment-chunk-embedding-81qesfjs.js"),
29
+ import("./storage-memory-0ndn65fm.js"),
30
+ import("./project-embedding-registry-hfyzs654.js"),
31
+ import("./search-jhfh3tsj.js"),
32
+ import("./compartment-chunk-embedding-y01m95c2.js"),
33
33
  import("./embedding-activity-ew6dshfd.js"),
34
34
  import("./harness-9872e0ym.js"),
35
- import("./sqlite-d67n6dtr.js"),
35
+ import("./sqlite-v89bj0yy.js"),
36
36
  import("./logger-shetp43v.js")
37
37
  ]);
38
38
  setHarness(input.harness);
@@ -3,7 +3,7 @@ import {
3
3
  } from "./index-0h2mkab2.js";
4
4
  import {
5
5
  Database2
6
- } from "./index-hws5f0z9.js";
6
+ } from "./index-2qtx0q6h.js";
7
7
  import {
8
8
  configureContextDatabasePragmas2
9
9
  } from "./index-fapenpch.js";
@@ -13,29 +13,29 @@ import {
13
13
  } from "./index-54wmg4rj.js";
14
14
  import"./index-my0dn413.js";
15
15
  import"./index-fgs78jyd.js";
16
- import"./index-jxjr7kz9.js";
16
+ import"./index-gwxaz0z5.js";
17
17
  import"./index-399p688g.js";
18
- import"./index-rfyvax95.js";
19
- import"./index-rgfb753z.js";
18
+ import"./index-at6py2k3.js";
19
+ import"./index-579m1751.js";
20
20
  import {
21
21
  replaceCompartmentChunkEmbeddings2,
22
22
  recordChunkEmbedBackoff2,
23
23
  loadUnembeddedSessionChunkCandidates2,
24
24
  countUnembeddedSessionCompartments2
25
- } from "./index-5n5zxs8e.js";
25
+ } from "./index-vx6f7wff.js";
26
26
  import {
27
27
  recordSessionProjectIdentity,
28
28
  acquireGitSweepLease,
29
29
  renewGitSweepLease,
30
30
  releaseGitSweepLease
31
- } from "./index-qerzchrs.js";
32
- import"./index-p63nwn5v.js";
31
+ } from "./index-j3pz3a1b.js";
32
+ import"./index-hxp6q5f8.js";
33
33
  import"./index-n4wyxcgr.js";
34
34
  import {
35
35
  LATEST_SUPPORTED_VERSION,
36
36
  enforceSchemaFence
37
- } from "./index-mtvvhcw4.js";
38
- import"./index-5vgt1zeh.js";
37
+ } from "./index-dbgg6hsf.js";
38
+ import"./index-3c3ztwgc.js";
39
39
  import"./index-w1avzkdt.js";
40
40
  import"./index-135e8hvg.js";
41
41
  import"./index-8976mezv.js";
@@ -4,9 +4,9 @@ import {
4
4
  readMarkerCandidateBasis2,
5
5
  prepareMarkerCandidateBasis2,
6
6
  scanMarkerCandidateSnapshot2
7
- } from "./index-6kb2xpw7.js";
7
+ } from "./index-6wdwv3a6.js";
8
8
  import"./index-399p688g.js";
9
- import"./index-hws5f0z9.js";
9
+ import"./index-2qtx0q6h.js";
10
10
  import"./index-fgs78jyd.js";
11
11
  import"./index-0h2mkab2.js";
12
12
  export {
@@ -5,8 +5,8 @@ if (!port)
5
5
  throw new Error("marker candidate worker requires a parent port");
6
6
  port.postMessage({ kind: "accepted" });
7
7
  var [{ Database }, { scanMarkerCandidateSnapshot }] = await Promise.all([
8
- import("./sqlite-d67n6dtr.js"),
9
- import("./compaction-marker-candidates-fnm47jat.js")
8
+ import("./sqlite-v89bj0yy.js"),
9
+ import("./compaction-marker-candidates-p1kqkqhq.js")
10
10
  ]);
11
11
  var input = workerData;
12
12
  var db;
@@ -24,14 +24,14 @@ import {
24
24
  countSessionCompartmentEmbedCoverage2,
25
25
  countSessionCompartmentEmbedCoveragePolite2,
26
26
  countUnembeddedSessionCompartmentsPolite2
27
- } from "./index-5n5zxs8e.js";
28
- import"./index-jxjr7kz9.js";
29
- import"./index-rgfb753z.js";
30
- import"./index-rfyvax95.js";
27
+ } from "./index-vx6f7wff.js";
28
+ import"./index-gwxaz0z5.js";
29
+ import"./index-579m1751.js";
30
+ import"./index-at6py2k3.js";
31
31
  import"./index-399p688g.js";
32
32
  import"./index-hqw0rt9k.js";
33
33
  import"./index-my0dn413.js";
34
- import"./index-hws5f0z9.js";
34
+ import"./index-2qtx0q6h.js";
35
35
  import"./index-fgs78jyd.js";
36
36
  import"./index-0h2mkab2.js";
37
37
  import"./index-54wmg4rj.js";
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  ensureMemoryEmbeddings2
3
- } from "./index-b8am7tns.js";
4
- import"./index-v2epyzbm.js";
3
+ } from "./index-pe5gz5c4.js";
4
+ import"./index-w1twp2kp.js";
5
5
  import"./index-9p40dgkm.js";
6
6
  import"./index-yhzhdp3m.js";
7
- import"./index-qerzchrs.js";
8
- import"./index-5n5zxs8e.js";
9
- import"./index-e19qtjj0.js";
10
- import"./index-jxjr7kz9.js";
11
- import"./index-bxmf4dhr.js";
12
- import"./index-p63nwn5v.js";
13
- import"./index-rgfb753z.js";
14
- import"./index-rfyvax95.js";
7
+ import"./index-j3pz3a1b.js";
8
+ import"./index-vx6f7wff.js";
9
+ import"./index-wqpjhx1p.js";
10
+ import"./index-gwxaz0z5.js";
11
+ import"./index-ccanzg8p.js";
12
+ import"./index-hxp6q5f8.js";
13
+ import"./index-579m1751.js";
14
+ import"./index-at6py2k3.js";
15
15
  import"./index-399p688g.js";
16
16
  import"./index-hqw0rt9k.js";
17
17
  import"./index-my0dn413.js";
18
- import"./index-hws5f0z9.js";
18
+ import"./index-2qtx0q6h.js";
19
19
  import"./index-fgs78jyd.js";
20
20
  import"./index-0h2mkab2.js";
21
21
  import"./index-54wmg4rj.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./index-fgs78jyd.js";
5
5
  import {
6
6
  inRootAsyncContext2
7
- } from "./index-hws5f0z9.js";
7
+ } from "./index-2qtx0q6h.js";
8
8
 
9
9
  // ../plugin/src/features/magic-context/memory/embedding-worker-process.ts
10
10
  import { Worker } from "node:worker_threads";
@@ -4,15 +4,15 @@ import {
4
4
  import {
5
5
  log2
6
6
  } from "./index-fgs78jyd.js";
7
- import"./index-bxmf4dhr.js";
8
- import"./index-jxjr7kz9.js";
7
+ import"./index-ccanzg8p.js";
8
+ import"./index-gwxaz0z5.js";
9
9
  import"./index-my0dn413.js";
10
- import"./index-hws5f0z9.js";
10
+ import"./index-2qtx0q6h.js";
11
11
  import {
12
12
  resolveLocalEmbeddingWorkerRuntime,
13
13
  getLocalEmbeddingNativeMemoryStats,
14
14
  LocalEmbeddingProvider
15
- } from "./index-e19qtjj0.js";
15
+ } from "./index-wqpjhx1p.js";
16
16
  import {
17
17
  setStoragePrivatePermissionEnforcement
18
18
  } from "./index-81nthk8j.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withPrivilegedWriter2
3
- } from "./index-hws5f0z9.js";
3
+ } from "./index-2qtx0q6h.js";
4
4
  import {
5
5
  MEMORY_CATEGORY_ORDER_SQL
6
6
  } from "./index-135e8hvg.js";
@@ -174,6 +174,177 @@ function topLevelCommaSegments(text) {
174
174
  function getTagIdentityWriteGeneration2() {
175
175
  return tagIdentityWriteGeneration;
176
176
  }
177
+ var busyTimeoutStates = new WeakMap;
178
+ var BUSY_TIMEOUT_QUERY = /^\s*PRAGMA\s+(?:(?:\w+|"[^"]+"|`[^`]+`|\[[^\]]+\])\s*\.\s*)?(?:busy_timeout|"busy_timeout"|`busy_timeout`|\[busy_timeout\])\s*;?\s*$/i;
179
+ var BUSY_TIMEOUT_SETTER = /^\s*PRAGMA\s+(?:(?:\w+|"[^"]+"|`[^`]+`|\[[^\]]+\])\s*\.\s*)?(?:busy_timeout|"busy_timeout"|`busy_timeout`|\[busy_timeout\])\s*(?==|\()/i;
180
+ function literalBusyTimeout(sql) {
181
+ const head = BUSY_TIMEOUT_SETTER.exec(sql);
182
+ if (!head)
183
+ return;
184
+ const match = /^(?:=\s*|\(\s*)(?:'(-?\d+)'|"(-?\d+)"|(-?\d+))\s*\)?\s*;?\s*$/.exec(sql.slice(head[0].length));
185
+ if (!match)
186
+ return;
187
+ const value = Number(match[1] ?? match[2] ?? match[3]);
188
+ return value < 0 ? 0 : value <= 2147483647 ? value : undefined;
189
+ }
190
+ function busyTimeoutStatements(sql) {
191
+ const statements = [];
192
+ let statement = "";
193
+ let quote = "";
194
+ for (let i = 0;i < sql.length; i++) {
195
+ const char = sql[i];
196
+ if (quote) {
197
+ statement += char;
198
+ if (char === quote) {
199
+ if (sql[i + 1] === quote)
200
+ statement += sql[++i];
201
+ else
202
+ quote = "";
203
+ }
204
+ } else if (char === "'" || char === '"' || char === "`" || char === "[") {
205
+ quote = char === "[" ? "]" : char;
206
+ statement += char;
207
+ } else if (char === "-" && sql[i + 1] === "-") {
208
+ while (i + 1 < sql.length && sql[i + 1] !== `
209
+ `)
210
+ i++;
211
+ statement += " ";
212
+ } else if (char === "/" && sql[i + 1] === "*") {
213
+ i += 2;
214
+ while (i < sql.length && !(sql[i] === "*" && sql[i + 1] === "/"))
215
+ i++;
216
+ i++;
217
+ statement += " ";
218
+ } else if (char === ";") {
219
+ statements.push(statement);
220
+ statement = "";
221
+ } else
222
+ statement += char;
223
+ }
224
+ statements.push(statement);
225
+ return statements.filter((part) => part.trim().length > 0);
226
+ }
227
+ function installNativeDeadlineRouting(db) {
228
+ const rawExec = db.exec.bind(db);
229
+ const rawPrepare = db.prepare.bind(db);
230
+ const readTimeout = () => {
231
+ const statement = rawPrepare("PRAGMA busy_timeout");
232
+ try {
233
+ return Object.values(statement.get())[0];
234
+ } finally {
235
+ statement.finalize?.();
236
+ }
237
+ };
238
+ const timeoutState = { current: readTimeout() };
239
+ busyTimeoutStates.set(db, timeoutState);
240
+ const setBusyTimeout = (timeout) => {
241
+ rawExec(`PRAGMA busy_timeout=${timeout}`);
242
+ timeoutState.current = timeout;
243
+ };
244
+ const withinDeadline = (operation) => {
245
+ const deadline = nativeWaitScope?.getStore();
246
+ if (!deadline?.active || !deadline.remainingMs)
247
+ return operation();
248
+ const remaining = deadline.remainingMs();
249
+ if (remaining === Infinity)
250
+ return operation();
251
+ const previous = timeoutState.current;
252
+ const timeout = Math.min(previous, Math.max(0, Math.floor(remaining)));
253
+ if (timeout === previous)
254
+ return operation();
255
+ setBusyTimeout(timeout);
256
+ try {
257
+ return operation();
258
+ } finally {
259
+ setBusyTimeout(previous);
260
+ }
261
+ };
262
+ Object.defineProperty(db, "exec", {
263
+ configurable: true,
264
+ writable: true,
265
+ value: (sql) => {
266
+ const parts = /\bbusy_timeout\b/i.test(sql) ? busyTimeoutStatements(sql) : [];
267
+ if (parts.length === 1 && BUSY_TIMEOUT_QUERY.test(parts[0]))
268
+ return rawExec(sql);
269
+ const singleSetter = parts.length === 1 && BUSY_TIMEOUT_SETTER.test(parts[0]);
270
+ const setting = singleSetter ? literalBusyTimeout(parts[0]) : undefined;
271
+ if (singleSetter) {
272
+ const result = rawExec(sql);
273
+ timeoutState.current = setting ?? readTimeout();
274
+ return result;
275
+ }
276
+ if (!/\bbusy_timeout\b/i.test(sql))
277
+ return withinDeadline(() => rawExec(sql));
278
+ const setters = parts.filter((part) => BUSY_TIMEOUT_SETTER.test(part));
279
+ return withinDeadline(() => {
280
+ try {
281
+ const result = rawExec(sql);
282
+ if (setters.length)
283
+ timeoutState.current = literalBusyTimeout(setters[setters.length - 1]) ?? readTimeout();
284
+ return result;
285
+ } catch (error) {
286
+ if (setters.length)
287
+ timeoutState.current = readTimeout();
288
+ throw error;
289
+ }
290
+ });
291
+ }
292
+ });
293
+ const nativePrepare = (sql) => BUSY_TIMEOUT_QUERY.test(sql) || BUSY_TIMEOUT_SETTER.test(sql) ? rawPrepare(sql) : withinDeadline(() => rawPrepare(sql));
294
+ Object.defineProperty(db, "prepare", {
295
+ configurable: true,
296
+ writable: true,
297
+ value: (sql) => {
298
+ const statement = nativePrepare(sql);
299
+ const normalized = /\bbusy_timeout\b/i.test(sql) ? busyTimeoutStatements(sql)[0] ?? sql : sql;
300
+ const setting = literalBusyTimeout(normalized);
301
+ const timeoutSetter = BUSY_TIMEOUT_SETTER.test(normalized);
302
+ const timeoutQuery = BUSY_TIMEOUT_QUERY.test(normalized);
303
+ if (timeoutSetter)
304
+ timeoutState.current = setting ?? readTimeout();
305
+ for (const method of ["run", "get", "all", "values"]) {
306
+ const execute = statement[method]?.bind(statement);
307
+ if (!execute)
308
+ continue;
309
+ Object.defineProperty(statement, method, {
310
+ configurable: true,
311
+ value: (...args) => {
312
+ if (timeoutQuery)
313
+ return execute(...args);
314
+ if (!timeoutSetter)
315
+ return withinDeadline(() => execute(...args));
316
+ const result = execute(...args);
317
+ timeoutState.current = readTimeout();
318
+ return result;
319
+ }
320
+ });
321
+ }
322
+ if (typeof statement.iterate === "function") {
323
+ const iterate = statement.iterate.bind(statement);
324
+ Object.defineProperty(statement, "iterate", {
325
+ configurable: true,
326
+ value: (...args) => {
327
+ const iterator = !timeoutSetter && !timeoutQuery ? withinDeadline(() => iterate(...args)) : iterate(...args);
328
+ const next = iterator.next.bind(iterator);
329
+ if (timeoutSetter)
330
+ timeoutState.current = readTimeout();
331
+ iterator.next = () => {
332
+ if (timeoutQuery)
333
+ return next();
334
+ if (!timeoutSetter)
335
+ return withinDeadline(next);
336
+ const result = next();
337
+ timeoutState.current = readTimeout();
338
+ return result;
339
+ };
340
+ return iterator;
341
+ }
342
+ });
343
+ }
344
+ return statement;
345
+ }
346
+ });
347
+ }
177
348
  function installTransactionRouting(db, readonly) {
178
349
  const nativeExec = db.exec.bind(db);
179
350
  Object.defineProperty(db, "exec", {
@@ -311,7 +482,7 @@ function wrapRemainingTagWriteForms(statement) {
311
482
  });
312
483
  }
313
484
  }
314
- function trackSqliteConnection(db, filename, options) {
485
+ function trackSqliteConnection(db, filename, options, turnDeadlines = false) {
315
486
  const originalClose = db.close.bind(db);
316
487
  const sequence = nextSqliteConnectionSequence++;
317
488
  const metadata = {
@@ -319,6 +490,8 @@ function trackSqliteConnection(db, filename, options) {
319
490
  filename: typeof filename === "string" ? filename : Buffer.isBuffer(filename) ? "<buffer>" : ":memory:",
320
491
  readonly: Boolean(options) && typeof options === "object" && (options.readonly === true || options.readOnly === true)
321
492
  };
493
+ if (turnDeadlines)
494
+ installNativeDeadlineRouting(db);
322
495
  installTransactionRouting(db, metadata.readonly);
323
496
  Object.defineProperty(db, "close", {
324
497
  configurable: true,
@@ -371,6 +544,12 @@ function buildNodeSqliteDatabaseClass(DatabaseSync) {
371
544
  return NodeSqliteDatabase;
372
545
  }
373
546
  var Database2 = TrackedDatabase;
547
+ function createSqliteTurnDatabase2(filename, options) {
548
+ return trackSqliteConnection(new DatabaseImpl(filename, options), filename, options, true);
549
+ }
550
+ function hasSqliteTurnDeadlineRouting2(db) {
551
+ return busyTimeoutStates.has(db);
552
+ }
374
553
  function getSqliteDatabasePath2(db) {
375
554
  for (const connection of trackedSqliteConnections.values()) {
376
555
  if (connection.reference.deref() === db) {
@@ -390,6 +569,11 @@ function pragmaValue(db, name) {
390
569
  return row[name] ?? Object.values(row)[0];
391
570
  }
392
571
  function pragmaNumber(db, name) {
572
+ if (name === "busy_timeout") {
573
+ const state = busyTimeoutStates.get(db);
574
+ if (state)
575
+ return state.current;
576
+ }
393
577
  try {
394
578
  const value = pragmaValue(db, name);
395
579
  return typeof value === "number" && Number.isFinite(value) ? value : null;
@@ -455,11 +639,34 @@ function prepareCachedStatement2(db, sql) {
455
639
  return ownPreparedStatement(db, db.prepare(sql));
456
640
  }
457
641
  var privilegeDepth = new WeakMap;
642
+ var nativeWaitScope;
643
+ function releaseNativeWaitLease(lease) {
644
+ lease.active = false;
645
+ lease.remainingMs = undefined;
646
+ }
647
+ function withSqliteTurnDeadline2(remainingMs, operation) {
648
+ const scope = nativeWaitScope ??= new AsyncLocalStorage;
649
+ const lease = { active: true, remainingMs };
650
+ return scope.run(lease, () => {
651
+ try {
652
+ const result = operation();
653
+ if (result && typeof result.then === "function")
654
+ return Promise.resolve(result).finally(releaseNativeWaitLease.bind(null, lease));
655
+ releaseNativeWaitLease(lease);
656
+ return result;
657
+ } catch (error) {
658
+ releaseNativeWaitLease(lease);
659
+ throw error;
660
+ }
661
+ });
662
+ }
458
663
  var transformPassScope = new AsyncLocalStorage;
459
664
  var admissionScope = new AsyncLocalStorage;
460
665
  var backgroundWriterScope = new AsyncLocalStorage;
461
666
  function withSqliteBackgroundWriter2(operation) {
462
- return backgroundWriterScope.run(true, operation);
667
+ if (!nativeWaitScope?.getStore())
668
+ return backgroundWriterScope.run(true, operation);
669
+ return nativeWaitScope.run(undefined, () => backgroundWriterScope.run(true, operation));
463
670
  }
464
671
  function withSqliteTransformPass2(operation) {
465
672
  const existing = transformPassScope.getStore();
@@ -490,7 +697,9 @@ function withSqliteTransformPass2(operation) {
490
697
  return typeof reservation === "function" ? run(reservation) : reservation.then(run);
491
698
  }
492
699
  function withoutSqliteTransformPass2(operation) {
493
- return transformPassScope.run(undefined, operation);
700
+ if (!nativeWaitScope?.getStore())
701
+ return transformPassScope.run(undefined, operation);
702
+ return nativeWaitScope.run(undefined, () => transformPassScope.run(undefined, operation));
494
703
  }
495
704
  function guardSqliteTransformPass2(guard) {
496
705
  const lease = transformPassScope.getStore();
@@ -829,4 +1038,4 @@ async function yieldIndexChunk2() {
829
1038
  await yieldIndexTurn();
830
1039
  }
831
1040
 
832
- export { inRootAsyncContext2, registerSlowWriteReporter2, registerSqliteDiagnosticSink2, detectSqliteRuntime2, getTagIdentityWriteGeneration2, Database2, getSqliteDatabasePath2, prepareCachedStatement2, withSqliteBackgroundWriter2, withSqliteTransformPass2, withoutSqliteTransformPass2, guardSqliteTransformPass2, assertTransformWrite2, isTransientSqliteError2, beginSqliteWriterAsync2, withAsyncPrivilegedWriter2, withPrivilegedWriter2, indexCoordinationInput2, releaseIndexOwner2, withIndexChunk2, yieldIndexChunk2 };
1041
+ export { inRootAsyncContext2, registerSlowWriteReporter2, registerSqliteDiagnosticSink2, detectSqliteRuntime2, getTagIdentityWriteGeneration2, Database2, createSqliteTurnDatabase2, hasSqliteTurnDeadlineRouting2, getSqliteDatabasePath2, prepareCachedStatement2, withSqliteTurnDeadline2, withSqliteBackgroundWriter2, withSqliteTransformPass2, withoutSqliteTransformPass2, guardSqliteTransformPass2, assertTransformWrite2, isTransientSqliteError2, beginSqliteWriterAsync2, withAsyncPrivilegedWriter2, withPrivilegedWriter2, indexCoordinationInput2, releaseIndexOwner2, withIndexChunk2, yieldIndexChunk2 };
@@ -16,11 +16,11 @@ import {
16
16
  } from "./index-8976mezv.js";
17
17
  import {
18
18
  Database2
19
- } from "./index-hws5f0z9.js";
19
+ } from "./index-2qtx0q6h.js";
20
20
  import {
21
21
  normalizeStoredProjectPath,
22
22
  storedPathBelongsToIdentity
23
- } from "./index-p63nwn5v.js";
23
+ } from "./index-hxp6q5f8.js";
24
24
  import {
25
25
  logSlowWriteTransaction
26
26
  } from "./index-hqw0rt9k.js";
@@ -2,10 +2,10 @@ import {
2
2
  getSqliteDatabasePath2,
3
3
  withSqliteBackgroundWriter2,
4
4
  withoutSqliteTransformPass2
5
- } from "./index-hws5f0z9.js";
5
+ } from "./index-2qtx0q6h.js";
6
6
  import {
7
7
  runSessionWarmupWorker
8
- } from "./index-rfyvax95.js";
8
+ } from "./index-at6py2k3.js";
9
9
  import {
10
10
  logSlowWriteTransaction
11
11
  } from "./index-hqw0rt9k.js";