@cortexkit/opencode-magic-context 0.49.86 → 0.49.89

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 (182) hide show
  1. package/dist/{announcement-fnyxaahs.js → announcement-4ynkaf0d.js} +2 -2
  2. package/dist/auto-search-worker.js +13 -7
  3. package/dist/chunk-embedding-write-worker.js +7 -7
  4. package/dist/{compartment-chunk-embedding-ymc9mtwv.js → compartment-chunk-embedding-fey2bsyf.js} +3 -1
  5. package/dist/{conflict-warning-hook-a0wrnzch.js → conflict-warning-hook-kbq6ppjf.js} +2 -2
  6. package/dist/{context-xesm7rj3.js → context-grdg1k2k.js} +132 -52
  7. package/dist/{derive-budgets-90869322.js → derive-budgets-hzzq71rm.js} +2 -2
  8. package/dist/{embedding-backfill-v6sw58m8.js → embedding-backfill-qjkaee9s.js} +8 -8
  9. package/dist/{v2/embedding-cache-mgyr73ef.js → embedding-cache-zn4r1c31.js} +5 -1
  10. package/dist/embedding-worker.js +2 -2
  11. package/dist/features/magic-context/compartment-chunk-embedding.d.ts +1 -0
  12. package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
  13. package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
  14. package/dist/features/magic-context/dreamer/token-budget.d.ts +8 -3
  15. package/dist/features/magic-context/dreamer/token-budget.d.ts.map +1 -1
  16. package/dist/features/magic-context/memory/embedding-cache.d.ts +7 -0
  17. package/dist/features/magic-context/memory/embedding-cache.d.ts.map +1 -1
  18. package/dist/features/magic-context/search.d.ts +6 -0
  19. package/dist/features/magic-context/search.d.ts.map +1 -1
  20. package/dist/features/magic-context/storage-db.d.ts.map +1 -1
  21. package/dist/features/magic-context/tool-definition-tokens.d.ts +2 -0
  22. package/dist/features/magic-context/tool-definition-tokens.d.ts.map +1 -1
  23. package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
  24. package/dist/hooks/magic-context/auto-search-worker-probe.fixture.d.ts +2 -0
  25. package/dist/hooks/magic-context/auto-search-worker-probe.fixture.d.ts.map +1 -0
  26. package/dist/hooks/magic-context/compartment-runner-partial-recomp.d.ts.map +1 -1
  27. package/dist/hooks/magic-context/compartment-runner-recomp-carry.d.ts +4 -0
  28. package/dist/hooks/magic-context/compartment-runner-recomp-carry.d.ts.map +1 -0
  29. package/dist/hooks/magic-context/compartment-runner-recomp.d.ts +8 -2
  30. package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
  31. package/dist/hooks/magic-context/dropped-input-guard.d.ts.map +1 -1
  32. package/dist/hooks/magic-context/emergency-fail-closed.d.ts +2 -0
  33. package/dist/hooks/magic-context/emergency-fail-closed.d.ts.map +1 -1
  34. package/dist/hooks/magic-context/recomp-orchestrator.d.ts +3 -5
  35. package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -1
  36. package/dist/hooks/magic-context/send-session-notification.d.ts +11 -1
  37. package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -1
  38. package/dist/hooks/magic-context/transform.d.ts +1 -0
  39. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  40. package/dist/{index-s8ks5nz4.js → index-2pdgy88n.js} +5 -5
  41. package/dist/{index-7j2zv9nm.js → index-2qsca7h7.js} +47 -11
  42. package/dist/{index-1bqkqde0.js → index-39rzef89.js} +9 -7
  43. package/dist/{index-snbpdpa3.js → index-3pdknr07.js} +4 -4
  44. package/dist/{index-c5tmzym6.js → index-5df2fw5b.js} +108 -13
  45. package/dist/{index-7svecf3m.js → index-5pgyqgmx.js} +1 -1
  46. package/dist/{index-xrnhxkz7.js → index-60wnwcwz.js} +1 -1
  47. package/dist/{index-k50xhjw1.js → index-60x5d68t.js} +1 -1
  48. package/dist/{index-4ntnt8ee.js → index-61knrt52.js} +1 -1
  49. package/dist/{index-g6hfh4h4.js → index-6zewd2n5.js} +14 -8
  50. package/dist/{index-70cv85b0.js → index-78t37mcq.js} +2 -2
  51. package/dist/{index-stx8zd81.js → index-83qd3n7s.js} +2 -2
  52. package/dist/{index-nny4gm06.js → index-9d3qgwq0.js} +2 -2
  53. package/dist/{index-jjvbk92s.js → index-9emdjcb5.js} +1 -1
  54. package/dist/{index-05bm2ndp.js → index-chpzb6xy.js} +1 -1
  55. package/dist/{index-2kf73btc.js → index-cr483vx6.js} +1 -1
  56. package/dist/{index-d0rtbv0f.js → index-dk3hy2a2.js} +21 -14
  57. package/dist/{index-gxdc95cp.js → index-g0mb2kb4.js} +585 -82
  58. package/dist/{index-w6v4dw5f.js → index-h9hybzr5.js} +5 -5
  59. package/dist/{index-1pf5qrx4.js → index-jzfsnbmm.js} +3 -3
  60. package/dist/{index-jrj95cce.js → index-m6dnydf8.js} +9 -2
  61. package/dist/{index-xccywqdj.js → index-mrjat4eq.js} +77 -14
  62. package/dist/{index-022w6314.js → index-n1ty0vd3.js} +116 -512
  63. package/dist/{index-ttk3trse.js → index-q7msfgwz.js} +311 -111
  64. package/dist/{index-e32b3x4n.js → index-qfcjrnpe.js} +7 -6
  65. package/dist/{v2/server-4dhv7mqz.js → index-qjwpqvnf.js} +48 -1
  66. package/dist/{index-3dtzyred.js → index-r4y0dczp.js} +1 -1
  67. package/dist/{index-4w5rx7de.js → index-tt0vs4x5.js} +2 -2
  68. package/dist/{index-k0tb2z28.js → index-w51n3576.js} +2 -2
  69. package/dist/{index-25nktq8n.js → index-wmb2mcdw.js} +7 -7
  70. package/dist/{index-zmqx48vt.js → index-xsqw8kbd.js} +1 -1
  71. package/dist/{index-fzgyvsb1.js → index-y14pawe1.js} +3 -0
  72. package/dist/{index-798s7c8s.js → index-zxhev8ze.js} +2 -2
  73. package/dist/index.d.ts.map +1 -1
  74. package/dist/index.js +68 -59
  75. package/dist/{message-index-bounded-6fr624zf.js → message-index-bounded-r1qys471.js} +4 -4
  76. package/dist/migration-worker.js +5 -5
  77. package/dist/plugin/messages-transform.d.ts +3 -4
  78. package/dist/plugin/messages-transform.d.ts.map +1 -1
  79. package/dist/plugin/refusal-notice.d.ts +3 -0
  80. package/dist/plugin/refusal-notice.d.ts.map +1 -0
  81. package/dist/{project-embedding-registry-q80scexh.js → project-embedding-registry-m3fp1pa4.js} +7 -7
  82. package/dist/raw-ordinal-warmup-worker.js +4 -4
  83. package/dist/{read-session-chunk-6wedfths.js → read-session-chunk-xv9f0wgb.js} +3 -3
  84. package/dist/{recomp-orchestrator-7ecg8ryx.js → recomp-orchestrator-dgyb394j.js} +23 -23
  85. package/dist/{render-yqp7q79f.js → render-d014e603.js} +12 -12
  86. package/dist/{rpc-notifications-t9q0ynq7.js → rpc-notifications-ta2zsxpq.js} +1 -1
  87. package/dist/{search-bw22d7zc.js → search-9gceftb9.js} +18 -18
  88. package/dist/{search-archive-r4h96j2z.js → search-archive-gybn6q7s.js} +5 -5
  89. package/dist/{send-session-notification-7x518gew.js → send-session-notification-gzxz88vq.js} +1 -1
  90. package/dist/shared/assistant-message-extractor.d.ts +2 -0
  91. package/dist/shared/assistant-message-extractor.d.ts.map +1 -1
  92. package/dist/shared/prompt-async-transport.d.ts.map +1 -1
  93. package/dist/shared/recomp-outcome.d.ts +4 -0
  94. package/dist/shared/recomp-outcome.d.ts.map +1 -0
  95. package/dist/shared/rpc-notifications.d.ts +1 -1
  96. package/dist/shared/rpc-notifications.d.ts.map +1 -1
  97. package/dist/shared/storage-permissions.d.ts +16 -2
  98. package/dist/shared/storage-permissions.d.ts.map +1 -1
  99. package/dist/shared/user-facing-codes.d.ts +4 -1
  100. package/dist/shared/user-facing-codes.d.ts.map +1 -1
  101. package/dist/{storage-memory-e6a7mb0k.js → storage-memory-hhrvfw0x.js} +2 -2
  102. package/dist/{storage-tags-y2mrb8e6.js → storage-tags-f1ftvjpw.js} +2 -2
  103. package/dist/{transform-postprocess-phase-t99yj9vt.js → transform-postprocess-phase-34k1zwsy.js} +24 -24
  104. package/dist/v2/auto-search-worker.js +13 -7
  105. package/dist/v2/chunk-embedding-write-worker.js +7 -7
  106. package/dist/v2/{compartment-chunk-embedding-x6qw6mjk.js → compartment-chunk-embedding-knt2468v.js} +3 -1
  107. package/dist/v2/{context-k8sx1nyy.js → context-8bzydxfy.js} +227 -70
  108. package/dist/v2/{derive-budgets-ecjy1aqh.js → derive-budgets-hr4qqrnv.js} +3 -3
  109. package/dist/v2/{embedding-backfill-k8kqnwfq.js → embedding-backfill-0ar1bm97.js} +8 -8
  110. package/dist/{embedding-cache-mgyr73ef.js → v2/embedding-cache-zn4r1c31.js} +5 -1
  111. package/dist/v2/embedding-worker.js +2 -2
  112. package/dist/v2/fold/native-replay.d.ts +3 -1
  113. package/dist/v2/fold/native-replay.d.ts.map +1 -1
  114. package/dist/v2/hidden-child-record.d.ts +1 -0
  115. package/dist/v2/hidden-child-record.d.ts.map +1 -1
  116. package/dist/v2/hidden-completion.d.ts.map +1 -1
  117. package/dist/v2/hooks/context.d.ts.map +1 -1
  118. package/dist/v2/{message-index-bounded-jqy7283g.js → message-index-bounded-b07r9cjv.js} +4 -4
  119. package/dist/v2/migration-worker.js +5 -5
  120. package/dist/v2/{project-embedding-registry-2jp1antr.js → project-embedding-registry-gx2waee8.js} +7 -7
  121. package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
  122. package/dist/v2/{read-session-chunk-n3nhfvd7.js → read-session-chunk-38wdy8nd.js} +3 -3
  123. package/dist/v2/{recomp-orchestrator-ssde9ft1.js → recomp-orchestrator-wq7gbkqa.js} +24 -24
  124. package/dist/v2/{render-fezgh7pa.js → render-2dan17xc.js} +12 -12
  125. package/dist/v2/{rpc-notifications-t9q0ynq7.js → rpc-notifications-ta2zsxpq.js} +1 -1
  126. package/dist/v2/{search-archive-zz1kza50.js → search-archive-89hdy0a2.js} +5 -5
  127. package/dist/v2/{search-m251amra.js → search-nyqykx7q.js} +17 -17
  128. package/dist/v2/{send-session-notification-p52rhjzy.js → send-session-notification-zazaxxpf.js} +1 -1
  129. package/dist/v2/{server-4wwwm2ya.js → server-09h2vyvs.js} +5 -5
  130. package/dist/v2/{server-r2es6zt7.js → server-0tv6kytx.js} +108 -13
  131. package/dist/v2/{server-rz4snd3x.js → server-1rrmxhd1.js} +1 -1
  132. package/dist/v2/{server-wdq85mxj.js → server-6250cxzs.js} +14 -8
  133. package/dist/v2/{server-xa8fefhw.js → server-96nm9vk4.js} +1 -1
  134. package/dist/v2/{server-jjvbk92s.js → server-9emdjcb5.js} +1 -1
  135. package/dist/v2/{server-ap81bk3c.js → server-9n2qgk29.js} +1 -1
  136. package/dist/v2/{server-ps6rz88g.js → server-a85j3kam.js} +2 -2
  137. package/dist/v2/{server-y31y6gws.js → server-add0j5n3.js} +9 -7
  138. package/dist/v2/{server-97w51d8n.js → server-b0a9h3ds.js} +3 -3
  139. package/dist/v2/{server-2k8tkbhz.js → server-c7awk5s2.js} +10 -4
  140. package/dist/v2/{server-hn8b7sfe.js → server-dgjqvpgd.js} +5 -5
  141. package/dist/v2/{server-fsw8kbng.js → server-dtcwkdqj.js} +314 -114
  142. package/dist/v2/{server-mbkwcwgw.js → server-f7tzvmzs.js} +2 -2
  143. package/dist/v2/{server-n5zr7190.js → server-fb5hvvfc.js} +77 -14
  144. package/dist/v2/{server-w7mpvkpj.js → server-fn4ky6mn.js} +1 -1
  145. package/dist/v2/{server-3p6b0qya.js → server-gqkdfdvw.js} +1 -1
  146. package/dist/v2/{server-cwtehwbb.js → server-j4jjtdc5.js} +1 -1
  147. package/dist/v2/{server-b93f0bqh.js → server-pjk9spbf.js} +1 -1
  148. package/dist/v2/{server-s15knz0w.js → server-pmws7we9.js} +1 -1
  149. package/dist/{index-4dhv7mqz.js → v2/server-qjwpqvnf.js} +48 -1
  150. package/dist/v2/{server-a2f1bhyj.js → server-stjy5dxv.js} +9 -2
  151. package/dist/v2/{server-ssg29wjg.js → server-ta4h0fch.js} +21 -14
  152. package/dist/v2/{server-e2k9mt86.js → server-tj65pgvg.js} +1 -1
  153. package/dist/v2/{server-brgandk4.js → server-vy0beygw.js} +2 -2
  154. package/dist/v2/{server-fzgyvsb1.js → server-y14pawe1.js} +3 -0
  155. package/dist/v2/{server-8pdfmc27.js → server-y17r5ryz.js} +4 -4
  156. package/dist/v2/{server-sxfbjdye.js → server-yx0nyj1q.js} +2 -2
  157. package/dist/v2/server.js +6 -6
  158. package/dist/v2/{storage-memory-e6a7mb0k.js → storage-memory-hhrvfw0x.js} +2 -2
  159. package/dist/v2/{storage-tags-xq81zgt2.js → storage-tags-pmw33chf.js} +2 -2
  160. package/dist/v2/{v2-archive-reader-e2w39c3p.js → v2-archive-reader-gh1jghf7.js} +1 -1
  161. package/dist/v2/{wrapup-orchestrator-eg5b1p89.js → wrapup-orchestrator-2h7ayss9.js} +24 -24
  162. package/dist/{v2-archive-reader-8dsngf2j.js → v2-archive-reader-8158kyfd.js} +1 -1
  163. package/dist/{wrapup-orchestrator-nmk6yf7f.js → wrapup-orchestrator-ct59br0c.js} +24 -24
  164. package/package.json +1 -1
  165. package/src/shared/assistant-message-extractor.test.ts +22 -0
  166. package/src/shared/assistant-message-extractor.ts +13 -0
  167. package/src/shared/model-suggestion-retry.test.ts +43 -12
  168. package/src/shared/prompt-async-transport.test.ts +275 -8
  169. package/src/shared/prompt-async-transport.ts +41 -2
  170. package/src/shared/recomp-outcome.ts +8 -0
  171. package/src/shared/reusable-worker.fixture.ts +15 -3
  172. package/src/shared/reusable-worker.test.ts +20 -10
  173. package/src/shared/rpc-notifications.ts +4 -1
  174. package/src/shared/sqlite-foreground-wait.test.ts +2 -2
  175. package/src/shared/startup-maintenance-policy.test.ts +4 -2
  176. package/src/shared/storage-permissions-startup.test.ts +296 -6
  177. package/src/shared/storage-permissions.ts +143 -18
  178. package/src/shared/user-facing-codes.ts +5 -2
  179. package/src/tui/dialogs/status-dialog.tsx +3 -0
  180. package/src/tui/slots/sidebar-content.tsx +6 -2
  181. package/src/tui-compiled/dialogs/status-dialog.tsx +12 -0
  182. package/src/tui-compiled/slots/sidebar-content.tsx +7 -2
