@cortexkit/opencode-magic-context 0.49.90 → 0.49.92

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 (188) hide show
  1. package/dist/auto-search-worker.js +4 -4
  2. package/dist/chunk-embedding-write-worker.js +6 -6
  3. package/dist/{compartment-chunk-embedding-fey2bsyf.js → compartment-chunk-embedding-rp4asvk0.js} +3 -3
  4. package/dist/config/index.d.ts.map +1 -1
  5. package/dist/config/migrate-dreamer-v2.d.ts +1 -0
  6. package/dist/config/migrate-dreamer-v2.d.ts.map +1 -1
  7. package/dist/{conflict-warning-hook-kbq6ppjf.js → conflict-warning-hook-exf96bpt.js} +3 -3
  8. package/dist/{context-cdds0gjj.js → context-e8qd2v00.js} +579 -245
  9. package/dist/{embedding-backfill-qjkaee9s.js → embedding-backfill-w0yq71q2.js} +6 -6
  10. package/dist/embedding-worker.js +3 -3
  11. package/dist/features/magic-context/dreamer/refresh-primers.d.ts.map +1 -1
  12. package/dist/features/magic-context/dreamer/task-scheduler.d.ts +2 -2
  13. package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
  14. package/dist/features/magic-context/memory/single-store-embedding-drain.d.ts.map +1 -1
  15. package/dist/features/magic-context/overflow-detection.d.ts +7 -1
  16. package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
  17. package/dist/features/magic-context/project-embedding-registry.d.ts +2 -1
  18. package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
  19. package/dist/features/magic-context/storage-meta-persisted.d.ts +13 -3
  20. package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
  21. package/dist/hooks/magic-context/compartment-parser.d.ts +2 -0
  22. package/dist/hooks/magic-context/compartment-parser.d.ts.map +1 -1
  23. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
  24. package/dist/hooks/magic-context/compartment-runner-types.d.ts +7 -7
  25. package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
  26. package/dist/hooks/magic-context/compartment-runner-validation.d.ts +3 -0
  27. package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
  28. package/dist/hooks/magic-context/compartment-trigger.d.ts +2 -1
  29. package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
  30. package/dist/hooks/magic-context/event-handler.d.ts +4 -0
  31. package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
  32. package/dist/hooks/magic-context/event-resolvers.d.ts +5 -0
  33. package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
  34. package/dist/hooks/magic-context/historian-drain-gate.d.ts +15 -0
  35. package/dist/hooks/magic-context/historian-drain-gate.d.ts.map +1 -1
  36. package/dist/hooks/magic-context/historian-host-runner.d.ts +1 -1
  37. package/dist/hooks/magic-context/historian-host-runner.d.ts.map +1 -1
  38. package/dist/hooks/magic-context/historian-prompt.generated.d.ts +1 -1
  39. package/dist/hooks/magic-context/historian-prompt.generated.d.ts.map +1 -1
  40. package/dist/hooks/magic-context/historian-publish-stage-logger.d.ts +5 -0
  41. package/dist/hooks/magic-context/historian-publish-stage-logger.d.ts.map +1 -1
  42. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  43. package/dist/hooks/magic-context/provider-overflow-notice.d.ts +8 -0
  44. package/dist/hooks/magic-context/provider-overflow-notice.d.ts.map +1 -0
  45. package/dist/hooks/magic-context/read-session-db.d.ts +2 -0
  46. package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
  47. package/dist/hooks/magic-context/read-session-formatting.d.ts +2 -0
  48. package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -1
  49. package/dist/hooks/magic-context/transform-compartment-phase.d.ts +5 -0
  50. package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
  51. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  52. package/dist/{index-1y4y98r1.js → index-01h7tqe3.js} +25 -2
  53. package/dist/{index-3pdknr07.js → index-0twg41mh.js} +2 -2
  54. package/dist/{index-q7msfgwz.js → index-3f3d548g.js} +1503 -1371
  55. package/dist/{index-2pdgy88n.js → index-3n376ann.js} +19 -7
  56. package/dist/{index-78t37mcq.js → index-41bma6qs.js} +3 -3
  57. package/dist/{index-qfcjrnpe.js → index-5a9kwapd.js} +4 -4
  58. package/dist/{index-dk3hy2a2.js → index-5pmf4jpj.js} +10 -10
  59. package/dist/{index-2qsca7h7.js → index-5y9w2ax7.js} +4 -4
  60. package/dist/{index-pxnzyvjc.js → index-6r99v53h.js} +1 -1
  61. package/dist/{index-mrjat4eq.js → index-6rk44cer.js} +3 -3
  62. package/dist/{index-60wnwcwz.js → index-901exj0f.js} +91 -26
  63. package/dist/{index-6zewd2n5.js → index-9ffntwyr.js} +1 -1
  64. package/dist/{index-h9hybzr5.js → index-anwy2mfb.js} +6 -6
  65. package/dist/{index-83qd3n7s.js → index-et39x9k3.js} +1 -1
  66. package/dist/{index-w51n3576.js → index-f25ha337.js} +1 -1
  67. package/dist/{index-kknjvmpx.js → index-fqth7850.js} +51 -60
  68. package/dist/{index-zxhev8ze.js → index-hbn5g7rt.js} +1 -1
  69. package/dist/{index-chpzb6xy.js → index-hre29c1a.js} +2 -2
  70. package/dist/{index-08jfpny9.js → index-j2w79s9r.js} +76 -6
  71. package/dist/{index-tt0vs4x5.js → index-jba6ny4m.js} +28 -4
  72. package/dist/{index-m6dnydf8.js → index-mg9s2rc3.js} +1 -1
  73. package/dist/{index-61knrt52.js → index-mjy2k9jr.js} +1 -1
  74. package/dist/{index-wmb2mcdw.js → index-n71006wq.js} +6 -6
  75. package/dist/{index-n1ty0vd3.js → index-r3tdqqtq.js} +127 -101
  76. package/dist/{index-5vsk2cpp.js → index-s7460efs.js} +12 -1
  77. package/dist/{index-x40zr813.js → index-sp5pvs95.js} +9 -1
  78. package/dist/{index-9d3qgwq0.js → index-wvbg9m0h.js} +4 -4
  79. package/dist/index-x3rdza40.js +63 -0
  80. package/dist/{index-jzfsnbmm.js → index-xg1zjht5.js} +5 -5
  81. package/dist/{index-60x5d68t.js → index-xn9efn18.js} +1 -1
  82. package/dist/{index-39rzef89.js → index-ydhymf0b.js} +3 -3
  83. package/dist/{index-g0mb2kb4.js → index-zzhcshdk.js} +75 -67
  84. package/dist/index.js +97 -60
  85. package/dist/{message-index-bounded-r1qys471.js → message-index-bounded-f6fc00ze.js} +6 -6
  86. package/dist/migration-worker.js +4 -4
  87. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  88. package/dist/{project-embedding-registry-m3fp1pa4.js → project-embedding-registry-8je0xg18.js} +7 -5
  89. package/dist/raw-ordinal-warmup-worker.js +4 -4
  90. package/dist/{read-session-chunk-xv9f0wgb.js → read-session-chunk-y2ew3630.js} +5 -5
  91. package/dist/{recomp-orchestrator-dgyb394j.js → recomp-orchestrator-ggtcvb9g.js} +21 -20
  92. package/dist/{render-d014e603.js → render-q8c6wrq9.js} +14 -14
  93. package/dist/{search-archive-gybn6q7s.js → search-archive-pz1jf655.js} +7 -7
  94. package/dist/{search-9gceftb9.js → search-gjyrwapc.js} +16 -16
  95. package/dist/{send-session-notification-gzxz88vq.js → send-session-notification-0779tyd9.js} +2 -2
  96. package/dist/shared/model-suggestion-retry.d.ts +18 -0
  97. package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
  98. package/dist/{storage-tags-f1ftvjpw.js → storage-tags-7raphcw6.js} +3 -3
  99. package/dist/{store-reader-nf8z86n9.js → store-reader-qbq6q4v0.js} +1 -1
  100. package/dist/{store-n4yz3n66.js → store-yr443ye8.js} +2 -2
  101. package/dist/{task-config-qt6n4bxm.js → task-config-vrebjxyy.js} +2 -1
  102. package/dist/{transform-postprocess-phase-34k1zwsy.js → transform-postprocess-phase-pmzdd3s2.js} +22 -21
  103. package/dist/v2/auto-search-worker.js +4 -4
  104. package/dist/v2/chunk-embedding-write-worker.js +6 -6
  105. package/dist/v2/{compartment-chunk-embedding-knt2468v.js → compartment-chunk-embedding-w7ht0t9v.js} +3 -3
  106. package/dist/v2/{context-satgm752.js → context-qqbpzk1q.js} +686 -323
  107. package/dist/v2/{embedding-backfill-0ar1bm97.js → embedding-backfill-95m72gxa.js} +6 -6
  108. package/dist/v2/embedding-worker.js +3 -3
  109. package/dist/v2/fold/host-media.d.ts.map +1 -1
  110. package/dist/v2/fold/native-replay-v3.d.ts.map +1 -1
  111. package/dist/v2/fold/native-replay.d.ts +1 -0
  112. package/dist/v2/fold/native-replay.d.ts.map +1 -1
  113. package/dist/v2/fold/restore.d.ts +15 -0
  114. package/dist/v2/fold/restore.d.ts.map +1 -1
  115. package/dist/v2/hidden-child-native.d.ts +1 -1
  116. package/dist/v2/hidden-child-native.d.ts.map +1 -1
  117. package/dist/v2/hidden-child-record.d.ts +11 -2
  118. package/dist/v2/hidden-child-record.d.ts.map +1 -1
  119. package/dist/v2/hidden-child-sweep.d.ts +3 -0
  120. package/dist/v2/hidden-child-sweep.d.ts.map +1 -1
  121. package/dist/v2/hidden-completion.d.ts +4 -0
  122. package/dist/v2/hidden-completion.d.ts.map +1 -1
  123. package/dist/v2/hidden-run-holder.d.ts +6 -6
  124. package/dist/v2/hidden-run-holder.d.ts.map +1 -1
  125. package/dist/v2/hooks/context.d.ts +2 -2
  126. package/dist/v2/hooks/context.d.ts.map +1 -1
  127. package/dist/v2/hooks/hidden-child.d.ts +2 -0
  128. package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
  129. package/dist/v2/hooks/overflow-recovery.d.ts +6 -0
  130. package/dist/v2/hooks/overflow-recovery.d.ts.map +1 -1
  131. package/dist/v2/{message-index-bounded-b07r9cjv.js → message-index-bounded-70g28hyg.js} +6 -6
  132. package/dist/v2/migration-worker.js +4 -4
  133. package/dist/v2/{project-embedding-registry-gx2waee8.js → project-embedding-registry-fcxf4qht.js} +7 -5
  134. package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
  135. package/dist/v2/{read-session-chunk-38wdy8nd.js → read-session-chunk-9rf0n9e6.js} +5 -5
  136. package/dist/v2/{recomp-orchestrator-wq7gbkqa.js → recomp-orchestrator-cwghhjc9.js} +21 -20
  137. package/dist/v2/{render-2dan17xc.js → render-e852zmxz.js} +14 -14
  138. package/dist/v2/{search-archive-89hdy0a2.js → search-archive-tmn6b5w8.js} +7 -7
  139. package/dist/v2/{search-nyqykx7q.js → search-jd3vczhn.js} +15 -15
  140. package/dist/v2/{send-session-notification-zazaxxpf.js → send-session-notification-v69y04f5.js} +2 -2
  141. package/dist/v2/server-3gz9k20t.js +63 -0
  142. package/dist/v2/{server-09h2vyvs.js → server-6t3asmx8.js} +6 -6
  143. package/dist/v2/{server-dgjqvpgd.js → server-72k2r3kt.js} +19 -7
  144. package/dist/v2/{server-pjk9spbf.js → server-7e89a2kf.js} +1 -1
  145. package/dist/v2/{server-dtcwkdqj.js → server-7x5a46hf.js} +1427 -1322
  146. package/dist/v2/{server-add0j5n3.js → server-8ps3717t.js} +3 -3
  147. package/dist/v2/{server-c7awk5s2.js → server-9011eteb.js} +4 -4
  148. package/dist/v2/{server-f7tzvmzs.js → server-b4efn08m.js} +1 -1
  149. package/dist/v2/{server-y17r5ryz.js → server-barj0mjz.js} +2 -2
  150. package/dist/v2/{server-b0a9h3ds.js → server-bvr9xs8h.js} +5 -5
  151. package/dist/v2/{server-pmws7we9.js → server-d4trxrj3.js} +91 -26
  152. package/dist/v2/{server-fb5hvvfc.js → server-fj3pekz2.js} +3 -3
  153. package/dist/v2/{server-6250cxzs.js → server-gs2251jr.js} +1 -1
  154. package/dist/v2/{server-a85j3kam.js → server-jkj1dq6j.js} +28 -4
  155. package/dist/v2/{server-ta4h0fch.js → server-js2v309w.js} +9 -9
  156. package/dist/v2/{server-9n2qgk29.js → server-mgxqfprb.js} +2 -2
  157. package/dist/v2/{server-2kswss3d.js → server-n5wn7d9b.js} +48 -60
  158. package/dist/v2/{server-vy0beygw.js → server-p4g021y5.js} +4 -4
  159. package/dist/v2/{server-x6fn9x8q.js → server-ps6zrzwj.js} +1 -1
  160. package/dist/v2/{server-y8xjr8rx.js → server-qb3s0mnc.js} +12 -1
  161. package/dist/v2/{server-stjy5dxv.js → server-qntmqaca.js} +1 -1
  162. package/dist/v2/{server-ytqps2xa.js → server-rkj44mez.js} +76 -6
  163. package/dist/v2/{server-tj65pgvg.js → server-vsqmkvxc.js} +32 -5
  164. package/dist/v2/{server-qyazxy92.js → server-vtgeyhq6.js} +25 -2
  165. package/dist/v2/{server-fn4ky6mn.js → server-x69fqsvz.js} +1 -1
  166. package/dist/v2/{server-yx0nyj1q.js → server-ysjjcatk.js} +3 -3
  167. package/dist/v2/server.js +4 -3
  168. package/dist/v2/{storage-tags-pmw33chf.js → storage-tags-wgsemtw1.js} +3 -3
  169. package/dist/v2/{store-y56y034s.js → store-enef5jcn.js} +2 -2
  170. package/dist/v2/{store-reader-2vhx33n6.js → store-reader-jbaqv1yp.js} +1 -1
  171. package/dist/v2/store-reader.d.ts +18 -0
  172. package/dist/v2/store-reader.d.ts.map +1 -1
  173. package/dist/v2/{task-config-ex2vajr2.js → task-config-4nqq2s0w.js} +2 -1
  174. package/dist/v2/{v2-archive-reader-gh1jghf7.js → v2-archive-reader-dm1aeqk2.js} +1 -1
  175. package/dist/v2/{wrapup-orchestrator-2h7ayss9.js → wrapup-orchestrator-cke368np.js} +21 -20
  176. package/dist/{v2-archive-reader-8158kyfd.js → v2-archive-reader-39ye0d3b.js} +1 -1
  177. package/dist/{wrapup-orchestrator-ct59br0c.js → wrapup-orchestrator-ggnk0r4r.js} +22 -21
  178. package/package.json +1 -1
  179. package/src/config/index.test.ts +58 -0
  180. package/src/config/index.ts +4 -1
  181. package/src/config/migrate-dreamer-v2.ts +42 -0
  182. package/src/shared/model-suggestion-retry.test.ts +37 -0
  183. package/src/shared/model-suggestion-retry.ts +38 -4
  184. package/src/shared/models-dev-cache.test.ts +15 -0
  185. package/src/shared/startup-maintenance-policy.test.ts +11 -6
  186. package/dist/index-ksdyrrav.js +0 -52
  187. package/dist/v2/server-0s95v3en.js +0 -49
  188. /package/dist/v2/{server-3ap5dmhc.js → server-5hwf5c7r.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  estimateTokens
3
- } from "./index-5vsk2cpp.js";
3
+ } from "./index-s7460efs.js";
4
4
  import {
5
5
  getHarness2
6
6
  } from "./index-pavzsdc6.js";
