@cortexkit/opencode-magic-context 0.49.33 → 0.49.35

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 (229) hide show
  1. package/dist/auto-search-worker.js +11 -6
  2. package/dist/chunk-embedding-write-worker.js +16 -14
  3. package/dist/{compaction-marker-candidates-31h86ph0.js → compaction-marker-candidates-g0p67ced.js} +3 -2
  4. package/dist/compaction-marker-candidates-worker.js +1 -1
  5. package/dist/{compartment-chunk-embedding-5q5gj67r.js → compartment-chunk-embedding-y4136are.js} +8 -7
  6. package/dist/{conflict-warning-hook-xgskea1v.js → conflict-warning-hook-hhw8z5ak.js} +9 -8
  7. package/dist/{context-jyzkstnr.js → context-fk8e3h9p.js} +1400 -701
  8. package/dist/{derive-budgets-pqybnx09.js → derive-budgets-htj16n4x.js} +3 -2
  9. package/dist/embedding-backfill-q6n72sy0.js +27 -0
  10. package/dist/embedding-worker-process.js +2 -1
  11. package/dist/embedding-worker.js +5 -4
  12. package/dist/expand-attachments-h33jbgyz.js +21 -0
  13. package/dist/features/magic-context/auto-search-diagnostics.d.ts +21 -0
  14. package/dist/features/magic-context/auto-search-diagnostics.d.ts.map +1 -0
  15. package/dist/features/magic-context/compaction-marker.d.ts +22 -6
  16. package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
  17. package/dist/features/magic-context/compartment-chunk-embedding.d.ts +1 -1
  18. package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
  19. package/dist/features/magic-context/search.d.ts +4 -0
  20. package/dist/features/magic-context/search.d.ts.map +1 -1
  21. package/dist/features/magic-context/storage-meta-persisted.d.ts +7 -0
  22. package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
  23. package/dist/features/magic-context/store-generation-rebase-labels.d.ts +6 -0
  24. package/dist/features/magic-context/store-generation-rebase-labels.d.ts.map +1 -0
  25. package/dist/features/magic-context/store-generation-rebase.d.ts.map +1 -1
  26. package/dist/{history-owner-36wp3mkb.js → history-owner-0z620wgz.js} +3 -2
  27. package/dist/hooks/magic-context/apply-operations.d.ts +20 -3
  28. package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
  29. package/dist/hooks/magic-context/auto-search-observation.d.ts +13 -0
  30. package/dist/hooks/magic-context/auto-search-observation.d.ts.map +1 -0
  31. package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
  32. package/dist/hooks/magic-context/auto-search-worker-client.d.ts +5 -1
  33. package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
  34. package/dist/hooks/magic-context/compaction-marker-manager.d.ts +5 -5
  35. package/dist/hooks/magic-context/compaction-marker-manager.d.ts.map +1 -1
  36. package/dist/hooks/magic-context/compaction-marker-publication.d.ts +9 -0
  37. package/dist/hooks/magic-context/compaction-marker-publication.d.ts.map +1 -0
  38. package/dist/hooks/magic-context/compartment-commit-hashes.d.ts +4 -0
  39. package/dist/hooks/magic-context/compartment-commit-hashes.d.ts.map +1 -0
  40. package/dist/hooks/magic-context/compartment-runner-validation.d.ts +1 -0
  41. package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
  42. package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
  43. package/dist/hooks/magic-context/final-wire-completeness.d.ts +15 -0
  44. package/dist/hooks/magic-context/final-wire-completeness.d.ts.map +1 -0
  45. package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
  46. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
  47. package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts +1 -0
  48. package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts.map +1 -1
  49. package/dist/hooks/magic-context/read-session-chunk.d.ts +11 -0
  50. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  51. package/dist/hooks/magic-context/read-session-formatting.d.ts +2 -0
  52. package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -1
  53. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  54. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  55. package/dist/{index-as2amvn3.js → index-0c7p8mq5.js} +6 -531
  56. package/dist/{index-51rdvtkz.js → index-1rhgxqs8.js} +2 -2
  57. package/dist/index-2amn2s73.js +123 -0
  58. package/dist/{index-c7phnbvk.js → index-2p37txes.js} +1 -1
  59. package/dist/index-2qbtqg1w.js +529 -0
  60. package/dist/{index-waktfbjy.js → index-2v6nvy3k.js} +4 -4
  61. package/dist/{index-dq5xzeb9.js → index-3d3872c6.js} +7 -5
  62. package/dist/{index-qr2mb02j.js → index-3j9t1v4n.js} +55 -21
  63. package/dist/{index-2xh37qn5.js → index-4bgk5ztz.js} +576 -5524
  64. package/dist/{index-b88dwwrh.js → index-4xyjr62e.js} +1 -1
  65. package/dist/index-66a50f3e.js +777 -0
  66. package/dist/{index-94ef0qe2.js → index-87ctnzz9.js} +33 -5
  67. package/dist/{index-xrnsygfq.js → index-9wnbnx8f.js} +1 -1
  68. package/dist/{index-3fkk2gwj.js → index-b6xz3qbe.js} +246 -420
  69. package/dist/{index-0fe4q77z.js → index-brg2w6qc.js} +146 -134
  70. package/dist/{index-spwjbkc7.js → index-dnqqqc5f.js} +1 -1
  71. package/dist/index-dy7w6wm4.js +194 -0
  72. package/dist/{index-3jmx3fae.js → index-ezv6dz3y.js} +37 -7
  73. package/dist/index-f297z1n8.js +4557 -0
  74. package/dist/{index-qgh1qwjj.js → index-f9b3vtt1.js} +1 -1
  75. package/dist/{index-v15ne3a3.js → index-faxb7mck.js} +2 -2
  76. package/dist/{index-rrv26qjz.js → index-fw42ms3m.js} +1 -1
  77. package/dist/{index-t5pck3ss.js → index-fxbk7gk3.js} +1 -1
  78. package/dist/{index-wfybj1dw.js → index-g4t7850m.js} +2 -2
  79. package/dist/{index-hbt0sbv2.js → index-gyaa159j.js} +18 -276
  80. package/dist/{index-4pnsgvfk.js → index-hacf2tyx.js} +1 -1
  81. package/dist/{index-s1n8dd2n.js → index-jkanybgq.js} +2 -2
  82. package/dist/{index-2743x98y.js → index-jn0ddrhp.js} +29 -138
  83. package/dist/{index-h7tgn49j.js → index-jrfre9ah.js} +5 -222
  84. package/dist/{index-kfyb3k6n.js → index-jz5bk7xd.js} +2 -2
  85. package/dist/{index-np3rgfw4.js → index-ksv0a31x.js} +3 -3
  86. package/dist/{index-7kkphb6c.js → index-nj360hcs.js} +4 -4
  87. package/dist/{index-gkee6p4g.js → index-p56dszfp.js} +3 -3
  88. package/dist/{index-4s4zq97n.js → index-pq0dpwrc.js} +4 -4
  89. package/dist/{index-rfxzazzy.js → index-pswsyf1w.js} +4 -4
  90. package/dist/{index-y1qwzvxn.js → index-pztqab6k.js} +2 -2
  91. package/dist/{index-rverk2vz.js → index-qncw9hey.js} +1 -1
  92. package/dist/index-qx8j6kds.js +270 -0
  93. package/dist/{index-kq5w68dp.js → index-txs8tce6.js} +1 -1
  94. package/dist/index-vzhhr1ht.js +532 -0
  95. package/dist/index-wh9fxds5.js +265 -0
  96. package/dist/{index-b7w46fp2.js → index-x2mrq5xv.js} +170 -48
  97. package/dist/{index-43vqx0za.js → index-xwwsbsd3.js} +15 -13
  98. package/dist/index-z4p0ry94.js +222 -0
  99. package/dist/index-z9zygwse.js +89 -0
  100. package/dist/{index-v7287tzq.js → index-zhqwda72.js} +19 -8
  101. package/dist/index.js +83 -72
  102. package/dist/{logger-94kew5wm.js → logger-qwnbcfj9.js} +2 -1
  103. package/dist/{message-fts-rowid-map-va36knh4.js → message-fts-rowid-map-xg7hr0mk.js} +5 -4
  104. package/dist/{message-index-bounded-zq7a5nm6.js → message-index-bounded-narw7bnz.js} +12 -11
  105. package/dist/{message-time-backfill-4qva0b4f.js → message-time-backfill-39bm498k.js} +3 -2
  106. package/dist/migration-worker.js +13 -11
  107. package/dist/{project-embedding-registry-6yex0r9f.js → project-embedding-registry-tdz7985n.js} +13 -11
  108. package/dist/raw-ordinal-warmup-worker.js +12 -7
  109. package/dist/{read-session-chunk-1ndphmb8.js → read-session-chunk-vmg1zjg0.js} +15 -10
  110. package/dist/{read-session-raw-b2sd67v4.js → read-session-raw-mncmzbm9.js} +3 -2
  111. package/dist/recomp-orchestrator-qyyhnc9b.js +68 -0
  112. package/dist/render-c5p0k846.js +43 -0
  113. package/dist/{safe-notification-target-mkr9yzvr.js → safe-notification-target-wztd7bgk.js} +3 -2
  114. package/dist/{search-archive-sr07c6aj.js → search-archive-0ny7p3bw.js} +13 -11
  115. package/dist/{search-040pac3a.js → search-f6hwvcxk.js} +26 -23
  116. package/dist/{send-session-notification-vz86nt79.js → send-session-notification-0gwcz3fw.js} +7 -6
  117. package/dist/{storage-tags-6hvkk01c.js → storage-tags-zx1023km.js} +5 -4
  118. package/dist/store-620rjzt9.js +21 -0
  119. package/dist/store-reader-yh19h38c.js +14 -0
  120. package/dist/tools/ctx-expand/render.d.ts +5 -3
  121. package/dist/tools/ctx-expand/render.d.ts.map +1 -1
  122. package/dist/tools/ctx-expand/search-archive.d.ts.map +1 -1
  123. package/dist/tools/ctx-expand/tools.d.ts +2 -0
  124. package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
  125. package/dist/tools/ctx-expand/v2-archive-reader.d.ts +33 -0
  126. package/dist/tools/ctx-expand/v2-archive-reader.d.ts.map +1 -0
  127. package/dist/{transform-postprocess-phase-zx1peqma.js → transform-postprocess-phase-807ff6t2.js} +36 -30
  128. package/dist/v2/auto-search-worker.js +11 -6
  129. package/dist/v2/chunk-embedding-write-worker.js +16 -14
  130. package/dist/v2/{compaction-marker-candidates-m4vmye3w.js → compaction-marker-candidates-t1aq6gsj.js} +3 -2
  131. package/dist/v2/compaction-marker-candidates-worker.js +1 -1
  132. package/dist/v2/{compartment-chunk-embedding-rc31e6md.js → compartment-chunk-embedding-ncsk0r9e.js} +8 -7
  133. package/dist/v2/{context-3c4z2wj5.js → context-znqfkap4.js} +1725 -1095
  134. package/dist/v2/{derive-budgets-knf763tt.js → derive-budgets-sa0v7bz0.js} +4 -3
  135. package/dist/v2/embedding-backfill-11j425e0.js +26 -0
  136. package/dist/v2/embedding-worker-process.js +2 -1
  137. package/dist/v2/embedding-worker.js +5 -4
  138. package/dist/v2/expand-attachments-h33jbgyz.js +21 -0
  139. package/dist/v2/fold/idle.d.ts +15 -0
  140. package/dist/v2/fold/idle.d.ts.map +1 -0
  141. package/dist/v2/fold/native-replay-v3.d.ts +68 -0
  142. package/dist/v2/fold/native-replay-v3.d.ts.map +1 -0
  143. package/dist/v2/fold/native-replay.d.ts +58 -2
  144. package/dist/v2/fold/native-replay.d.ts.map +1 -1
  145. package/dist/v2/fold/policy.d.ts +2 -1
  146. package/dist/v2/fold/policy.d.ts.map +1 -1
  147. package/dist/v2/{history-owner-ad0crnrn.js → history-owner-fpka43cn.js} +3 -2
  148. package/dist/v2/hooks/context.d.ts.map +1 -1
  149. package/dist/v2/hooks/expand-attachments.d.ts +8 -0
  150. package/dist/v2/hooks/expand-attachments.d.ts.map +1 -0
  151. package/dist/v2/hooks/overflow-recovery.d.ts +45 -0
  152. package/dist/v2/hooks/overflow-recovery.d.ts.map +1 -0
  153. package/dist/v2/hooks/store.d.ts +7 -2
  154. package/dist/v2/hooks/store.d.ts.map +1 -1
  155. package/dist/v2/{logger-p34mjtja.js → logger-4cj6d03m.js} +2 -1
  156. package/dist/v2/{message-fts-rowid-map-78awh03v.js → message-fts-rowid-map-rmk571mb.js} +5 -4
  157. package/dist/v2/{message-index-bounded-jvgz7vk9.js → message-index-bounded-620bppw7.js} +12 -11
  158. package/dist/v2/{message-time-backfill-zvthw6xb.js → message-time-backfill-0c4h7sg6.js} +3 -2
  159. package/dist/v2/migration-worker.js +13 -11
  160. package/dist/v2/ordinal-range.fixture.d.ts +7 -0
  161. package/dist/v2/ordinal-range.fixture.d.ts.map +1 -0
  162. package/dist/v2/{project-embedding-registry-1x5qe2fy.js → project-embedding-registry-bm5fe1a8.js} +13 -11
  163. package/dist/v2/raw-ordinal-warmup-worker.js +12 -7
  164. package/dist/v2/{read-session-chunk-djzgm4jg.js → read-session-chunk-qfwv1k71.js} +15 -10
  165. package/dist/v2/{read-session-raw-5x088amc.js → read-session-raw-q294t8xs.js} +3 -2
  166. package/dist/v2/recomp-orchestrator-fcnjref7.js +67 -0
  167. package/dist/v2/render-98a1qv0b.js +42 -0
  168. package/dist/v2/{safe-notification-target-khnzg57c.js → safe-notification-target-gphhast7.js} +3 -2
  169. package/dist/v2/{search-archive-n3dhns4r.js → search-archive-r0y1bafr.js} +13 -11
  170. package/dist/v2/{search-q3wkpe8t.js → search-z1zqzsmh.js} +25 -22
  171. package/dist/v2/{send-session-notification-x5nzy34v.js → send-session-notification-fst6hkg7.js} +7 -6
  172. package/dist/v2/{server-rb8m4vry.js → server-1xesqm5h.js} +146 -134
  173. package/dist/v2/server-2amn2s73.js +123 -0
  174. package/dist/v2/{server-6g98c227.js → server-3schkz95.js} +4 -4
  175. package/dist/v2/server-468mya5v.js +209 -0
  176. package/dist/v2/server-55v5hpth.js +270 -0
  177. package/dist/v2/server-5jp38p98.js +532 -0
  178. package/dist/v2/{server-qjvk4a9t.js → server-69m30b21.js} +1 -1
  179. package/dist/v2/{server-d01pe8q5.js → server-7ccxt4nq.js} +14 -216
  180. package/dist/v2/{server-3mz2qh5a.js → server-969cdpmg.js} +1 -1
  181. package/dist/v2/{server-835q39kd.js → server-9k0mjef7.js} +2 -2
  182. package/dist/v2/{server-qc915kw2.js → server-bez34e60.js} +4 -4
  183. package/dist/v2/{server-nxas8v1d.js → server-bpvsvtph.js} +3 -3
  184. package/dist/v2/{server-ab8017gw.js → server-bxpz2dcn.js} +29 -138
  185. package/dist/v2/{server-bsgd4dk1.js → server-dcws5831.js} +2 -2
  186. package/dist/v2/server-ef1mskas.js +777 -0
  187. package/dist/v2/{server-1bw1wcbp.js → server-f0j864ma.js} +1 -1
  188. package/dist/v2/{server-aqbm9c8d.js → server-fqj6ddpr.js} +632 -5540
  189. package/dist/v2/{server-rr4cbkr0.js → server-hnknwaz8.js} +37 -7
  190. package/dist/v2/{server-h1byrhwx.js → server-hsf0qsn5.js} +19 -8
  191. package/dist/v2/{server-6495nmn9.js → server-jb6tjyeb.js} +5 -222
  192. package/dist/v2/{server-2aasmpsp.js → server-kkxzwa6w.js} +4 -4
  193. package/dist/v2/{server-a7x00tw8.js → server-mfn1yf9d.js} +1 -1
  194. package/dist/v2/{server-tkdabx8q.js → server-q0z2q2dx.js} +5 -530
  195. package/dist/v2/{server-n14edf07.js → server-qa74bj91.js} +77 -17
  196. package/dist/v2/server-qf2kzsh2.js +4513 -0
  197. package/dist/v2/{server-gyy4k6mf.js → server-qmmkhz2z.js} +1 -1
  198. package/dist/v2/{server-29qp8nz4.js → server-qxzbmtqt.js} +1 -1
  199. package/dist/v2/{server-hwag0khr.js → server-r3chnxs5.js} +4 -4
  200. package/dist/v2/{server-vr4szghm.js → server-rktnzs89.js} +2 -2
  201. package/dist/v2/{server-6vd2n183.js → server-s9xgyyj9.js} +1 -1
  202. package/dist/v2/{server-53eh1r8r.js → server-sd8hvzte.js} +2 -2
  203. package/dist/v2/{server-k3t06fxr.js → server-sefxj8k1.js} +1 -1
  204. package/dist/v2/{server-v77xa5wj.js → server-tpt7bwq8.js} +1 -1
  205. package/dist/v2/{server-awr8qa4c.js → server-ws5exe6q.js} +2 -2
  206. package/dist/v2/server-x4m6xcn4.js +194 -0
  207. package/dist/v2/{server-806rzhs6.js → server-xbtw0p9t.js} +1 -1
  208. package/dist/v2/{server-cqjvxyrp.js → server-xy7w7hrd.js} +2 -2
  209. package/dist/v2/server-ypf1ap0v.js +529 -0
  210. package/dist/v2/server-z4p0ry94.js +222 -0
  211. package/dist/v2/server-z9zygwse.js +89 -0
  212. package/dist/v2/{server-ab1g0wn9.js → server-zzgtgqmd.js} +2 -2
  213. package/dist/v2/server.js +6 -5
  214. package/dist/v2/{storage-tags-18nbaanf.js → storage-tags-19s0ebf0.js} +5 -4
  215. package/dist/v2/store-reader-cgx47zkp.js +14 -0
  216. package/dist/v2/store-reader.d.ts +9 -2
  217. package/dist/v2/store-reader.d.ts.map +1 -1
  218. package/dist/v2/store-vdm8v3jd.js +21 -0
  219. package/dist/v2/v2-archive-reader-t2c0eypn.js +11 -0
  220. package/dist/v2/{wrapup-orchestrator-ga5vfmwr.js → wrapup-orchestrator-aqpqsveg.js} +46 -39
  221. package/dist/v2-archive-reader-tm2eayp2.js +11 -0
  222. package/dist/wrapup-orchestrator-k5yp19a6.js +55 -0
  223. package/package.json +1 -1
  224. package/src/shared/sqlite-transaction-mode-guard.test.ts +4 -0
  225. package/dist/embedding-backfill-0jgtqxen.js +0 -25
  226. package/dist/recomp-orchestrator-skqzzvby.js +0 -62
  227. package/dist/v2/embedding-backfill-f43hd8y6.js +0 -24
  228. package/dist/v2/recomp-orchestrator-qfqdvbta.js +0 -61
  229. package/dist/wrapup-orchestrator-dy8r3gp8.js +0 -49