@@ -17,14 +17,14 @@ import {
17
17
  } from "./index-pxnzyvjc.js";
18
18
  import {
19
19
  LocalEmbeddingProvider
20
- } from "./index-k50xhjw1.js";
20
+ } from "./index-60x5d68t.js";
21
21
  import {
22
22
  OpenAICompatibleEmbeddingProvider,
23
23
  embedTextForProject2
24
- } from "./index-s8ks5nz4.js";
24
+ } from "./index-2pdgy88n.js";
25
25
  import {
26
26
  saveEmbeddingIfHashMatches
27
- } from "./index-4dhv7mqz.js";
27
+ } from "./index-qjwpqvnf.js";
28
28
  import {
29
29
  getMemorySelectColumns2,
30
30
  isMemoryRow2,
@@ -34,7 +34,7 @@ import {
34
34
  buildWorkspaceMemorySqlFilter2,
35
35
  getMemoryById2,
36
36
  updateMemorySeenCount2
37
- } from "./index-jjvbk92s.js";
37
+ } from "./index-9emdjcb5.js";
38
38
  import {
39
39
  computeNormalizedHash
40
40
  } from "./index-2bvekkfy.js";
@@ -317,10 +317,12 @@ var USER_FACING_FAILURES = {
317
317
  action: "Check the Magic Context log for the failing task and its error."
318
318
  }