@@ -15,7 +15,7 @@ import {
15
15
  isSynapseEmbeddingTruncated,
16
16
  getSynapseBatchRequestKey,
17
17
  SynapseEmbeddingProvider
18
- } from "./index-pxnzyvjc.js";
18
+ } from "./index-6r99v53h.js";
19
19
  import {
20
20
  inRootAsyncContext2,
21
21
  getSqliteDatabasePath2
@@ -43,7 +43,7 @@ import {
43
43
  countSessionCompartmentEmbedCoverage2,
44
44
  countSessionCompartmentEmbedCoveragePolite2,
45
45
  countUnembeddedSessionCompartmentsPolite2
46
- } from "./index-3pdknr07.js";
46
+ } from "./index-0twg41mh.js";
47
47
  import {
48
48
  DEFAULT_LOCAL_EMBEDDING_MODEL
49
49
  } from "./index-6nqz8hsz.js";
@@ -56,7 +56,7 @@ import {
56
56
  getEmbeddingProviderIdentity,
57
57
  dominantEmbeddingFailure,
58
58
  LocalEmbeddingProvider
59
- } from "./index-60x5d68t.js";
59
+ } from "./index-xn9efn18.js";
60
60
  import {
61
61
  embedPauseBySession,
62
62
  activeEmbeddingSessions,
@@ -2624,14 +2624,26 @@ function isUnembeddedMemoryRow(row) {
2624
2624
  const candidate = row;
2625
2625
  return typeof candidate.id === "number" && typeof candidate.content === "string" && typeof candidate.normalized_hash === "string";
2626
2626
  }
2627
+ var UNEMBEDDED_MEMORIES_FOR_PROJECT = `FROM memories m
2628
+ WHERE m.project_path = ? AND m.status IN ('active', 'permanent')
2629
+ AND NOT EXISTS (
2630
+ SELECT 1 FROM memory_embeddings me WHERE me.memory_id = m.id AND me.model_id = ?
2631
+ )`;
2627
2632
  function getLoadUnembeddedMemoriesStatement(db) {
2628
2633
  let stmt = loadUnembeddedMemoriesStatements.get(db);
2629
2634
  if (!stmt) {
2630
- stmt = db.prepare("SELECT m.id AS id, m.content AS content, m.normalized_hash AS normalized_hash FROM memories m LEFT JOIN memory_embeddings me ON m.id = me.memory_id AND me.model_id = ? WHERE m.project_path = ? AND m.status = 'active' AND me.memory_id IS NULL LIMIT ?");
2635
+ stmt = db.prepare(`SELECT m.id, m.content, m.normalized_hash ${UNEMBEDDED_MEMORIES_FOR_PROJECT} LIMIT ?`);
2631
2636
  loadUnembeddedMemoriesStatements.set(db, stmt);
2632
2637
  }
2633
2638
  return stmt;
2634
2639
  }
2640
+ function countUnembeddedMemoriesForProject2(db, projectIdentity) {
2641
+ const snapshot = getProjectEmbeddingSnapshot2(projectIdentity);
2642
+ if (!snapshot?.enabled)
2643
+ return 0;
2644
+ const row = db.prepare(`SELECT COUNT(*) AS count ${UNEMBEDDED_MEMORIES_FOR_PROJECT}`).get(projectIdentity, snapshot.modelId);
2645
+ return row.count;
2646
+ }
2635
2647
  async function embedUnembeddedMemoriesForProject2(db, projectIdentity, batchSize = 10) {
2636
2648
  const outcome = await embedUnembeddedMemoriesForProjectOutcome2(db, projectIdentity, batchSize);
2637
2649
  return outcome.kind === "embedded" ? outcome.count : 0;
@@ -2643,7 +2655,7 @@ async function embedUnembeddedMemoriesForProjectOutcome2(db, projectIdentity, ba
2643
2655
  if (!snapshot?.enabled)
2644
2656
  return { kind: "disabled" };
2645
2657
  const normalizedBatchSize = Math.max(1, Math.floor(batchSize));
2646
- const memories = getLoadUnembeddedMemoriesStatement(db).all(snapshot.modelId, projectIdentity, normalizedBatchSize).filter(isUnembeddedMemoryRow);
2658
+ const memories = getLoadUnembeddedMemoriesStatement(db).all(projectIdentity, snapshot.modelId, normalizedBatchSize).filter(isUnembeddedMemoryRow);
2647
2659
  if (memories.length === 0)
2648
2660
  return { kind: "done" };
2649
2661
  try {
@@ -3183,4 +3195,4 @@ function _resetProjectEmbeddingRegistryForTests2() {
3183
3195
  setBootQuietPeriodForTests(null);
3184
3196
  }
3185
3197
 
3186
- export { withQueryEmbeddingDeadline, OpenAICompatibleEmbeddingProvider, saveCommitEmbedding, loadProjectCommitEmbeddings, loadUnembeddedCommits, countEmbeddedCommits, upsertCommits, getLatestIndexedCommitSha, enforceProjectCap, describeShadowBackfillWriteRefusal2, listShadowBackfillStalls2, retainProjectEmbedding2, getShadowBackfillStopReason2, markProjectLoadUntrusted2, contentSha2562, drainProjectEmbeddingIdentityMaintenance2, drainStaleEmbeddingIdentitiesForProject2, registerProjectEmbedding2, registerProjectShadowEmbedding2, getShadowEmbeddingMeasurementCohort2, getPrimaryEmbeddingMeasurementCohort2, embedShadowTextForProject2, enqueueShadowEmbeddingItems2, getShadowBackfillRemaining2, flushShadowEmbeddingBacklog2, registerProjectInObservationMode2, unregisterProjectShadowEmbedding2, unregisterProjectEmbedding2, getProjectEmbeddingSnapshot2, readSearchBackfillCursor2, writeSearchBackfillCursor2, installProjectEmbeddingSearchBridge2, getProjectChunkEmbeddingModelId2, getProjectEmbeddingMaxInputTokens2, embedTextForProject2, embedBatchForProject2, embedItemsForProject2, embedItemsWindowBounded2, embedUnembeddedMemoriesForProject2, embedUnembeddedMemoriesForProjectOutcome2, drainCommitBacklogForProject2, embedUnembeddedCompartmentChunksForProject2, embedSessionCompartmentChunks2, getEmbeddingCoverageStatus2, getAutoEmbeddingSessionCoverage2, sweepAllRegisteredProjects2, _setTestProviderFactoryForProject2, _resetProjectEmbeddingRegistryForTests2 };
3198
+ export { withQueryEmbeddingDeadline, OpenAICompatibleEmbeddingProvider, saveCommitEmbedding, loadProjectCommitEmbeddings, loadUnembeddedCommits, countEmbeddedCommits, upsertCommits, getLatestIndexedCommitSha, enforceProjectCap, describeShadowBackfillWriteRefusal2, listShadowBackfillStalls2, retainProjectEmbedding2, getShadowBackfillStopReason2, markProjectLoadUntrusted2, contentSha2562, drainProjectEmbeddingIdentityMaintenance2, drainStaleEmbeddingIdentitiesForProject2, registerProjectEmbedding2, registerProjectShadowEmbedding2, getShadowEmbeddingMeasurementCohort2, getPrimaryEmbeddingMeasurementCohort2, embedShadowTextForProject2, enqueueShadowEmbeddingItems2, getShadowBackfillRemaining2, flushShadowEmbeddingBacklog2, registerProjectInObservationMode2, unregisterProjectShadowEmbedding2, unregisterProjectEmbedding2, getProjectEmbeddingSnapshot2, readSearchBackfillCursor2, writeSearchBackfillCursor2, installProjectEmbeddingSearchBridge2, getProjectChunkEmbeddingModelId2, getProjectEmbeddingMaxInputTokens2, embedTextForProject2, embedBatchForProject2, embedItemsForProject2, embedItemsWindowBounded2, countUnembeddedMemoriesForProject2, embedUnembeddedMemoriesForProject2, embedUnembeddedMemoriesForProjectOutcome2, drainCommitBacklogForProject2, embedUnembeddedCompartmentChunksForProject2, embedSessionCompartmentChunks2, getEmbeddingCoverageStatus2, getAutoEmbeddingSessionCoverage2, sweepAllRegisteredProjects2, _setTestProviderFactoryForProject2, _resetProjectEmbeddingRegistryForTests2 };
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  estimateTokens
3
- } from "./index-5vsk2cpp.js";
3
+ } from "./index-s7460efs.js";
4
4
  import {
5
5
  getTagById2
6
- } from "./index-60wnwcwz.js";
6
+ } from "./index-901exj0f.js";
7
7
  import {
8
8
  expandToolPart,
9
9
  visitRawSessionMessages2,
10
10
  readRawSessionMessageById2
11
- } from "./index-2qsca7h7.js";
11
+ } from "./index-5y9w2ax7.js";
12
12
 