@@ -6,18 +6,23 @@ import {
6
6
  } from "./server-gzy5w8ya.js";
7
7
  import {
8
8
  runSessionWarmupWorker
9
- } from "./server-6vd2n183.js";
9
+ } from "./server-s9xgyyj9.js";
10
10
  import {
11
11
  estimateTokens
12
- } from "./server-3mz2qh5a.js";
12
+ } from "./server-969cdpmg.js";
13
13
  import {
14
14
  openCodeDbExists,
15
15
  withReadOnlySessionDb
16
- } from "./server-a7x00tw8.js";
16
+ } from "./server-mfn1yf9d.js";
17
17
  import {
18
18
  hasRawMessageProvider2,
19
+ rawMessageWorkerSource2,
20
+ rawMessageOffThreadRangeReader2,
19
21
  readRawSessionMessageIdOrdinalsForRange2
20
- } from "./server-rb8m4vry.js";
22
+ } from "./server-1xesqm5h.js";
23
+ import {
24
+ readV2ArchiveOffThread2
25
+ } from "./server-x4m6xcn4.js";
21
26
 
22
27
  // src/tools/ctx-expand/search-archive.ts
23
28
  var archiveReadsOnThisThread = 0;
@@ -72,9 +77,34 @@ function renderSearchArchive2(db, sessionId, start, end, tokenBudget, archiveOnl
72
77
  }