319
319
  };
320
- function renderUserFacingFailure(key, style = "markdown") {
320
+ function renderUserFacingFailure(key, style = "markdown", overrides) {
321
321
  const failure = USER_FACING_FAILURES[key];
322
- const action = style === "plain" ? failure.action.replaceAll("`", "") : failure.action;
323
- return `${failure.sentence} ${action} (${failure.code})`;
322
+ const sentence = overrides?.sentence ?? failure.sentence;
323
+ const action = overrides?.action ?? failure.action;
324
+ const styledAction = style === "plain" ? action.replaceAll("`", "") : action;
325
+ return `${sentence}${styledAction ? ` ${styledAction}` : ""} (${failure.code})`;
324
326
  }
325
327
  function userFacingFailureCode(key) {
326
328
  return USER_FACING_FAILURES[key].code;
@@ -954,7 +954,7 @@ async function loadCompartmentChunkEmbeddingsForSearch2(db, sessionId, projectPa
954
954
  var CHUNK_POOL_FULL_PROBE_INTERVAL_MS = 60000;
955
955
  var TRACKED_SEARCH_POOL_LIMIT = 8;
956
956
  var trackedSearchPools = new WeakMap;
957
- function trackSearchPool(db, sessionId, projectPath, modelId) {
957
+ function trackCompartmentChunkSearchPool2(db, sessionId, projectPath, modelId) {
958
958
  let tracked = trackedSearchPools.get(db);
959
959
  if (!tracked) {
960
960
  tracked = new Map;
@@ -981,7 +981,7 @@ function peekCompartmentChunkSearchPool2(db, sessionId, projectPath, modelId, da
981
981
  diagnostic.peek = "no-model";
982
982
  return null;
983
983
  }
984
- trackSearchPool(db, sessionId, projectPath, modelId);
984
+ trackCompartmentChunkSearchPool2(db, sessionId, projectPath, modelId);
985
985
  const entry = getDecodedSearchPool(db).get(searchPoolKey(sessionId, projectPath, modelId));
986
986
  if (!entry || searchPoolInTransaction(db)) {
987
987
  if (diagnostic)
@@ -1009,7 +1009,7 @@ async function warmCompartmentChunkSearchPool2(db, sessionId, projectPath, model
1009
1009
  });
1010
1010
  if (!modelId)
1011
1011
  return report("current");
1012
- trackSearchPool(db, sessionId, projectPath, modelId);
1012
+ trackCompartmentChunkSearchPool2(db, sessionId, projectPath, modelId);
1013
1013
  const key = searchPoolKey(sessionId, projectPath, modelId);
1014
1014
  try {
1015
1015
  if (pendingSearchPools.get(db)?.has(key))
@@ -1466,4 +1466,4 @@ async function countUnembeddedSessionCompartmentsPolite2(db, projectPath, sessio
1466
1466
  return count;
1467
1467
  }
1468
1468
 
1469
- export { DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS2, CHUNK_WINDOW_SAFETY_RATIO2, normalizeCompartmentChunkMaxInputTokens2, buildCanonicalChunkTextFromFts2, buildCompartmentSummaryFallbackText2, canonicalizeInMemoryChunkTextForEmbedding2, chunkCanonicalText2, chunkEmbeddingWindowsAreCurrent2, replaceCompartmentChunkEmbeddings2, loadCompartmentChunkEmbeddingsForSearch2, getLastCompartmentChunkPoolWarm2, peekCompartmentChunkSearchPool2, warmCompartmentChunkSearchPool2, maintainCompartmentChunkSearchPools2, loadUnembeddedShadowChunkCandidates2, loadUnembeddedCompartmentChunkCandidatesPolite2, deleteChunkEmbedBackoffForSession2, recordChunkEmbedBackoff2, chunkWindowSourceKey2, loadUnembeddedSessionChunkCandidates2, loadUnembeddedSessionChunkCandidatesPolite2, countUnembeddedSessionCompartments2, countSessionCompartmentEmbedCoverage2, countSessionCompartmentEmbedCoveragePolite2, countUnembeddedSessionCompartmentsPolite2 };
1469
+ export { DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS2, CHUNK_WINDOW_SAFETY_RATIO2, normalizeCompartmentChunkMaxInputTokens2, buildCanonicalChunkTextFromFts2, buildCompartmentSummaryFallbackText2, canonicalizeInMemoryChunkTextForEmbedding2, chunkCanonicalText2, chunkEmbeddingWindowsAreCurrent2, replaceCompartmentChunkEmbeddings2, loadCompartmentChunkEmbeddingsForSearch2, trackCompartmentChunkSearchPool2, getLastCompartmentChunkPoolWarm2, peekCompartmentChunkSearchPool2, warmCompartmentChunkSearchPool2, maintainCompartmentChunkSearchPools2, loadUnembeddedShadowChunkCandidates2, loadUnembeddedCompartmentChunkCandidatesPolite2, deleteChunkEmbedBackoffForSession2, recordChunkEmbedBackoff2, chunkWindowSourceKey2, loadUnembeddedSessionChunkCandidates2, loadUnembeddedSessionChunkCandidatesPolite2, countUnembeddedSessionCompartments2, countSessionCompartmentEmbedCoverage2, countSessionCompartmentEmbedCoveragePolite2, countUnembeddedSessionCompartmentsPolite2 };
@@ -17,6 +17,7 @@ import {
17
17
  readdirSync,
18
18
  readlinkSync,
19
19
  readSync,
20
+ realpathSync,
20
21
  renameSync,
21
22
  rmdirSync,
22
23
  rmSync,
@@ -25,6 +26,7 @@ import {
25
26
  writeSync
26
27
  } from "node:fs";
27
28
  import { open as openAsync, writeFile as writeFileAsync } from "node:fs/promises";
29
+ import { homedir } from "node:os";
28
30
  import { basename, dirname, join, resolve } from "node:path";
29
31
  var enforcePrivateStoragePermissions = true;
30
32
  var STORAGE_PERMISSIONS_POLICY_VERSION = 1;
@@ -33,6 +35,36 @@ var STORAGE_PERMISSIONS_MARKER_BYTES = Buffer.from(`${STORAGE_PERMISSIONS_POLICY
33
35
  `);
34
36
  var STORAGE_PERMISSIONS_MARKER_MAX_AGE_MS = 24 * 60 * 60000;
35
37
  var LEGACY_FENCE_TEMP_MIN_AGE_MS = 10 * 60000;
38
+ var MAGIC_CONTEXT_STORAGE_ENTRIES = [
39
+ "context.db",
40
+ "context.db-wal",
41
+ "context.db-shm",
42
+ "context.db-journal",
43
+ "store.db",
44
+ "store.db-wal",
45
+ "store.db-shm",
46
+ "store.db-journal",
47
+ STORAGE_PERMISSIONS_MARKER,
48
+ "models",
49
+ "logs",
50
+ "backups",
51
+ "config-backups",
52
+ "lkg-recovery-fences",
53
+ "rpc",
54
+ "project-identities",
55
+ "heap-snapshots",
56
+ "host-profiler",
57
+ "pi-served-array-digests",
58
+ "pi-served-array-bodies",
59
+ "pi-served-tag-numbers",
60
+ "window-reports.jsonl",
61
+ "window-reports.jsonl.1",
62
+ /^(?:last_announced_version|last-update-check\.json|pending-plugin-update\.json|model-context-limits-(?:opencode|opencode2)\.json)(?:\.[1-9]\d*\.[a-f0-9]{12}\.tmp)?$/,
63
+ /^identity-merge-backup-[A-Za-z0-9]{6}$/,
64
+ /^context\.db\.bak-\d{4}-\d{2}-\d{2}T\d{2}-\d{2}-\d{2}-\d{3}Z$/,
65
+ /^context\.db\.corrupt-(?:backup|original)-\d{8}T\d{9}Z(?:-[1-9]\d{0,3})?(?:-wal|-shm)?$/,
66
+ /^context\.db\.recovering-\d{8}T\d{9}Z-[1-9]\d*(?:-[1-9]\d{0,3})?(?:\.(?:count-source|recover-source|(?:fresh\.)?db)(?:-wal|-shm)?|\.sql)$/
67
+ ];
36
68
  var storagePermissionRoots = new Set;
37
69
  function invalidateStoragePermissionMarkers(directory) {
38
70
  for (let current = resolve(directory);; current = dirname(current)) {
@@ -208,11 +240,77 @@ function readStoragePermissionCertificate(marker) {
208
240
  closeSync(fd);
209
241
  }
210
242
  }
243
+ function inspectLinkedStorageRoot(root, rootStat) {
244
+ const parent = dirname(root);
245
+ if (root === parent)
246
+ return { skipped: "filesystem-root" };
247
+ try {
248
+ if (root === realpathSync(homedir()))
249
+ return { skipped: "home-folder" };
250
+ } catch (error) {
251
+ if (error.code !== "ENOENT")
252
+ throw error;
253
+ }
254
+ if (lstatSync(parent).dev !== rootStat.dev)
255
+ return { skipped: "mount-point" };
256
+ const entries = readdirSync(root);
257
+ const foreignEntries = entries.filter((name) => name !== ".DS_Store" && !MAGIC_CONTEXT_STORAGE_ENTRIES.some((entry) => typeof entry === "string" ? entry === name : entry.test(name))).length;
258
+ return foreignEntries === 0 ? { entries } : { skipped: foreignEntries };
259
+ }
211
260
  function tightenStorageTreeSync(directory, dbPath = join(directory, "context.db")) {
212
261
  if (process.platform === "win32") {
213
262
  return { tightened: 0, failures: 0 };
214
263
  }
215
- const root = resolve(directory);
264
+ const enforce = shouldEnforcePrivateStoragePermissions();
265
+ const startupPath = resolve(directory);
266
+ let root = startupPath;
267
+ let rootStat;
268
+ let rootLink;
269
+ let linkedEntries;
270
+ try {
271
+ rootStat = lstatSync(root);
272
+ } catch {
273
+ if (enforce)
274
+ return { tightened: 0, failures: 1 };
275
+ }
276
+ if (rootStat?.isSymbolicLink()) {
277
+ try {
278
+ root = realpathSync(startupPath);
279
+ rootStat = lstatSync(root);
280
+ if (rootStat.isDirectory() && enforce) {
281
+ const eligibility = inspectLinkedStorageRoot(root, rootStat);
282
+ if ("skipped" in eligibility) {
283
+ return {
284
+ tightened: 0,
285
+ failures: 0,
286
+ rootLink: { path: startupPath, target: root, skipped: eligibility.skipped }
287
+ };
288
+ }
289
+ linkedEntries = eligibility.entries;
290
+ }
291
+ } catch (error) {
292
+ if (!enforce)
293
+ return { tightened: 0, failures: 0 };
294
+ const failure = error.code ?? String(error);
295
+ return { tightened: 0, failures: 1, rootLink: { path: startupPath, failure } };
296
+ }
297
+ if (!rootStat.isDirectory()) {
298
+ if (!enforce)
299
+ return { tightened: 0, failures: 0 };
300
+ return {
301
+ tightened: 0,
302
+ failures: 1,
303
+ rootLink: {
304
+ path: startupPath,
305
+ failure: "not a directory",
306
+ nonDirectoryTarget: root
307
+ }
308
+ };
309
+ }
310
+ rootLink = { path: startupPath, target: root };
311
+ dbPath = join(root, basename(dbPath));
312
+ storagePermissionRoots.add(startupPath);
313
+ }
216
314
  const marker = join(root, STORAGE_PERMISSIONS_MARKER);
217
315
  let tightened = 0;
218
316
  let failures = 0;
@@ -225,20 +323,14 @@ function tightenStorageTreeSync(directory, dbPath = join(directory, "context.db"
225
323
  return false;
226
324
  }
227
325
  };
228
- if (!shouldEnforcePrivateStoragePermissions()) {
326
+ if (!enforce) {
229
327
  storagePermissionRoots.add(root);
230
328
  if (!removeMarker())
231
329
  failures++;
232
- return { tightened, failures };
330
+ return { tightened, failures, ...rootLink && { rootLink } };
233
331
  }
234
- let rootStat;
235
- try {
236
- rootStat = lstatSync(root);
237
- if (!rootStat.isDirectory())
238
- return { tightened, failures: 1 };
239
- } catch {
332
+ if (!rootStat?.isDirectory())
240
333
  return { tightened, failures: 1 };
241
- }
242
334
  storagePermissionRoots.add(root);
243
335
  let certificate;
244
336
  let discardMarker = false;
@@ -318,13 +410,16 @@ function tightenStorageTreeSync(directory, dbPath = join(directory, "context.db"
318
410
  return;
319
411
  let entries;
320
412
  try {
321
- entries = readdirSync(entryPath);
413
+ entries = (entryPath === root ? linkedEntries : undefined) ?? readdirSync(entryPath);
322
414
  } catch {
323
415
  failures++;
324
416
  return;
325
417
  }
326
- for (const entry of entries)
418
+ for (const entry of entries) {
419
+ if (entryPath === root && linkedEntries && markerRemoved && entry === STORAGE_PERMISSIONS_MARKER)
420
+ continue;
327
421
  visit(join(entryPath, entry));
422
+ }
328
423
  };
329
424
  if (certificate) {
330
425
  visit(root, false, false, rootStat);
@@ -372,7 +467,7 @@ function tightenStorageTreeSync(directory, dbPath = join(directory, "context.db"
372
467
  }
373
468
  }
374
469
  }
375
- return { tightened, failures };
470
+ return { tightened, failures, ...rootLink && { rootLink } };
376
471
  }
377
472
 
378
473
  export { setStoragePrivatePermissionEnforcement, shouldEnforcePrivateStoragePermissions, ensureStorageDirectorySync, ensurePrivateStorageDirectorySync, writeStorageFileSync, writeStorageFileAtomicSync, syncStorageDirectorySync, writeStorageFileDurableAtomicSync, copyStorageFileSync, copyStorageTreeSync, writeStorageFileAsync, writeStorageFileHandleAsync, createStorageWriteStream, createStorageFileHandleAsync, tightenStorageTreeSync };
@@ -4,7 +4,7 @@ import {
4
4
  } from "./index-ywrz4wy2.js";
5
5
  import {
6
6
  writeStorageFileAtomicSync
7
- } from "./index-c5tmzym6.js";
7
+ } from "./index-5df2fw5b.js";
8
8
  import {
9
9
  inRootAsyncContext2
10
10
  } from "./index-gzy5w8ya.js";
@@ -25,7 +25,7 @@ import {
25
25
  getToolDefinitionMeasurementSignature,
26
26
  getMeasuredToolDefinitionTokens,
27
27
  getSessionToolDefinitionTokens
28
- } from "./index-jrj95cce.js";
28
+ } from "./index-m6dnydf8.js";
29
29
  import {
30
30
  resolveModelConfigValue,
31
31
  DEFAULT_PROTECTED_TOOLS,
@@ -22,7 +22,7 @@ import {
22
22
  writeStorageFileAsync,
23
23
  writeStorageFileHandleAsync,
24
24
  createStorageFileHandleAsync
25
- } from "./index-c5tmzym6.js";
25
+ } from "./index-5df2fw5b.js";
26
26
  import {
27
27
  computeNormalizedHash
28
28
  } from "./index-2bvekkfy.js";
@@ -6,7 +6,7 @@ import {
6
6
  } from "./index-gzy5w8ya.js";
7
7
  import {
8
8
  managedAuthorityNoteRow
9
- } from "./index-4w5rx7de.js";
9
+ } from "./index-tt0vs4x5.js";
10
10
 
11
11
  // src/features/magic-context/storage-notes.ts
12
12
  var NOTE_TYPES = new Set(["session", "smart"]);
@@ -53,11 +53,11 @@ async function trySendTuiToast(sessionId, text, params, forcePersist) {
53
53
  const message = text.length > 200 ? `${text.slice(0, 200)}…` : text;
54
54
  const toastVariant = inferToastVariant(text);
55
55
  const duration = params.toastDurationMs ?? 5000;
56
- const { isTuiConnected: checkTui } = await importPluginModule(() => import("./rpc-notifications-t9q0ynq7.js"));
56
+ const { isTuiConnected: checkTui } = await importPluginModule(() => import("./rpc-notifications-ta2zsxpq.js"));
57
57
  if (!checkTui(sessionId))
58
58
  return false;
59
59
  try {
60
- const { pushNotification } = await importPluginModule(() => import("./rpc-notifications-t9q0ynq7.js"));
60
+ const { pushNotification } = await importPluginModule(() => import("./rpc-notifications-ta2zsxpq.js"));
61
61
  pushNotification("toast", {
62
62
  title,
63
63
  message,
@@ -286,7 +286,7 @@ async function sendCommandResult2(client, sessionId, text, params) {
286
286
  if (shouldHoldIgnoredNotification(sessionId)) {
287
287
  return sendIgnoredMessage2(client, sessionId, text, params);
288
288
  }
289
- const { isTuiConnected } = await importPluginModule(() => import("./rpc-notifications-t9q0ynq7.js"));
289
+ const { isTuiConnected } = await importPluginModule(() => import("./rpc-notifications-ta2zsxpq.js"));
290
290
  if (isTuiConnected(sessionId))
291
291
  return sendIgnoredMessage2(client, sessionId, text, params);
292
292
  const session = client?.session;
@@ -386,13 +386,19 @@ function observeIgnoredNotificationEvent2(event) {
386
386
  }
387
387
  async function sendStatusNotification2(_client, sessionId, text, params) {
388
388
  try {
389
- const { pushNotification } = await importPluginModule(() => import("./rpc-notifications-t9q0ynq7.js"));
390
- pushNotification("toast", {
391
- title: extractToastTitle(text),
389
+ const { pushLiveNotification, pushNotification } = await importPluginModule(() => import("./rpc-notifications-ta2zsxpq.js"));
390
+ const toast = {
391
+ title: params.toastTitle ?? extractToastTitle(text),
392
392
  message: text,
393
- variant: inferToastVariant(text),
393
+ variant: params.toastVariant ?? inferToastVariant(text),
394
394
  duration: params.toastDurationMs ?? 5000
395
- }, sessionId);
395
+ };
396
+ if (params.liveOnly) {
397
+ if (!pushLiveNotification("toast", toast, sessionId))
398
+ return "skipped";
399
+ } else {
400
+ pushNotification("toast", toast, sessionId);
401
+ }
396
402
  notifyDelivered(sessionId, params);
397
403
  return "sent";
398
404
  } catch (error) {
@@ -3,12 +3,12 @@ import {
3
3
  } from "./index-5vsk2cpp.js";
4
4
  import {
5
5
  getTagById2
6
- } from "./index-xrnhxkz7.js";
6
+ } from "./index-60wnwcwz.js";
7
7
  import {
8
8
  expandToolPart,
9
9
  visitRawSessionMessages2,
10
10
  readRawSessionMessageById2
11
- } from "./index-7j2zv9nm.js";
11
+ } from "./index-2qsca7h7.js";
12
12
 
13
13
  // src/tools/ctx-expand/render.ts
14
14
  import { createHash } from "node:crypto";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./index-ywrz4wy2.js";
5
5
  import {
6
6
  sendStatusNotification2
7
- } from "./index-g6hfh4h4.js";
7
+ } from "./index-6zewd2n5.js";
8
8
  import {
9
9
  formatConflictShort
10
10
  } from "./index-nxxzeq4y.js";
@@ -235,7 +235,7 @@ async function sendStartupAnnouncement2(client, directory, version, features, fo
235
235
  if (!sessionId) {
236
236
  return;
237
237
  }
238
- const { isTuiConnected } = await importPluginModule(() => import("./rpc-notifications-t9q0ynq7.js"));
238
+ const { isTuiConnected } = await importPluginModule(() => import("./rpc-notifications-ta2zsxpq.js"));
239
239
  if (isTuiConnected(sessionId) || isTuiConnected())
240
240
  return;
241
241
  const bullets = features.map((line) => ` • ${line}`).join(`
@@ -19,10 +19,10 @@ import {
19
19
  rawMessageWorkerSource2,
20
20
  rawMessageOffThreadRangeReader2,
21
21
  readRawSessionMessageIdOrdinalsForRange2
22
- } from "./index-7j2zv9nm.js";
22
+ } from "./index-2qsca7h7.js";
23
23
  import {
24
24
  readV2ArchiveOffThread2
25
- } from "./index-1pf5qrx4.js";
25
+ } from "./index-jzfsnbmm.js";
26
26
 
27
27
  // src/tools/ctx-expand/search-archive.ts
28
28
  var archiveReadsOnThisThread = 0;
@@ -7,7 +7,7 @@ import {
7
7
  import {
8
8
  invalidateProject2,
9
9
  invalidateMemory2
10
- } from "./index-4dhv7mqz.js";
10
+ } from "./index-qjwpqvnf.js";
11
11
  import {
12
12
  computeNormalizedHash
13
13
  } from "./index-2bvekkfy.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./index-5vsk2cpp.js";
10
10
  import {
11
11
  cleanUserText2
12
- } from "./index-7j2zv9nm.js";
12
+ } from "./index-2qsca7h7.js";
13
13
  import {
14
14
  recordMessageFtsRowid2,
15
15
  recordIndexedMessageTime2,
@@ -4,7 +4,7 @@ import {
4
4
  import {
5
5
  ensureStorageDirectorySync,
6
6
  writeStorageFileAtomicSync
7
- } from "./index-c5tmzym6.js";
7
+ } from "./index-5df2fw5b.js";
8
8
 
9
9
  // src/hooks/auto-update-checker/semver.ts
10
10
  function isValidSemver(version) {
@@ -20,9 +20,10 @@ import {
20
20
  import {
21
21
  buildCanonicalChunkTextFromFts2,
22
22
  loadCompartmentChunkEmbeddingsForSearch2,
23
+ trackCompartmentChunkSearchPool2,
23
24
  peekCompartmentChunkSearchPool2,
24
25
  warmCompartmentChunkSearchPool2
25
- } from "./index-snbpdpa3.js";
26
+ } from "./index-3pdknr07.js";
26
27
  import {
27
28
  saveCommitEmbedding,
28
29
  loadProjectCommitEmbeddings,
@@ -38,13 +39,13 @@ import {
38
39
  enqueueShadowEmbeddingItems2,
39
40
  getProjectEmbeddingSnapshot2,
40
41
  embedItemsForProject2
41
- } from "./index-s8ks5nz4.js";
42
+ } from "./index-2pdgy88n.js";
42
43
  import {
43
44
  recordEmbeddingMeasurement
44
45
  } from "./index-2amn2s73.js";
45
46
  import {
46
47
  getProjectEmbeddings2
47
- } from "./index-4dhv7mqz.js";
48
+ } from "./index-qjwpqvnf.js";
48
49
  import {
49
50
  USER_FACING_FAILURES,
50
51
  cosineSimilarity,
@@ -54,45 +55,45 @@ import {
54
55
  sanitizeFtsQuery,
55
56
  searchMemoriesFTS,
56
57
  searchMemoriesFTSUnion
57
- } from "./index-1bqkqde0.js";
58
+ } from "./index-39rzef89.js";
58
59
  import {
59
60
  ModuleMemoryAuthorityError2,
60
61
  getMemoriesByProject2,
61
62
  getMemoriesByProjects2,
62
63
  updateMemoryRetrievalCount2
63
- } from "./index-jjvbk92s.js";
64
+ } from "./index-9emdjcb5.js";
64
65
  import {
65
66
  matchedSearchSnippet,
66
67
  getIndexedMessageCorpusSize
67
- } from "./index-05bm2ndp.js";
68
+ } from "./index-chpzb6xy.js";
68
69
  import {
69
70
  getMessageIndexEpoch,
70
71
  isMessageIndexSearchable,
71
72
  withMemoryHintContent,
72
73
  autoSearchRelevance,
73
74
  recordAutoSearchLane
74
- } from "./index-798s7c8s.js";
75
+ } from "./index-zxhev8ze.js";
75
76
  import {
76
77
  ensureMemoryEmbeddings2
77
- } from "./index-k0tb2z28.js";
78
+ } from "./index-w51n3576.js";
78
79
  import {
79
80
  MESSAGE_FTS_SESSION_FILTER_SQL,
80
81
  withMessageFtsSessionFilter
81
82
  } from "./index-52x68mj4.js";
82
83
  import {
83
84
  isRecord
84
- } from "./index-xrnhxkz7.js";
85
+ } from "./index-60wnwcwz.js";
85
86
  import {
86
87
  resolveWorkspaceShareCategories,
87
88
  resolveWorkspaceIdentitySet,
88
89
  expandWorkspaceIdentitySetWithAliases,
89
90
  resolveStoredPathWorkspaceIdentity,
90
91
  sourceNameForMemory
91
- } from "./index-4w5rx7de.js";
92
+ } from "./index-tt0vs4x5.js";
92
93
  import {
93
94
  getNotes,
94
95
  getActivePrimers
95
- } from "./index-4ntnt8ee.js";
96
+ } from "./index-61knrt52.js";
96
97
  import {
97
98
  isKnownAutocommit
98
99
  } from "./index-8ajstryz.js";
@@ -2755,8 +2756,12 @@ async function searchCompartmentChunks(args) {
2755
2756
  if (args.diagnostics)
2756
2757
  args.diagnostics.pool = "no-vector";
2757
2758
  args.reportDiagnostics?.();
2758
- if (args.warmOnly)
2759
- warmCompartmentChunkSearchPool2(args.db, args.sessionId, args.projectPath, args.modelId);
2759
+ if (args.warmOnly) {
2760
+ if (args.deferWarmup)
2761
+ trackCompartmentChunkSearchPool2(args.db, args.sessionId, args.projectPath, args.modelId);
2762
+ else
2763
+ warmCompartmentChunkSearchPool2(args.db, args.sessionId, args.projectPath, args.modelId);
2764
+ }
2760
2765
  return [];
2761
2766
  }
2762
2767
  const cutoff = args.maxOrdinal != null && args.maxOrdinal >= 0 ? args.maxOrdinal : null;
@@ -2771,7 +2776,8 @@ async function searchCompartmentChunks(args) {
2771
2776
  args.diagnostics.poolRows = 0;
2772
2777
  }
2773
2778
  args.reportDiagnostics?.();
2774
- warmCompartmentChunkSearchPool2(args.db, args.sessionId, args.projectPath, args.modelId);
2779
+ if (!args.deferWarmup)
2780
+ warmCompartmentChunkSearchPool2(args.db, args.sessionId, args.projectPath, args.modelId);
2775
2781
  return [];
2776
2782
  }
2777
2783
  if (args.timings)
@@ -3181,6 +3187,7 @@ async function unifiedSearch2(db, sessionId, projectPath, query, options = {}) {
3181
3187
  modelId: chunkModelId && chunkModelId !== "off" ? chunkModelId : null,
3182
3188
  dateRange,
3183
3189
  warmOnly: options.chunkPoolWarmOnly,
3190
+ deferWarmup: options.deferChunkPoolWarmup,
3184
3191
  signal: options.signal,
3185
3192
  timings,
3186
3193
  diagnostics: options.autoSearchDiagnostics,