13
13
  // src/tools/ctx-expand/render.ts
14
14
  import { createHash } from "node:crypto";
@@ -3,19 +3,19 @@ import {
3
3
  } from "./index-ywrz4wy2.js";
4
4
  import {
5
5
  clearEmergencyRecovery
6
- } from "./index-60wnwcwz.js";
6
+ } from "./index-901exj0f.js";
7
7
  import {
8
8
  requestPendingMaterialization,
9
9
  dropSlot
10
- } from "./index-h9hybzr5.js";
10
+ } from "./index-anwy2mfb.js";
11
11
  import {
12
12
  pausedRecompReason,
13
13
  executeContextRecomp
14
- } from "./index-q7msfgwz.js";
14
+ } from "./index-3f3d548g.js";
15
15
  import {
16
16
  renderUserFacingFailure,
17
17
  userFacingFailureCode
18
- } from "./index-39rzef89.js";
18
+ } from "./index-ydhymf0b.js";
19
19
 
20
20
  // src/hooks/magic-context/recomp-orchestrator.ts
21
21
  function resolveLiveModelKey(liveSessionState, sessionId) {
@@ -6,7 +6,7 @@ import {
6
6
  StaleRouteHandleError,
7
7
  SubcClient,
8
8
  isConsumerReconnectTransient
9
- } from "./index-pxnzyvjc.js";
9
+ } from "./index-6r99v53h.js";
10
10
  import {
11
11
  getHarness2
12
12
  } from "./index-pavzsdc6.js";
@@ -23,7 +23,7 @@ import {
23
23
  trackCompartmentChunkSearchPool2,
24
24
  peekCompartmentChunkSearchPool2,
25
25
  warmCompartmentChunkSearchPool2
26
- } from "./index-3pdknr07.js";
26
+ } from "./index-0twg41mh.js";
27
27
  import {
28
28
  saveCommitEmbedding,
29
29
  loadProjectCommitEmbeddings,
@@ -39,7 +39,7 @@ import {
39
39
  enqueueShadowEmbeddingItems2,
40
40
  getProjectEmbeddingSnapshot2,
41
41
  embedItemsForProject2
42
- } from "./index-2pdgy88n.js";
42
+ } from "./index-3n376ann.js";
43
43
  import {
44
44
  recordEmbeddingMeasurement
45
45
  } from "./index-2amn2s73.js";