73
78
  async function renderSearchArchiveOffThread2(db, sessionId, start, end, tokenBudget, archiveOnly = false) {
74
79
  const path = getSqliteDatabasePath2(db);
75
- if (!path)
76
- return renderSearchArchive2(db, sessionId, start, end, tokenBudget, archiveOnly);
77
80
  const provider = hasRawMessageProvider2(sessionId);
81
+ const source = rawMessageWorkerSource2(sessionId);
82
+ const offThreadReader = rawMessageOffThreadRangeReader2(sessionId);
83
+ let rawIds;
84
+ if (!archiveOnly && !source && offThreadReader) {
85
+ try {
86
+ rawIds = await offThreadReader(start, end);
87
+ } catch (error) {
88
+ throw new Error(`Search archive worker unavailable: ${String(error)}`);
89
+ }
90
+ }
91
+ if (!path) {
92
+ return renderSearchArchive2(db, sessionId, start, end, tokenBudget, archiveOnly, rawIds ? () => rawIds : provider ? () => {
93
+ throw new Error("Search archive worker unavailable: private archive has no off-thread source");
94
+ } : undefined);
95
+ }
96
+ if (!archiveOnly && source) {
97
+ return readV2ArchiveOffThread2(path, source.path, sessionId, {
98
+ kind: "archive",
99
+ start,
100
+ end,
101
+ tokenBudget,
102
+ archiveOnly
103
+ });
104
+ }
105
+ if (!archiveOnly && provider && !rawIds) {
106
+ throw new Error("Search archive worker unavailable: raw-message provider has no off-thread source");
107
+ }
78
108
  const rawPath = !archiveOnly && !provider && openCodeDbExists() ? withReadOnlySessionDb(getSqliteDatabasePath2) : null;
79
109
  const result = await runSessionWarmupWorker({
80
110
  path,
@@ -85,7 +115,7 @@ async function renderSearchArchiveOffThread2(db, sessionId, start, end, tokenBud
85
115
  tokenBudget,
86
116
  archiveOnly,
87
117
  rawPath,
88
- rawIds: !archiveOnly && provider ? [...readRawSessionMessageIdOrdinalsForRange2(sessionId, start, end)] : undefined
118
+ rawIds: rawIds ? [...rawIds] : undefined
89
119
  }
90
120
  }, {});
91
121
  if ("searchArchive" in result)
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  getTokenEstimatorFingerprint,
3
3
  estimateTokens
4
- } from "./server-3mz2qh5a.js";
4
+ } from "./server-969cdpmg.js";
5
5
  import {
6
6
  getHarness2
7
7
  } from "./server-pavzsdc6.js";