@@ -55,7 +55,7 @@ import {
55
55
  sanitizeFtsQuery,
56
56
  searchMemoriesFTS,
57
57
  searchMemoriesFTSUnion
58
- } from "./index-39rzef89.js";
58
+ } from "./index-ydhymf0b.js";
59
59
  import {
60
60
  ModuleMemoryAuthorityError2,
61
61
  getMemoriesByProject2,
@@ -65,35 +65,35 @@ import {
65
65
  import {
66
66
  matchedSearchSnippet,
67
67
  getIndexedMessageCorpusSize
68
- } from "./index-chpzb6xy.js";
68
+ } from "./index-hre29c1a.js";
69
69
  import {
70
70
  getMessageIndexEpoch,
71
71
  isMessageIndexSearchable,
72
72
  withMemoryHintContent,
73
73
  autoSearchRelevance,
74
74
  recordAutoSearchLane
75
- } from "./index-zxhev8ze.js";
75
+ } from "./index-hbn5g7rt.js";
76
76
  import {
77
77
  ensureMemoryEmbeddings2
78
- } from "./index-w51n3576.js";
78
+ } from "./index-f25ha337.js";
79
79
  import {
80
80
  MESSAGE_FTS_SESSION_FILTER_SQL,
81
81
  withMessageFtsSessionFilter
82
82
  } from "./index-52x68mj4.js";
83
83
  import {
84
84
  isRecord
85
- } from "./index-60wnwcwz.js";
85
+ } from "./index-901exj0f.js";
86
86
  import {
87
87
  resolveWorkspaceShareCategories,
88
88
  resolveWorkspaceIdentitySet,
89
89
  expandWorkspaceIdentitySetWithAliases,
90
90
  resolveStoredPathWorkspaceIdentity,
91
91
  sourceNameForMemory
92
- } from "./index-tt0vs4x5.js";
92
+ } from "./index-jba6ny4m.js";
93
93
  import {
94
94
  getNotes,
95
95
  getActivePrimers
96
- } from "./index-61knrt52.js";
96
+ } from "./index-mjy2k9jr.js";
97
97
  import {
98
98
  isKnownAutocommit
99
99
  } from "./index-8ajstryz.js";
@@ -9,7 +9,7 @@ import {
9
9
  estimateMessageTokens,
10
10
  getCandidateToolOwners2,
11
11
  pickNearestPriorOwner2
12
- } from "./index-60wnwcwz.js";
12
+ } from "./index-901exj0f.js";
13
13
  import {
14
14
  OMO_INTERNAL_INITIATOR_MARKER,
15
15
  isSystemDirective,
@@ -24,10 +24,10 @@ import {
24
24
  formatBlock,
25
25
  compactTextForSummary,
26
26
  mergeCommitHashes
27
- } from "./index-5vsk2cpp.js";
27
+ } from "./index-s7460efs.js";
28
28
  import {
29
29
  stableStringify
30
- } from "./index-m6dnydf8.js";
30
+ } from "./index-mg9s2rc3.js";
31
31
  import {
32
32
  renderToolTemplate
33
33
  } from "./index-6nqz8hsz.js";
@@ -53,7 +53,7 @@ import {
53
53
  withReadOnlySessionDb,
54
54
  getRawSessionMessageCountFromDb,
55
55
  getMessageTimesFromOpenCodeDb
56
- } from "./index-x40zr813.js";
56
+ } from "./index-sp5pvs95.js";
57
57
  import {
58
58
  markHostUnservedRow,
59
59
  isHostUnservedRow
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  estimateTokens
3
- } from "./index-5vsk2cpp.js";
3
+ } from "./index-s7460efs.js";
4
4
  import {
5
5
  getHarness2
6
6
  } from "./index-pavzsdc6.js";
@@ -65,14 +65,14 @@ import {
65
65
  hasPendingMigrations,
66
66
  getMainThreadMigrationBodyCount,
67
67
  runMigrations
68
- } from "./index-tt0vs4x5.js";
68
+ } from "./index-jba6ny4m.js";
69
69
  import {
70
70
  installTagIdentityRevisionTrigger,
71
71
  ensureColumn,
72
72
  installV95PerfSchema,
73
73
  setDatabase,
74
74
  loadToolDefinitionMeasurements
75
- } from "./index-m6dnydf8.js";
75
+ } from "./index-mg9s2rc3.js";
76
76
  import {
77
77
  resolveOpenCodeDbPath,
78
78
  hasV1MessageTables
@@ -1084,7 +1084,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
1084
1084
  state.running = startMessageFtsRowidMapBackfill2(db, signal).then(async () => {
1085
1085
  if (signal.aborted || !readsOpenCodeStore)
1086
1086
  return;
1087
- const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-xv9f0wgb.js"));
1087
+ const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-y2ew3630.js"));
1088
1088
  const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-pz5981mf.js"));
1089
1089
  if (signal.aborted)
1090
1090
  return;
@@ -10,7 +10,7 @@ import {
10
10
  tokenCountUsesByteBound,
11
11
  estimateTokens,
12
12
  createTokenCountMemo
13
- } from "./index-5vsk2cpp.js";
13
+ } from "./index-s7460efs.js";
14
14
  import {
15
15
  getHarness2
16
16
  } from "./index-pavzsdc6.js";
@@ -25,7 +25,7 @@ import {
25
25
  getToolDefinitionMeasurementSignature,
26
26
  getMeasuredToolDefinitionTokens,
27
27
  getSessionToolDefinitionTokens
28
- } from "./index-m6dnydf8.js";
28
+ } from "./index-mg9s2rc3.js";
29
29
  import {
30
30
  resolveModelConfigValue,
31
31
  DEFAULT_PROTECTED_TOOLS,
@@ -3706,10 +3706,17 @@ function resolvedEmergencyDrainLatch(meta, usagePercentage, executeThresholdPerc
3706
3706
  function drainFailureBackoffActive(meta, now) {
3707
3707
  return meta.historianDrainFailureAt > 0 && meta.historianDrainFailureAt <= now && now - meta.historianDrainFailureAt < EMERGENCY_DRAIN_FAILURE_BACKOFF_MS;
3708
3708
  }
3709
+ function describeDrainSkip(meta, bypassSuspended) {
3710
+ const resetAt = meta.protectedTailDrainWindowStartedAt + DRAIN_WINDOW_MS;
3711
+ return bypassSuspended ? {
3712
+ reason: "failure-backoff",
3713
+ nextEligibleAt: Math.min(resetAt, meta.historianDrainFailureAt + EMERGENCY_DRAIN_FAILURE_BACKOFF_MS)
3714
+ } : { reason: "budget-spent", nextEligibleAt: resetAt };
3715
+ }
3709
3716
  function getProtectedTailDrainBudgetSkip(args) {
3710
3717
  const now = args.now ?? Date.now();
3711
3718
  const meta = loadProtectedTailMeta(args.db, args.sessionId);
3712
- const latch = resolvedEmergencyDrainLatch(meta, args.usagePercentage, args.executeThresholdPercentage, now);
3719
+ const latch = args.providerRecovery ? meta.emergencyDrainActive : resolvedEmergencyDrainLatch(meta, args.usagePercentage, args.executeThresholdPercentage, now);
3713
3720
  if (latch !== meta.emergencyDrainActive) {
3714
3721
  args.db.prepare("UPDATE session_meta SET emergency_drain_active = ? WHERE session_id = ? AND emergency_drain_active = ?").run(latch, args.sessionId, meta.emergencyDrainActive);
3715
3722
  }
@@ -3719,12 +3726,13 @@ function getProtectedTailDrainBudgetSkip(args) {
3719
3726
  const limitTokens = protectedTailWindowBudget(args.usagePercentage, args.usable, args.perRunCap);
3720
3727
  if (meta.protectedTailDrainTokens < limitTokens)
3721
3728
  return null;
3722
- if (latch > 0 && !drainFailureBackoffActive(meta, now))
3729
+ const bypassGranted = args.providerRecovery || latch > 0;
3730
+ if (bypassGranted && !drainFailureBackoffActive(meta, now))
3723
3731
  return null;
3724
3732
  return {
3733
+ ...describeDrainSkip(meta, bypassGranted),
3725
3734
  windowStartedAt: startedAt,
3726
3735
  resetsAt: startedAt + DRAIN_WINDOW_MS,
3727
- nextEligibleAt: latch > 0 ? Math.min(startedAt + DRAIN_WINDOW_MS, meta.historianDrainFailureAt + EMERGENCY_DRAIN_FAILURE_BACKOFF_MS) : startedAt + DRAIN_WINDOW_MS,
3728
3736
  resetInMs: startedAt + DRAIN_WINDOW_MS - now,
3729
3737
  spentTokens: meta.protectedTailDrainTokens,
3730
3738
  limitTokens
@@ -3761,17 +3769,17 @@ function reserveProtectedTailDrainTokens(args) {
3761
3769
  WHERE session_id = ?`).run(now, args.sessionId);
3762
3770
  meta = loadProtectedTailMeta(args.db, args.sessionId);
3763
3771
  }
3764
- const latchActiveSince = resolvedEmergencyDrainLatch(meta, args.usagePercentage, args.executeThresholdPercentage, now);
3772
+ const latchActiveSince = args.providerRecovery ? meta.emergencyDrainActive : resolvedEmergencyDrainLatch(meta, args.usagePercentage, args.executeThresholdPercentage, now);
3765
3773
  if (latchActiveSince !== meta.emergencyDrainActive) {
3766
3774
  args.db.prepare("UPDATE session_meta SET emergency_drain_active = ? WHERE session_id = ?").run(latchActiveSince, args.sessionId);
3767
3775
  }
3768
- const latchActive = latchActiveSince > 0;
3776
+ const bypassGranted = args.providerRecovery || latchActiveSince > 0;
3769
3777
  const budget = protectedTailWindowBudget(args.usagePercentage, args.usable, args.perRunCap);
3770
3778
  const remaining = Math.max(0, budget - meta.protectedTailDrainTokens);
3771
3779
  let reserved = Math.min(requested, args.perRunCap, remaining);
3772
3780
  let bypass = false;
3773
3781
  const inFailureBackoff = drainFailureBackoffActive(meta, now);
3774
- if (reserved <= 0 && latchActive && !inFailureBackoff) {
3782
+ if (reserved <= 0 && bypassGranted && !inFailureBackoff) {
3775
3783
  reserved = Math.min(requested, args.perRunCap);
3776
3784
  bypass = true;
3777
3785
  }
@@ -3786,7 +3794,8 @@ function reserveProtectedTailDrainTokens(args) {
3786
3794
  if (reserved <= 0) {
3787
3795
  result = {
3788
3796
  ...result,
3789
- budgetState: budgetState(meta.protectedTailDrainTokens)
3797
+ budgetState: budgetState(meta.protectedTailDrainTokens),
3798
+ drainSkip: describeDrainSkip(meta, bypassGranted && inFailureBackoff)
3790
3799
  };
3791
3800
  return;
3792
3801
  }
@@ -5118,9 +5127,13 @@ function markDropLeavesReasoning(db, sessionId) {
5118
5127
  // src/features/magic-context/overflow-detection.ts
5119
5128
  var TOKEN_COUNT = String.raw`(?<![\d+_-])(?:\d+(?:[,_ .\u202f]+\d+)*(?=\s*tokens?\b)|\d+(?:[,_ \u202f]+\d+)*)(?!\w|[,_\s.]+\d)`;
5120
5129
  var ESTIMATED_REQUEST = String.raw`\bthis request has an estimated\b`;
5130
+ var COLD_REQUEST_CODE = "cold_request_too_large";
5131
+ var COLD_START = String.raw`\btoo large to start a new session\b`;
5132
+ var COLD_BATCH = String.raw`\badds about ${TOKEN_COUNT} new tokens to the session at once\b`;
5121
5133
  function overflowPattern(strings, ...fragments) {
5122
5134
  return new RegExp(String.raw(strings, ...fragments), "i");
5123
5135
  }
5136
+ var COLD_REQUEST_LIMIT = overflowPattern`(?:${COLD_START}|${COLD_BATCH})\s*\(limit\s+(${TOKEN_COUNT})(?:\s+per request)?\s*\)`;
5124
5137
  var OVERFLOW_PATTERNS = [
5125
5138
  /prompt is too long/i,
5126
5139
  /input is too long for requested model/i,
@@ -5146,7 +5159,10 @@ var OVERFLOW_PATTERNS = [
5146
5159
  /model_context_window_exceeded/i,
5147
5160
  /context size has been exceeded/i,
5148
5161
  /prepared prompt exceeds engine max_context/i,
5149
- /prompt exceeds (?:the )?.{0,32}\bmax_context\b/i
5162
+ /prompt exceeds (?:the )?.{0,32}\bmax_context\b/i,
5163
+ overflowPattern`${COLD_START}`,
5164
+ overflowPattern`${COLD_BATCH}`,
5165
+ overflowPattern`\b${COLD_REQUEST_CODE}\b`
5150
5166
  ];
5151
5167
  var LIMIT_EXTRACTION_PATTERNS = [
5152
5168
  {
@@ -5199,6 +5215,10 @@ var LIMIT_EXTRACTION_PATTERNS = [
5199
5215
  pattern: overflowPattern`\ballows a context of up to (${TOKEN_COUNT}) tokens?\b`,
5200
5216
  provenance: "combined"
5201
5217
  },
5218
+ {
5219
+ pattern: COLD_REQUEST_LIMIT,
5220
+ provenance: "prompt_only"
5221
+ },
5202
5222
  {
5203
5223
  pattern: overflowPattern`(?<!${ESTIMATED_REQUEST}\s+)\bup to (${TOKEN_COUNT}) tokens?\b`,
5204
5224
  provenance: "unknown"
@@ -5271,6 +5291,29 @@ function extractExplicitHttpStatus(error) {
5271
5291
  }
5272
5292
  return;
5273
5293
  }
5294
+ function hasColdRequestEnvelopeCode(value) {
5295
+ if (!value || typeof value !== "object")
5296
+ return false;
5297
+ const record = value;
5298
+ return record.code === COLD_REQUEST_CODE || record.error?.code === COLD_REQUEST_CODE;
5299
+ }
5300
+ function hasColdRequestBodyCode(body) {
5301
+ if (typeof body !== "string" || !body.trimStart().startsWith("{"))
5302
+ return false;
5303
+ try {
5304
+ return hasColdRequestEnvelopeCode(JSON.parse(body));
5305
+ } catch {
5306
+ return false;
5307
+ }
5308
+ }
5309
+ function hasColdRequestCode(error) {
5310
+ if (typeof error === "string")
5311
+ return hasColdRequestBodyCode(error);
5312
+ if (!error || typeof error !== "object")
5313
+ return false;
5314
+ const record = error;
5315
+ return hasColdRequestEnvelopeCode(error) || hasColdRequestBodyCode(record.response?.body) || hasColdRequestBodyCode(record.data?.responseBody);
5316
+ }
5274
5317
  function detectThinkingBindingMismatch(error) {
5275
5318
  const message = extractErrorMessage(error);
5276
5319
  const explicitStatus = extractExplicitHttpStatus(error);
@@ -5312,30 +5355,51 @@ function isFable51ThinkingBindingModel(providerID, modelID) {
5312
5355
  }
5313
5356
  function detectOverflow(error) {
5314
5357
  const message = extractErrorMessage(error);
5315
- if (!message) {
5316
- return { isOverflow: false };
5317
- }
5318
5358
  const hasStatus413 = /\b413\b/.test(message) && /(entity|payload|context|prompt)/i.test(message);
5319
- let matched;
5320
- for (const pattern of OVERFLOW_PATTERNS) {
5321
- if (pattern.test(message)) {
5322
- matched = pattern;
5323
- break;
5324
- }
5325
- }
5326
- if (!matched && !hasStatus413) {
5359
+ const matched = OVERFLOW_PATTERNS.find((pattern) => pattern.test(message));
5360
+ if (!matched && !hasStatus413 && !hasColdRequestCode(error)) {
5327
5361
  return { isOverflow: false };
5328
5362
  }
5329
- const reportedLimit = parseReportedLimit(message);
5363
+ const reportedLimit = matchReportedLimit(message);
5330
5364
  const reportedInputTokens = parseReportedInputTokens(message);
5331
5365
  return {
5332
5366
  isOverflow: true,
5333
5367
  reportedInputTokens,
5334
5368
  reportedLimit: reportedLimit?.value,
5335
5369
  reportedLimitProvenance: reportedLimit?.provenance,
5370
+ ...reportedLimit?.pattern === COLD_REQUEST_LIMIT ? { coldRequestCap: true } : {},
5336
5371
  matchedPattern: matched?.source
5337
5372
  };
5338
5373
  }
5374
+ function overflowLimitToStore(detection, resolveCurrentUsableWindow) {
5375
+ const limit = detection.reportedLimit;
5376
+ if (limit === undefined || !detection.coldRequestCap)
5377
+ return limit;
5378
+ const current = resolveCurrentUsableWindow();
5379
+ return current !== undefined && Number.isFinite(current) && limit < current ? limit : undefined;
5380
+ }
5381
+ function isProviderRateLimit(error) {
5382
+ const pending = [error];
5383
+ const seen = new Set;
5384
+ for (let visited = 0;pending.length && visited < 16; ) {
5385
+ const value = pending.shift();
5386
+ if (value === undefined || value === null || value === "" || seen.has(value))
5387
+ continue;
5388
+ seen.add(value);
5389
+ visited++;
5390
+ if (typeof value === "string") {
5391
+ try {
5392
+ pending.push(JSON.parse(value));
5393
+ } catch {}
5394
+ } else if (value && typeof value === "object") {
5395
+ const p = value;
5396
+ if (p.status === 429 || p.statusCode === 429 || [p.type, p.name, p.code, p._tag].some((tag) => typeof tag === "string" && /rate[_ .-]?limit|throttl/i.test(tag)))
5397
+ return true;
5398
+ pending.push(p.data, p.error, p.cause, p.responseBody);
5399
+ }
5400
+ }
5401
+ return false;
5402
+ }
5339
5403
  var INPUT_EXTRACTION_PATTERNS = [
5340
5404
  overflowPattern`prompt is too long:\s*(${TOKEN_COUNT})`,
5341
5405
  overflowPattern`input token count\s*\(?\s*(${TOKEN_COUNT})`,
@@ -5344,7 +5408,8 @@ var INPUT_EXTRACTION_PATTERNS = [
5344
5408
  overflowPattern`messages resulted in\s*(${TOKEN_COUNT})\s*tokens?\b`,
5345
5409
  overflowPattern`\bthe input \((${TOKEN_COUNT}) tokens?\) is longer than the model's context length \(${TOKEN_COUNT} tokens?\)`,
5346
5410
  overflowPattern`\(\s*(${TOKEN_COUNT})\s+in the messages,\s*${TOKEN_COUNT}\s+in the completion\s*\)`,
5347
- overflowPattern`${ESTIMATED_REQUEST}\s+(${TOKEN_COUNT})`
5411
+ overflowPattern`${ESTIMATED_REQUEST}\s+(${TOKEN_COUNT})`,
5412
+ overflowPattern`\bat about (${TOKEN_COUNT}) tokens?,\s*this request is ${COLD_START}`
5348
5413
  ];
5349
5414
  function parseReportedInputTokens(message) {
5350
5415
  if (!message)
@@ -5356,14 +5421,14 @@ function parseReportedInputTokens(message) {
5356
5421
  }
5357
5422
  return;
5358
5423
  }
5359
- function parseReportedLimit(message) {
5424
+ function matchReportedLimit(message) {
5360
5425
  if (!message)
5361
5426
  return;
5362
5427
  for (const { pattern, provenance } of LIMIT_EXTRACTION_PATTERNS) {
5363
5428
  const value = parseTokenCount(message.match(pattern)?.[1]);
5364
5429
  if (value === null || value < MIN_PLAUSIBLE_LIMIT || value > MAX_PLAUSIBLE_LIMIT)
5365
5430
  continue;
5366
- return { value, provenance };
5431
+ return { value, provenance, pattern };
5367
5432
  }
5368
5433
  return;
5369
5434
  }
@@ -8958,4 +9023,4 @@ function deleteToolTagsByOwner(db, sessionId, ownerMsgId) {
8958
9023
  return getDeleteToolTagsByOwnerStatement(db).all(sessionId, ownerMsgId).length;
8959
9024
  }
8960
9025
 
8961
- export { protectedToolTagNumbers, protectedToolTokenCount, stripWellFormedLeadingTagPrefix, stripPersistedAssistantText, byteSize, stripTagPrefix, peelLeadingMcTagNotation, prependTag, isThinkingPart, currentReclaimableToolOutputCount, isRecord, contentTagOwnerMessageId, estimateImageTokensFromDataUrl, estimateToolAttachmentImageTokens, providerVisiblePart, providerVisibleMessage, CLEARED_TODO_STATE_JSON, normalizeTodoStateJson, buildSyntheticTodoPart, computeSyntheticCallId, isSyntheticTodoPart, countRealUserMessages, tailHygieneStructuralSignature, sameTailHygieneStructuralSignature, formatTailHygienePrefixMismatch, refreshTailHygieneBaseline, effectiveTailHygiene, assertTailHygieneContentUnchangedIfEnabled, CHANNEL1_SENTINEL, CHANNEL1_FLOOR_TOKENS, isDroppedToolOutput, toolOutputTokens, decideChannel1, evaluateChannel2, formatChannel1Evaluation, formatChannel2Evaluation, buildChannel2Reminder, buildChannel1Reminder, createFinalWireIncompleteLogger, MERGED_REASONING_PARTS_PREFIX, decodeMergedReasoningParts, readFrozenMergedReasoningParts, MAX_EXECUTE_THRESHOLD, escalationBands, HYGIENE_PROVIDER_UNITS_VERSION, sessionDecisionCalibration, transitionSessionHygieneUnits, readEpochFloorSnapshot, getProtectionWindowForSession, CACHED_TRIM_PARTIAL_SQL, SESSION_META_SELECT_COLUMNS, META_COLUMNS, BOOLEAN_META_KEYS, NULL_BIND_META_KEYS, isSessionMetaRow, getDefaultSessionMeta, ensureSessionMetaRow, toSessionMeta, persistCachedM0, clearCachedM0M1, clearCachedM0, withReplayEnvelopeSnapshot, invalidateReplayEnvelopeSnapshot, isRustMarkerAdmissionFenced, setRustMarkerAdmissionFence, ReplayDocumentError, readReplayEnvelope, readReplayDocument, updateReplayDocument, writeReplayDocument, isEmergencyRecoveryArmed, isProviderOverflowReconfirmed, isProviderOverflowFailClosedProven, getEmergencyRecoveryArmedAt, describeProtectedTailDrainBudgetSkip, loadPersistedUsage, loadProtectedTailMeta, markProtectedTailPolicyV3Seeded, recordProtectedTailPublicationFloor, recordProtectedTailNoEligibleHead, resetProtectedTailNoEligibleHead, getWrapupInProgressState, isWrapupInProgress, acquireWrapupInProgress, updateWrapupInProgress, releaseWrapupInProgress, resolveCompactionModeRecord, getCompactionModeRecord, setCompactionModeRecord, getProtectedTailDrainBudgetSkip, reserveProtectedTailDrainTokens, clearEmergencyDrainLatch, recordHistorianDrainFailure, clearHistorianDrainFailure, rollbackProtectedTailDrainReservation, getPersistedReasoningWatermark, setPersistedReasoningWatermark, clearPersistedReasoningWatermark, getEmergencyInputSample, setEmergencyDropSample, clearEmergencyDropSample, getLastNudgeUndropped, setLastNudgeUndropped, getChannel1NudgeState, setChannel1NudgeState, markChannel1PostReduceGracePending, captureChannel1PostReduceGraceBaseline, getChannel2NudgeState, getChannel2NudgeClaim, setChannel2NudgeState, casChannel2NudgeState, claimChannel2NudgeState, casChannel2NudgeClaim, getPersistedNoteNudge, setPersistedNoteNudgeTrigger, setPersistedNoteNudgeTriggerMessageId, getNoteNudgeAnchors, getAutoSearchHintDecisions, deliverNoteNudgeAtomic, appendAutoSearchHintDecision, pruneNoteNudgeAnchors, removeNoteNudgeAnchorByMessageId, pruneAutoSearchHintDecisions, queueAutoSearchHintDecisionRetirement, flushAutoSearchHintDecisionRetirement, removeAutoSearchHintDecisionByMessageId, getPersistedTodoPermissionDenied, setPersistedTodoPermissionDenied, getPersistedTodoSyntheticAnchor, setPersistedTodoSyntheticAnchor, clearPersistedTodoSyntheticAnchor, getNoteLastReadAt, setNoteLastReadAt, getHistorianFailureState, incrementHistorianFailure, clearHistorianFailureState, getOverflowState, loadTransformPassStateSnapshot, recordOverflowDetected, recordDetectedContextLimit, clearEmergencyRecovery, clearDetectedContextLimit, getPersistedCompactionMarkerState, getCompactionMarkerPublicationState, compareAndSetCompactionMarkerPublicationState, setPersistedCompactionMarkerState, getDeferredClearedCompactionMarkerState, retireDeferredClearedCompactionMarkerState, parseStrippedPlaceholderState, serializeStrippedPlaceholderState, getStrippedPlaceholderIds, applyStrippedPlaceholderDelta, removeStrippedPlaceholderId, THINKING_BINDING_RECOVERY_FROZEN_PREFIX, THINKING_BINDING_STRIP_ORDER_END_MARKER, thinkingBindingRecoveryFrozenId, COMPACTION_OFF_THINKING_FROZEN_PREFIX, compactionOffThinkingFrozenId, compactionOffFrozenThinkingIds, getThinkingBindingRecoveryTarget, armThinkingBindingRecovery, noteBindingRecoveryAwaitingClear, bindingRecoveryAwaitingClear, retryBindingRecoveryClear, clearThinkingBindingRecoveryIf, getMergedReasoningStrippedIds, addMergedReasoningStrippedIds, getTrailingBlankDecisions, addTrailingBlankDecisions, demoteTrailingBlankKeepDecisions, getStaleReduceStrippedIds, addStaleReduceStrippedIds, getProcessedImageStrippedIds, parseProcessedImageMarkers, serializeProcessedImageMarkers, getProcessedImageMarkers, addProcessedImageStrippedIds, getPendingCompactionMarkerState, getCompactionMarkerHealth, loadPostprocessReplaySnapshot, setPendingCompactionMarkerState, replacePendingCompactionMarkerStateIf, clearPendingCompactionMarkerStateIf, getPendingPiCompactionMarkerState, clearPendingPiCompactionMarkerStateIf, logPiCompactionMarkerClear, getSessionsWithPendingMarker, cachedHeadCoversPendingCompactionMarker, getObservedEpochFloor, resolveEpochFloorForPass, getReasoningRemovalState, addRemovedReasoningIds, markDropLeavesReasoning, detectThinkingBindingMismatch, detectLatestTurnThinkingMismatch, isPrefixBoundThinkingModel, detectOverflow, modelAcceptsEmptyContent, isAnthropicFamilyRoute, neutralizeDroppedReasoningPart, restoreNeutralizedReasoningPart, isNeutralizedReasoningPart, variantChangeBustsProviderCache, makeSentinel, makeWholeMessageSentinel, isSentinel, replaySentinelByMessageIds, isInActiveAnthropicTurn, activeAnthropicTurnStart, hasAnthropicReasoning, markServedShapeRepair, prepareServedShapeRepair, stripSystemInjectedMessages, stripDroppedPlaceholderMessages, replayClearedReasoning, replayStrippedInlineThinking, clearOldReasoning, stripClearedReasoning, captureInlineThinkingRepairs, stripInlineThinking, findReasoningBearingAssistantIds, findLatestAssistantReasoningMutationExemptMessage, snapshotTrailingBlankSourceDecisions, findTrailingBlankDecisionCandidates, applyFrozenTrailingBlankDecisions, stripReasoningFromAssistantIds, findMergedReasoningStripDecisions, stripReasoningFromMergedAssistants, getEmptyImageParts, stripProcessedImages, projectOpencodeReasoningBudgetCutoff, DEFAULT_KEEP_REASONING_TOKENS, resolveKeepReasoningTokens, reasoningStepCost, reasoningBudgetCutoff, reasoningTextAndOpaque, opencodeReasoningBudgetCutoff, describeFinalWireTail, estimatePartImageTokens, openCode2ThinkingPayload, estimateMessageTokens, wireContentBytes, createFinalWireUsageTracker, estimateFinalWireInputTokens, estimateAppendedWireTokens, estimateEmergencyDropReclaimTokens, planEmergencyDrop, measureEmergencyTag, snapshotEmergencyServedMass, tagsSinceReading, emergencyServedMassRemovedSince, queuePendingOp, queuePendingDropForUnchangedTag, getPendingOps, hasPendingDropOps, getPendingOpsCount, clearPendingOps, removePendingOp, updateTagByteSize2, getRecentTagOwnerMessageIds2, getActiveTagTokenAggregate2, AGE_RECLAIM_MIN_TOKENS2, getOldestActiveUnprotectedToolTags2, getActiveToolTagsForAgeReclaim2, getTriggerTagTokenUpperBound2, getActiveTagTokenTotalsByMessage2, updateTagTokenCount2, getPersistedToolTagAccounting2, getAllStatusTagTokenTotalsFlat2, getReasoningTokenEstimatesByMessage2, tryGetReasoningTokenEstimatesByMessage2, getMaxTagNumberByOwnerMessage2, TagOwnerSummaryNotReady2, scanTagOwnerSummary2, cachedTagOwnerRatios2, tagOwnerWarmupState2, scanTagOwnerDelta2, installTagOwnerDelta2, installTagOwnerSummary2, isTagOwnerSummaryReady2, tagTokenCountIsNull2, backfillTagTokenCounts2, insertTag2, updateTagStatus2, markTagDropped2, markWhitespaceAssistantTagInert2, getInertWhitespaceAssistantTags2, getInertWhitespaceAssistantTagsByNumbers2, updateTagDropMode2, updateCavemanDepth2, updateTagMessageId2, hasPiFallbackMessageTags2, findAdoptableFallbackTags2, adoptFallbackTagMessageId2, foldShrunkPartTags2, hasPiFallbackToolOwnerTags2, findPiFallbackToolOwnerTags2, adoptPiFallbackToolOwnerTag2, adoptPiFallbackMessageTag2, markTagsCompactedByMessageIds2, deleteTagsByMessageId2, getMaxTagNumberBySession2, getTagNumberByMessageId2, getAssignableTagNumberByMessageId2, getMinMessageTagNumberForRawId2, deriveTagLoadFloor2, TAG_SELECT_COLUMNS2, getTagsBySession2, getActiveTagsBySession2, getTailHygieneTags2, getDroppedTagsBySession2, getTagsForPendingOperations2, getTagsByNumbers2, getNewestToolTagNumbers2, getDroppedTagsByNumbers2, getMaxDroppedTagNumber2, getTagById2, getTopNBySize2, getToolTagNumberByOwner2, getNullOwnerToolTag2, adoptNullOwnerToolTag2, getCandidateToolOwners2, pickNearestPriorOwner2 };
9026
+ export { protectedToolTagNumbers, protectedToolTokenCount, stripWellFormedLeadingTagPrefix, stripPersistedAssistantText, byteSize, stripTagPrefix, peelLeadingMcTagNotation, prependTag, isThinkingPart, currentReclaimableToolOutputCount, isRecord, contentTagOwnerMessageId, estimateImageTokensFromDataUrl, estimateToolAttachmentImageTokens, providerVisiblePart, providerVisibleMessage, CLEARED_TODO_STATE_JSON, normalizeTodoStateJson, buildSyntheticTodoPart, computeSyntheticCallId, isSyntheticTodoPart, countRealUserMessages, tailHygieneStructuralSignature, sameTailHygieneStructuralSignature, formatTailHygienePrefixMismatch, refreshTailHygieneBaseline, effectiveTailHygiene, assertTailHygieneContentUnchangedIfEnabled, CHANNEL1_SENTINEL, CHANNEL1_FLOOR_TOKENS, isDroppedToolOutput, toolOutputTokens, decideChannel1, evaluateChannel2, formatChannel1Evaluation, formatChannel2Evaluation, buildChannel2Reminder, buildChannel1Reminder, createFinalWireIncompleteLogger, MERGED_REASONING_PARTS_PREFIX, decodeMergedReasoningParts, readFrozenMergedReasoningParts, MAX_EXECUTE_THRESHOLD, escalationBands, HYGIENE_PROVIDER_UNITS_VERSION, sessionDecisionCalibration, transitionSessionHygieneUnits, readEpochFloorSnapshot, getProtectionWindowForSession, CACHED_TRIM_PARTIAL_SQL, SESSION_META_SELECT_COLUMNS, META_COLUMNS, BOOLEAN_META_KEYS, NULL_BIND_META_KEYS, isSessionMetaRow, getDefaultSessionMeta, ensureSessionMetaRow, toSessionMeta, persistCachedM0, clearCachedM0M1, clearCachedM0, withReplayEnvelopeSnapshot, invalidateReplayEnvelopeSnapshot, isRustMarkerAdmissionFenced, setRustMarkerAdmissionFence, ReplayDocumentError, readReplayEnvelope, readReplayDocument, updateReplayDocument, writeReplayDocument, isEmergencyRecoveryArmed, isProviderOverflowReconfirmed, isProviderOverflowFailClosedProven, getEmergencyRecoveryArmedAt, describeProtectedTailDrainBudgetSkip, loadPersistedUsage, loadProtectedTailMeta, markProtectedTailPolicyV3Seeded, recordProtectedTailPublicationFloor, recordProtectedTailNoEligibleHead, resetProtectedTailNoEligibleHead, getWrapupInProgressState, isWrapupInProgress, acquireWrapupInProgress, updateWrapupInProgress, releaseWrapupInProgress, resolveCompactionModeRecord, getCompactionModeRecord, setCompactionModeRecord, getProtectedTailDrainBudgetSkip, reserveProtectedTailDrainTokens, clearEmergencyDrainLatch, recordHistorianDrainFailure, clearHistorianDrainFailure, rollbackProtectedTailDrainReservation, getPersistedReasoningWatermark, setPersistedReasoningWatermark, clearPersistedReasoningWatermark, getEmergencyInputSample, setEmergencyDropSample, clearEmergencyDropSample, getLastNudgeUndropped, setLastNudgeUndropped, getChannel1NudgeState, setChannel1NudgeState, markChannel1PostReduceGracePending, captureChannel1PostReduceGraceBaseline, getChannel2NudgeState, getChannel2NudgeClaim, setChannel2NudgeState, casChannel2NudgeState, claimChannel2NudgeState, casChannel2NudgeClaim, getPersistedNoteNudge, setPersistedNoteNudgeTrigger, setPersistedNoteNudgeTriggerMessageId, getNoteNudgeAnchors, getAutoSearchHintDecisions, deliverNoteNudgeAtomic, appendAutoSearchHintDecision, pruneNoteNudgeAnchors, removeNoteNudgeAnchorByMessageId, pruneAutoSearchHintDecisions, queueAutoSearchHintDecisionRetirement, flushAutoSearchHintDecisionRetirement, removeAutoSearchHintDecisionByMessageId, getPersistedTodoPermissionDenied, setPersistedTodoPermissionDenied, getPersistedTodoSyntheticAnchor, setPersistedTodoSyntheticAnchor, clearPersistedTodoSyntheticAnchor, getNoteLastReadAt, setNoteLastReadAt, getHistorianFailureState, incrementHistorianFailure, clearHistorianFailureState, getOverflowState, loadTransformPassStateSnapshot, recordOverflowDetected, recordDetectedContextLimit, clearEmergencyRecovery, clearDetectedContextLimit, getPersistedCompactionMarkerState, getCompactionMarkerPublicationState, compareAndSetCompactionMarkerPublicationState, setPersistedCompactionMarkerState, getDeferredClearedCompactionMarkerState, retireDeferredClearedCompactionMarkerState, parseStrippedPlaceholderState, serializeStrippedPlaceholderState, getStrippedPlaceholderIds, applyStrippedPlaceholderDelta, removeStrippedPlaceholderId, THINKING_BINDING_RECOVERY_FROZEN_PREFIX, THINKING_BINDING_STRIP_ORDER_END_MARKER, thinkingBindingRecoveryFrozenId, COMPACTION_OFF_THINKING_FROZEN_PREFIX, compactionOffThinkingFrozenId, compactionOffFrozenThinkingIds, getThinkingBindingRecoveryTarget, armThinkingBindingRecovery, noteBindingRecoveryAwaitingClear, bindingRecoveryAwaitingClear, retryBindingRecoveryClear, clearThinkingBindingRecoveryIf, getMergedReasoningStrippedIds, addMergedReasoningStrippedIds, getTrailingBlankDecisions, addTrailingBlankDecisions, demoteTrailingBlankKeepDecisions, getStaleReduceStrippedIds, addStaleReduceStrippedIds, getProcessedImageStrippedIds, parseProcessedImageMarkers, serializeProcessedImageMarkers, getProcessedImageMarkers, addProcessedImageStrippedIds, getPendingCompactionMarkerState, getCompactionMarkerHealth, loadPostprocessReplaySnapshot, setPendingCompactionMarkerState, replacePendingCompactionMarkerStateIf, clearPendingCompactionMarkerStateIf, getPendingPiCompactionMarkerState, clearPendingPiCompactionMarkerStateIf, logPiCompactionMarkerClear, getSessionsWithPendingMarker, cachedHeadCoversPendingCompactionMarker, getObservedEpochFloor, resolveEpochFloorForPass, getReasoningRemovalState, addRemovedReasoningIds, markDropLeavesReasoning, detectThinkingBindingMismatch, detectLatestTurnThinkingMismatch, isPrefixBoundThinkingModel, detectOverflow, overflowLimitToStore, isProviderRateLimit, modelAcceptsEmptyContent, isAnthropicFamilyRoute, neutralizeDroppedReasoningPart, restoreNeutralizedReasoningPart, isNeutralizedReasoningPart, variantChangeBustsProviderCache, makeSentinel, makeWholeMessageSentinel, isSentinel, replaySentinelByMessageIds, isInActiveAnthropicTurn, activeAnthropicTurnStart, hasAnthropicReasoning, markServedShapeRepair, prepareServedShapeRepair, stripSystemInjectedMessages, stripDroppedPlaceholderMessages, replayClearedReasoning, replayStrippedInlineThinking, clearOldReasoning, stripClearedReasoning, captureInlineThinkingRepairs, stripInlineThinking, findReasoningBearingAssistantIds, findLatestAssistantReasoningMutationExemptMessage, snapshotTrailingBlankSourceDecisions, findTrailingBlankDecisionCandidates, applyFrozenTrailingBlankDecisions, stripReasoningFromAssistantIds, findMergedReasoningStripDecisions, stripReasoningFromMergedAssistants, getEmptyImageParts, stripProcessedImages, projectOpencodeReasoningBudgetCutoff, DEFAULT_KEEP_REASONING_TOKENS, resolveKeepReasoningTokens, reasoningStepCost, reasoningBudgetCutoff, reasoningTextAndOpaque, opencodeReasoningBudgetCutoff, describeFinalWireTail, estimatePartImageTokens, openCode2ThinkingPayload, estimateMessageTokens, wireContentBytes, createFinalWireUsageTracker, estimateFinalWireInputTokens, estimateAppendedWireTokens, estimateEmergencyDropReclaimTokens, planEmergencyDrop, measureEmergencyTag, snapshotEmergencyServedMass, tagsSinceReading, emergencyServedMassRemovedSince, queuePendingOp, queuePendingDropForUnchangedTag, getPendingOps, hasPendingDropOps, getPendingOpsCount, clearPendingOps, removePendingOp, updateTagByteSize2, getRecentTagOwnerMessageIds2, getActiveTagTokenAggregate2, AGE_RECLAIM_MIN_TOKENS2, getOldestActiveUnprotectedToolTags2, getActiveToolTagsForAgeReclaim2, getTriggerTagTokenUpperBound2, getActiveTagTokenTotalsByMessage2, updateTagTokenCount2, getPersistedToolTagAccounting2, getAllStatusTagTokenTotalsFlat2, getReasoningTokenEstimatesByMessage2, tryGetReasoningTokenEstimatesByMessage2, getMaxTagNumberByOwnerMessage2, TagOwnerSummaryNotReady2, scanTagOwnerSummary2, cachedTagOwnerRatios2, tagOwnerWarmupState2, scanTagOwnerDelta2, installTagOwnerDelta2, installTagOwnerSummary2, isTagOwnerSummaryReady2, tagTokenCountIsNull2, backfillTagTokenCounts2, insertTag2, updateTagStatus2, markTagDropped2, markWhitespaceAssistantTagInert2, getInertWhitespaceAssistantTags2, getInertWhitespaceAssistantTagsByNumbers2, updateTagDropMode2, updateCavemanDepth2, updateTagMessageId2, hasPiFallbackMessageTags2, findAdoptableFallbackTags2, adoptFallbackTagMessageId2, foldShrunkPartTags2, hasPiFallbackToolOwnerTags2, findPiFallbackToolOwnerTags2, adoptPiFallbackToolOwnerTag2, adoptPiFallbackMessageTag2, markTagsCompactedByMessageIds2, deleteTagsByMessageId2, getMaxTagNumberBySession2, getTagNumberByMessageId2, getAssignableTagNumberByMessageId2, getMinMessageTagNumberForRawId2, deriveTagLoadFloor2, TAG_SELECT_COLUMNS2, getTagsBySession2, getActiveTagsBySession2, getTailHygieneTags2, getDroppedTagsBySession2, getTagsForPendingOperations2, getTagsByNumbers2, getNewestToolTagNumbers2, getDroppedTagsByNumbers2, getMaxDroppedTagNumber2, getTagById2, getTopNBySize2, getToolTagNumberByOwner2, getNullOwnerToolTag2, adoptNullOwnerToolTag2, getCandidateToolOwners2, pickNearestPriorOwner2 };
@@ -10,7 +10,7 @@ import {
10
10
  } from "./index-e6ncz7a6.js";
11
11
  import {
12
12
  shouldHoldIgnoredNotification
13
- } from "./index-x40zr813.js";
13
+ } from "./index-sp5pvs95.js";
14
14
  import {
15
15
  getErrorMessage
16
16
  } from "./index-y8v6yerm.js";
@@ -7,7 +7,7 @@ import {
7
7
  deleteTagIdentityRevisions,
8
8
  getTableColumnNames,
9
9
  getMeasuredToolDefinitionTokens
10
- } from "./index-m6dnydf8.js";
10
+ } from "./index-mg9s2rc3.js";
11
11
  import {
12
12
  invalidateAutoEmbedSession,
13
13
  drainBackgroundBatches
@@ -31,7 +31,7 @@ import {
31
31
  } from "./index-s32f8y67.js";
32
32
  import {
33
33
  deleteChunkEmbedBackoffForSession2
34
- } from "./index-3pdknr07.js";
34
+ } from "./index-0twg41mh.js";
35
35
  import {
36
36
  isPidAlive,
37
37
  readProcessStartTime
@@ -68,14 +68,14 @@ import {
68
68
  getPendingPiCompactionMarkerState,
69
69
  logPiCompactionMarkerClear,
70
70
  isPrefixBoundThinkingModel
71
- } from "./index-60wnwcwz.js";
71
+ } from "./index-901exj0f.js";
72
72
  import {
73
73
  withReadOnlySessionDb
74
- } from "./index-x40zr813.js";
74
+ } from "./index-sp5pvs95.js";
75
75
  import {
76
76
  layoutLkgPrefix,
77
77
  assembleLkgPrefix
78
- } from "./index-tt0vs4x5.js";
78
+ } from "./index-jba6ny4m.js";
79
79
  import {
80
80
  ensurePrivateStorageDirectorySync,
81
81
  writeStorageFileSync,
@@ -86,7 +86,7 @@ import {
86
86
  import {
87
87
  gaDatabasePath2,
88
88
  V2StoreReader2
89
- } from "./index-1y4y98r1.js";
89
+ } from "./index-01h7tqe3.js";
90
90
  import {
91
91
  markHostInstructionRow,
92
92
  hostInstructionRowID,
@@ -4,7 +4,7 @@ import {
4
4
  } from "./index-ywrz4wy2.js";
5
5
  import {
6
6
  sendStatusNotification2
7
- } from "./index-6zewd2n5.js";
7
+ } from "./index-9ffntwyr.js";
8
8
  import {
9
9
  formatConflictShort
10
10
  } from "./index-nxxzeq4y.js";
@@ -10,7 +10,7 @@ import {
10
10
  readSearchBackfillCursor2,
11
11
  writeSearchBackfillCursor2,
12
12
  embedItemsWindowBounded2
13
- } from "./index-2pdgy88n.js";
13
+ } from "./index-3n376ann.js";
14
14
  import {
15
15
  saveEmbeddingIfHashMatches
16
16
  } from "./index-qjwpqvnf.js";