8
8
  import {
9
9
  log2
10
- } from "./server-6495nmn9.js";
10
+ } from "./server-jb6tjyeb.js";
11
11
  import {
12
12
  isSynapseEmbeddingTruncated
13
- } from "./server-ab1g0wn9.js";
13
+ } from "./server-zzgtgqmd.js";
14
14
  import {
15
15
  messageFtsOrdinalRangeIsMapped2
16
- } from "./server-awr8qa4c.js";
16
+ } from "./server-ws5exe6q.js";
17
17
  import {
18
18
  isKnownAutocommit
19
19
  } from "./server-8ajstryz.js";
@@ -975,15 +975,26 @@ var unretainedSearchPools = new WeakMap;
975
975
  function getLastCompartmentChunkPoolWarm2() {
976
976
  return lastChunkPoolWarm;
977
977
  }
978
- function peekCompartmentChunkSearchPool2(db, sessionId, projectPath, modelId, dateRange = null) {
979
- if (!modelId)
978
+ function peekCompartmentChunkSearchPool2(db, sessionId, projectPath, modelId, dateRange = null, diagnostic) {
979
+ if (!modelId) {
980
+ if (diagnostic)
981
+ diagnostic.peek = "no-model";
980
982
  return null;
983
+ }
981
984
  trackSearchPool(db, sessionId, projectPath, modelId);
982
985
  const entry = getDecodedSearchPool(db).get(searchPoolKey(sessionId, projectPath, modelId));
983
- if (!entry || searchPoolInTransaction(db))
986
+ if (!entry || searchPoolInTransaction(db)) {
987
+ if (diagnostic)
988
+ diagnostic.peek = entry ? "transaction" : "missing";
984
989
  return null;
985
- if (!sameSessionSignature(readSessionChunkSignature(db, sessionId), entry.sessionSignature))
990
+ }
991
+ if (!sameSessionSignature(readSessionChunkSignature(db, sessionId), entry.sessionSignature)) {
992
+ if (diagnostic)
993
+ diagnostic.peek = "signature-changed";
986
994
  return null;
995
+ }
996
+ if (diagnostic)
997
+ diagnostic.peek = "hit";
987
998
  touchDecodedSearchPoolEntry(entry);
988
999
  return filterSearchPoolDates(entry.rows, dateRange);
989
1000
  }
@@ -1,6 +1,10 @@
1
1
  import {
2
2
  getHarness2
3
3
  } from "./server-pavzsdc6.js";
4
+ import {
5
+ sanitizeDiagnosticText,
6
+ sanitizeConfigValue
7
+ } from "./server-z4p0ry94.js";
4
8
 
5
9
  // src/shared/logger.ts
6
10
  import * as fs from "node:fs";
@@ -147,227 +151,6 @@ function getLegacyOpenCodeMagicContextStorageDir() {
147
151
  return path.join(getOpenCodeStorageDir(), "plugin", "magic-context");
148
152
  }
149
153
 
150
- // src/shared/redaction.ts
151
- import { homedir as homedir2, userInfo } from "node:os";
152
- function escapeRegex(value) {
153
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
154
- }
155
- var SECRET_WORDS = [
156
- "key",
157
- "token",
158
- "secret",
159
- "password",
160
- "auth",
161
- "authorization",
162
- "bearer",
163
- "credential"
164
- ];
165
- var SECRET_SEGMENT_PATTERN = new RegExp(`^(?:${SECRET_WORDS.map((w) => `${w}s?`).join("|")})$`, "i");
166
- var TRAILING_DESCRIPTORS = new Set(["id", "ids", "value", "values", "header", "headers"]);
167
- function redactionTypeForKey(key) {
168
- const normalized = key.trim().toLowerCase().replace(/[^a-z0-9_.-]+/g, "_");
169
- const suffix = normalized.split(".").filter(Boolean).at(-1) ?? normalized;
170
- return suffix || "secret";
171
- }
172
- function isNonSecretScalarValue(value) {
173
- const v = value.trim();
174
- if (v === "true" || v === "false" || v === "null" || v === "undefined")
175
- return true;
176
- return /^[+-]?\d+(?:\.\d+)?(?:[eE][+-]?\d+)?$/.test(v);
177
- }
178
- var SECRET_QUALIFIERS = new Set([
179
- "api",
180
- "access",
181
- "private",
182
- "client",
183
- "auth",
184
- "authorization",
185
- "secret",
186
- "bearer",
187
- "session",
188
- "refresh",
189
- "service",
190
- "x",
191
- "openai",
192
- "anthropic",
193
- "google",
194
- "github",
195
- "huggingface",
196
- "aws",
197
- "azure",
198
- "id"
199
- ]);
200
- var UNQUALIFIED_SECRET_SEGMENT_PATTERN = /^(?:password|secret|credential|bearer|authorization)s?$/;
201
- function isSecretKey(key) {
202
- const segments = key.replace(/([a-z0-9])([A-Z])/g, "$1_$2").toLowerCase().split(/[._-]+/).filter(Boolean);
203
- if (segments.length === 0)
204
- return false;
205
- if (segments.length === 1) {
206
- const first = segments[0];
207
- return Boolean(first && SECRET_SEGMENT_PATTERN.test(first));
208
- }
209
- for (let i = 0;i < segments.length; i++) {
210
- const seg = segments[i];
211
- if (!seg || !SECRET_SEGMENT_PATTERN.test(seg))
212
- continue;
213
- let trailingOk = true;
214
- for (let j = i + 1;j < segments.length; j++) {
215
- const tail = segments[j];
216
- if (!tail)
217
- continue;
218
- if (TRAILING_DESCRIPTORS.has(tail))
219
- continue;
220
- if (SECRET_SEGMENT_PATTERN.test(tail))
221
- continue;
222
- trailingOk = false;
223
- break;
224
- }
225
- if (!trailingOk)
226
- continue;
227
- if (UNQUALIFIED_SECRET_SEGMENT_PATTERN.test(seg))
228
- return true;
229
- for (let k = i - 1;k >= 0; k--) {
230
- const lead = segments[k];
231
- if (lead && SECRET_QUALIFIERS.has(lead))
232
- return true;
233
- }
234
- }
235
- return false;
236
- }
237
- function sanitizePathString(value) {
238
- const home = process.env.HOME || process.env.USERPROFILE || homedir2();
239
- const username = userInfo().username;
240
- let sanitized = value;
241
- if (home) {
242
- sanitized = sanitized.replace(new RegExp(escapeRegex(home), "g"), "~");
243
- }
244
- sanitized = sanitized.replace(/\/Users\/[^/]+\//g, "/Users/<USER>/");
245
- sanitized = sanitized.replace(/\/home\/[^/]+\//g, "/home/<USER>/");
246
- sanitized = sanitized.replace(/C:\\Users\\[^\\]+\\/g, "C:\\Users\\<USER>\\");
247
- if (username) {
248
- sanitized = sanitized.replace(new RegExp(escapeRegex(username), "g"), "<USER>");
249
- }
250
- return sanitized;
251
- }
252
- var SECRET_TEXT_PATTERNS = [
253
- {
254
- pattern: /\bsk-ant-(?:api03-)?[A-Za-z0-9_-]{32,}/g,
255
- replacement: "<ANTHROPIC_API_KEY_REDACTED>"
256
- },
257
- {
258
- pattern: /\bsk-(?:proj-)?[A-Za-z0-9_-]{12,}/g,
259
- replacement: "<OPENAI_API_KEY_REDACTED>"
260
- },
261
- {
262
- pattern: /\bgithub_pat_[A-Za-z0-9_]{20,}/g,
263
- replacement: "<GITHUB_PAT_REDACTED>"
264
- },
265
- {
266
- pattern: /\b(?:gh[opsu]|ghr)_[A-Za-z0-9_-]{30,}/g,
267
- replacement: "<GITHUB_TOKEN_REDACTED>"
268
- },
269
- {
270
- pattern: /\bhf_[A-Za-z0-9]{30,}/g,
271
- replacement: "<HUGGINGFACE_TOKEN_REDACTED>"
272
- },
273
- {
274
- pattern: /\b(?:AKIA|ASIA)[0-9A-Z]{16}\b/g,
275
- replacement: "<AWS_ACCESS_KEY_ID_REDACTED>"
276
- },
277
- {
278
- pattern: /\bxox[abprsuvc]-[A-Za-z0-9-]{10,}/g,
279
- replacement: "<SLACK_TOKEN_REDACTED>"
280
- },
281
- {
282
- pattern: /\bAIza[A-Za-z0-9_-]{35}\b/g,
283
- replacement: "<GOOGLE_API_KEY_REDACTED>"
284
- },
285
- {
286
- pattern: /\b(Authorization\s*:\s*Bearer\s+)([A-Za-z0-9._~+/=-]{8,})/gi,
287
- replacement: (_full, prefix) => `${prefix}<REDACTED:bearer>`
288
- },
289
- {
290
- pattern: /\b((?:Proxy-)?Authorization\s*:\s*(?:Basic|Digest|Token|Negotiate|NTLM)\s+)([A-Za-z0-9._~+/=-]{4,})/gi,
291
- replacement: (_full, prefix) => `${prefix}<REDACTED:authorization>`
292
- },
293
- {
294
- pattern: /\b((?:x-)?(?:api-?key|api-?token|auth-?token|access-?token)\s*:\s*)([^\s'"`,;<>]{6,})/gi,
295
- replacement: (full, prefix, value) => isNonSecretScalarValue(value) ? full : `${prefix}<REDACTED:api_key>`
296
- },
297
- {
298
- pattern: /\b((?:api[_-]?key|client[_-]?secret|access[_-]?token|token|secret|password|passwd|pwd)\s*:\s*)([^\s'"`,;<>]{6,})/gi,
299
- replacement: (full, prefix, value) => isNonSecretScalarValue(value) ? full : `${prefix}<REDACTED:credential>`
300
- },
301
- {
302
- pattern: /\b([a-z][a-z0-9+.-]*:\/\/[^\s/:@]+:)([^\s/@]+)(@)/gi,
303
- replacement: (_full, prefix, _password, at) => `${prefix}<REDACTED:password>${at}`
304
- },
305
- {
306
- pattern: /\beyJ[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+/g,
307
- replacement: "<JWT_REDACTED>"
308
- },
309
- {
310
- pattern: /(["'])([^"']*(?:key|token|secret|password|auth|bearer|credential)[^"']*)\1(\s*:\s*)(["'])([^"']*)\4/gi,
311
- replacement: (full, quote, key, separator, valueQuote, value) => isNonSecretScalarValue(value) ? full : `${quote}${key}${quote}${separator}${valueQuote}<REDACTED:${redactionTypeForKey(key)}>${valueQuote}`
312
- },
313
- {
314
- pattern: /\b([A-Za-z0-9_.-]*(?:key|token|secret|password|auth|bearer|credential)[A-Za-z0-9_.-]*)\s*=\s*([^\s'"`]+)/gi,
315
- replacement: (full, key, value) => isNonSecretScalarValue(value) ? full : `${key}=<REDACTED:${redactionTypeForKey(key)}>`
316
- }
317
- ];
318
- function redactSecretText(value) {
319
- let redacted = value;
320
- for (const { pattern, replacement } of SECRET_TEXT_PATTERNS) {
321
- if (typeof replacement === "string") {
322
- redacted = redacted.replace(pattern, replacement);
323
- } else {
324
- redacted = redacted.replace(pattern, replacement);
325
- }
326
- }
327
- return redacted;
328
- }
329
- function sanitizeDiagnosticText(value) {
330
- return redactSecretText(sanitizePathString(value));
331
- }
332
- var SHAREABILITY_SENSITIVE_PATTERNS = [
333
- /\bC:\/Users\/[^/\s]+/i,
334
- /(?:^|\s)~\/[^\s]+/,
335
- /\b(?:api[_-]?key|secret|token|password|passwd|pwd|client[_-]?secret|access[_-]?key)\b\s*[:=]\s*\S+/i,
336
- /\b(?:localhost|127\.0\.0\.1|0\.0\.0\.0|\[::1\])(?::\d+)?\b/i,
337
- /\b(?:10|127)\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/,
338
- /\b192\.168\.\d{1,3}\.\d{1,3}\b/,
339
- /\b172\.(?:1[6-9]|2\d|3[01])\.\d{1,3}\.\d{1,3}\b/
340
- ];
341
- function hasShareabilitySensitiveText(text) {
342
- try {
343
- if (sanitizeDiagnosticText(text) !== text)
344
- return true;
345
- return SHAREABILITY_SENSITIVE_PATTERNS.some((pattern) => pattern.test(text));
346
- } catch {
347
- return true;
348
- }
349
- }
350
- function sanitizeConfigValue(value, keyPath = []) {
351
- if (value === null || typeof value === "number" || typeof value === "boolean")
352
- return value;
353
- const key = keyPath.at(-1) ?? "";
354
- if (key && isSecretKey(key)) {
355
- return `<REDACTED:${redactionTypeForKey(key)}>`;
356
- }
357
- if (typeof value === "string")
358
- return sanitizeDiagnosticText(value);
359
- if (Array.isArray(value)) {
360
- return value.map((entry, index) => sanitizeConfigValue(entry, [...keyPath, String(index)]));
361
- }
362
- if (value && typeof value === "object") {
363
- return Object.fromEntries(Object.entries(value).map(([entryKey, entry]) => [
364
- entryKey,
365
- sanitizeConfigValue(entry, [...keyPath, entryKey])
366
- ]));
367
- }
368
- return value;
369
- }
370
-
371
154
  // src/shared/stale-plugin-build.ts
372
155
  import { posix } from "node:path";
373
156
  import { fileURLToPath } from "node:url";
@@ -696,4 +479,4 @@ if (!isTestEnv) {
696
479
  process.on("exit", flush);
697
480
  }
698
481
 
699
- export { getDataDir, ensureCortexKitArtifactGitignore, getProjectMagicContextHistorianDir, getMagicContextStorageDir, isMagicContextStorageOutsideEngram, claimStorageBackupWarningCheck, getLegacyOpenCodeMagicContextStorageDir, sanitizeDiagnosticText, hasShareabilitySensitiveText, registerStalePluginBuildHost, classifyStalePluginBuild, importPluginModule, setLogLineForwarder2, writeForwardedLogLine2, log2, sessionLog2, getLoggerDiagnostics2, flushLogger2, getLogFilePath2 };
482
+ export { getDataDir, ensureCortexKitArtifactGitignore, getProjectMagicContextHistorianDir, getMagicContextStorageDir, isMagicContextStorageOutsideEngram, claimStorageBackupWarningCheck, getLegacyOpenCodeMagicContextStorageDir, registerStalePluginBuildHost, classifyStalePluginBuild, importPluginModule, setLogLineForwarder2, writeForwardedLogLine2, log2, sessionLog2, getLoggerDiagnostics2, flushLogger2, getLogFilePath2 };
@@ -3,19 +3,19 @@ import {
3
3
  } from "./server-24g8r2d0.js";
4
4
  import {
5
5
  log2
6
- } from "./server-6495nmn9.js";
6
+ } from "./server-jb6tjyeb.js";
7
7
  import {
8
8
  isSynapseEmbeddingTruncated,
9
9
  SynapseEmbeddingProvider
10
- } from "./server-ab1g0wn9.js";
10
+ } from "./server-zzgtgqmd.js";
11
11
  import {
12
12
  LocalEmbeddingProvider
13
- } from "./server-vr4szghm.js";
13
+ } from "./server-rktnzs89.js";
14
14
  import {
15
15
  OpenAICompatibleEmbeddingProvider,
16
16
  getProjectEmbeddingSnapshot2,
17
17
  embedBatchForProject2
18
- } from "./server-ab8017gw.js";
18
+ } from "./server-bxpz2dcn.js";
19
19
  import {
20
20
  isEmbeddingHostBusy2
21
21
  } from "./server-qt1qqasc.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./server-pavzsdc6.js";
5
5
  import {
6
6
  log2
7
- } from "./server-6495nmn9.js";
7
+ } from "./server-jb6tjyeb.js";
8
8
  import {
9
9
  resolveOpenCodeDbPath,
10
10
  assertOpenCodeStoreGeneration,