@cortexkit/opencode-magic-context 0.49.34 → 0.49.36

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 (312) hide show
  1. package/README.md +1 -1
  2. package/dist/auto-search-worker.js +163 -155
  3. package/dist/chunk-embedding-write-worker.js +70 -66
  4. package/dist/{compaction-marker-candidates-31h86ph0.js → compaction-marker-candidates-5p1qkve9.js} +5 -2
  5. package/dist/compaction-marker-candidates-worker.js +24 -23
  6. package/dist/{compartment-chunk-embedding-5q5gj67r.js → compartment-chunk-embedding-ypktm0tk.js} +10 -8
  7. package/dist/{conflict-warning-hook-xgskea1v.js → conflict-warning-hook-b75jn458.js} +11 -9
  8. package/dist/{context-p3xrarzt.js → context-969z683s.js} +1839 -746
  9. package/dist/{derive-budgets-pqybnx09.js → derive-budgets-htj16n4x.js} +3 -2
  10. package/dist/embedding-backfill-rma0v2ct.js +28 -0
  11. package/dist/embedding-worker-process.js +2 -1
  12. package/dist/embedding-worker.js +6 -5
  13. package/dist/expand-attachments-h33jbgyz.js +21 -0
  14. package/dist/features/magic-context/auto-search-diagnostics.d.ts +21 -0
  15. package/dist/features/magic-context/auto-search-diagnostics.d.ts.map +1 -0
  16. package/dist/features/magic-context/compaction-marker-candidates.d.ts.map +1 -1
  17. package/dist/features/magic-context/compaction-marker.d.ts +5 -3
  18. package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
  19. package/dist/features/magic-context/compartment-chunk-embedding.d.ts +1 -1
  20. package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
  21. package/dist/features/magic-context/dreamer/task-gates.d.ts.map +1 -1
  22. package/dist/features/magic-context/dreamer/verify-gate.d.ts +2 -0
  23. package/dist/features/magic-context/dreamer/verify-gate.d.ts.map +1 -1
  24. package/dist/features/magic-context/dreamer/verify-state.d.ts +9 -0
  25. package/dist/features/magic-context/dreamer/verify-state.d.ts.map +1 -0
  26. package/dist/features/magic-context/dreamer/verify.d.ts +2 -1
  27. package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
  28. package/dist/features/magic-context/migration-worker-client.d.ts +3 -0
  29. package/dist/features/magic-context/migration-worker-client.d.ts.map +1 -1
  30. package/dist/features/magic-context/migration-worker.d.ts +15 -0
  31. package/dist/features/magic-context/migration-worker.d.ts.map +1 -1
  32. package/dist/features/magic-context/overflow-detection.d.ts +2 -2
  33. package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
  34. package/dist/features/magic-context/search-rerank.d.ts.map +1 -1
  35. package/dist/features/magic-context/search.d.ts +4 -0
  36. package/dist/features/magic-context/search.d.ts.map +1 -1
  37. package/dist/features/magic-context/storage-meta-persisted.d.ts +1 -0
  38. package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
  39. package/dist/features/magic-context/storage-tags.d.ts +4 -0
  40. package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
  41. package/dist/features/magic-context/store-generation-rebase-labels.d.ts +6 -0
  42. package/dist/features/magic-context/store-generation-rebase-labels.d.ts.map +1 -0
  43. package/dist/features/magic-context/store-generation-rebase.d.ts.map +1 -1
  44. package/dist/features/magic-context/work-metrics-carry-storage.d.ts +10 -0
  45. package/dist/features/magic-context/work-metrics-carry-storage.d.ts.map +1 -0
  46. package/dist/{history-owner-36wp3mkb.js → history-owner-0z620wgz.js} +3 -2
  47. package/dist/hooks/magic-context/apply-operations.d.ts +20 -3
  48. package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
  49. package/dist/hooks/magic-context/auto-search-observation.d.ts +13 -0
  50. package/dist/hooks/magic-context/auto-search-observation.d.ts.map +1 -0
  51. package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
  52. package/dist/hooks/magic-context/auto-search-worker-client.d.ts +10 -2
  53. package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
  54. package/dist/hooks/magic-context/compaction-marker-publication.d.ts.map +1 -1
  55. package/dist/hooks/magic-context/compartment-commit-hashes.d.ts +4 -0
  56. package/dist/hooks/magic-context/compartment-commit-hashes.d.ts.map +1 -0
  57. package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
  58. package/dist/hooks/magic-context/compartment-runner-validation.d.ts +1 -0
  59. package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
  60. package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
  61. package/dist/hooks/magic-context/final-wire-completeness.d.ts +15 -0
  62. package/dist/hooks/magic-context/final-wire-completeness.d.ts.map +1 -0
  63. package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
  64. package/dist/hooks/magic-context/issue-423-fixture.d.ts +1 -1
  65. package/dist/hooks/magic-context/issue-423-fixture.d.ts.map +1 -1
  66. package/dist/hooks/magic-context/issue-424-fixture.d.ts +1 -1
  67. package/dist/hooks/magic-context/issue-424-fixture.d.ts.map +1 -1
  68. package/dist/hooks/magic-context/project-structural-sentinels.d.ts +25 -0
  69. package/dist/hooks/magic-context/project-structural-sentinels.d.ts.map +1 -0
  70. package/dist/hooks/magic-context/protected-tail-boundary.d.ts +8 -1
  71. package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
  72. package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts +1 -0
  73. package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts.map +1 -1
  74. package/dist/hooks/magic-context/read-session-chunk.d.ts +11 -0
  75. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  76. package/dist/hooks/magic-context/read-session-formatting.d.ts +2 -0
  77. package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -1
  78. package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts +2 -0
  79. package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts.map +1 -1
  80. package/dist/hooks/magic-context/release-recovery-prefix.d.ts +9 -0
  81. package/dist/hooks/magic-context/release-recovery-prefix.d.ts.map +1 -0
  82. package/dist/hooks/magic-context/strip-structural-noise.d.ts +6 -3
  83. package/dist/hooks/magic-context/strip-structural-noise.d.ts.map +1 -1
  84. package/dist/hooks/magic-context/transform-context-state.d.ts +3 -0
  85. package/dist/hooks/magic-context/transform-context-state.d.ts.map +1 -1
  86. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +3 -0
  87. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  88. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  89. package/dist/{index-cpjk5jd2.js → index-1d042x6w.js} +16 -14
  90. package/dist/{index-2743x98y.js → index-21fgrfrf.js} +35 -142
  91. package/dist/index-2amn2s73.js +123 -0
  92. package/dist/{index-c7phnbvk.js → index-2p37txes.js} +1 -1
  93. package/dist/index-2qbtqg1w.js +529 -0
  94. package/dist/{index-9gpw8hrm.js → index-2rs7912w.js} +4 -4
  95. package/dist/{index-m1x9ghk5.js → index-4ks89h5a.js} +37 -7
  96. package/dist/{index-b88dwwrh.js → index-4xyjr62e.js} +1 -1
  97. package/dist/index-4y35msh5.js +531 -0
  98. package/dist/index-66a50f3e.js +777 -0
  99. package/dist/index-72czy45z.js +4557 -0
  100. package/dist/index-7v05d9b7.js +58 -0
  101. package/dist/{index-qgh1qwjj.js → index-850vthn3.js} +9 -3
  102. package/dist/{index-np3rgfw4.js → index-8jjjmhab.js} +15 -4
  103. package/dist/index-96ztjvkn.js +204 -0
  104. package/dist/{index-fm36bjv4.js → index-9fgmkfaf.js} +22 -277
  105. package/dist/{index-atekmqef.js → index-9tdvbdv1.js} +508 -5547
  106. package/dist/{index-xrnsygfq.js → index-9wnbnx8f.js} +1 -1
  107. package/dist/{index-waktfbjy.js → index-ae1ar4v1.js} +4 -4
  108. package/dist/{index-v15ne3a3.js → index-b1ydbp95.js} +2 -2
  109. package/dist/{index-nxrsns5x.js → index-c5dzns43.js} +75 -75
  110. package/dist/{index-v7287tzq.js → index-dcjkw41m.js} +19 -8
  111. package/dist/{index-hbx7m8he.js → index-dfdg2cgg.js} +338 -86
  112. package/dist/{index-spwjbkc7.js → index-dnqqqc5f.js} +1 -1
  113. package/dist/{index-04z754rd.js → index-dz48h1wx.js} +33 -5
  114. package/dist/{index-rrv26qjz.js → index-fw42ms3m.js} +1 -1
  115. package/dist/{index-t5pck3ss.js → index-fxbk7gk3.js} +1 -1
  116. package/dist/{index-wfybj1dw.js → index-g4t7850m.js} +2 -2
  117. package/dist/{index-97spytxq.js → index-gnmhbyyc.js} +583 -474
  118. package/dist/{index-4pnsgvfk.js → index-hacf2tyx.js} +1 -1
  119. package/dist/index-j105mf16.js +270 -0
  120. package/dist/{index-gkee6p4g.js → index-jggt5gf2.js} +3 -3
  121. package/dist/{index-s1n8dd2n.js → index-jkanybgq.js} +2 -2
  122. package/dist/{index-h7tgn49j.js → index-jrfre9ah.js} +5 -222
  123. package/dist/{index-kfyb3k6n.js → index-jz5bk7xd.js} +2 -2
  124. package/dist/{index-7kkphb6c.js → index-nj360hcs.js} +4 -4
  125. package/dist/{index-07vskjn8.js → index-pp8vdn01.js} +15 -13
  126. package/dist/index-prw8apnc.js +194 -0
  127. package/dist/{index-rverk2vz.js → index-r2epb000.js} +34 -4
  128. package/dist/{index-7g9dr8gy.js → index-tn9drm1a.js} +125 -143
  129. package/dist/{index-kq5w68dp.js → index-txs8tce6.js} +1 -1
  130. package/dist/{index-rfxzazzy.js → index-ty4vhe4n.js} +5 -5
  131. package/dist/{index-y1qwzvxn.js → index-vd2ywmfe.js} +2 -2
  132. package/dist/{index-0677w9sd.js → index-wcwhhtdh.js} +58 -23
  133. package/dist/index-wh9fxds5.js +265 -0
  134. package/dist/{index-51rdvtkz.js → index-xd2p95m7.js} +3 -3
  135. package/dist/{index-as2amvn3.js → index-xnm0wq1r.js} +6 -531
  136. package/dist/{index-ftr84kkv.js → index-ys7j6679.js} +7 -5
  137. package/dist/index-z4p0ry94.js +222 -0
  138. package/dist/index-z9zygwse.js +89 -0
  139. package/dist/index.js +86 -74
  140. package/dist/{logger-94kew5wm.js → logger-qwnbcfj9.js} +2 -1
  141. package/dist/{message-fts-rowid-map-va36knh4.js → message-fts-rowid-map-t6qsyg9s.js} +7 -5
  142. package/dist/{message-index-bounded-qh91fdr3.js → message-index-bounded-wfk6aqxk.js} +15 -13
  143. package/dist/{message-time-backfill-4qva0b4f.js → message-time-backfill-39bm498k.js} +3 -2
  144. package/dist/migration-worker.js +55 -48
  145. package/dist/plugin/rpc-handlers.d.ts.map +1 -1
  146. package/dist/{project-embedding-registry-6yex0r9f.js → project-embedding-registry-3yyegjma.js} +16 -13
  147. package/dist/raw-ordinal-warmup-worker.js +114 -113
  148. package/dist/{read-session-chunk-kaghtr75.js → read-session-chunk-26yrrhyz.js} +18 -12
  149. package/dist/{read-session-raw-b2sd67v4.js → read-session-raw-j7c9w57v.js} +5 -3
  150. package/dist/recomp-orchestrator-wk509qkp.js +69 -0
  151. package/dist/render-h1qarr8a.js +44 -0
  152. package/dist/{safe-notification-target-mkr9yzvr.js → safe-notification-target-wztd7bgk.js} +3 -2
  153. package/dist/search-5h9fydyq.js +54 -0
  154. package/dist/search-archive-q79hyqxs.js +29 -0
  155. package/dist/{send-session-notification-vz86nt79.js → send-session-notification-14p3yje4.js} +9 -7
  156. package/dist/shared/model-suggestion-retry.d.ts +7 -0
  157. package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
  158. package/dist/shared/prompt-async-transport.d.ts.map +1 -1
  159. package/dist/shared/reusable-worker-entry.d.ts +4 -0
  160. package/dist/shared/reusable-worker-entry.d.ts.map +1 -0
  161. package/dist/shared/reusable-worker.d.ts +6 -0
  162. package/dist/shared/reusable-worker.d.ts.map +1 -0
  163. package/dist/shared/reusable-worker.fixture.d.ts +2 -0
  164. package/dist/shared/reusable-worker.fixture.d.ts.map +1 -0
  165. package/dist/shared/worker-shutdown.d.ts +1 -1
  166. package/dist/shared/worker-shutdown.d.ts.map +1 -1
  167. package/dist/{storage-tags-6hvkk01c.js → storage-tags-vj0yj7ed.js} +5 -4
  168. package/dist/store-reader-yh19h38c.js +14 -0
  169. package/dist/store-s3eykdjt.js +21 -0
  170. package/dist/tools/ctx-expand/render.d.ts +5 -3
  171. package/dist/tools/ctx-expand/render.d.ts.map +1 -1
  172. package/dist/tools/ctx-expand/search-archive.d.ts.map +1 -1
  173. package/dist/tools/ctx-expand/tools.d.ts +2 -0
  174. package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
  175. package/dist/tools/ctx-expand/v2-archive-reader.d.ts +33 -0
  176. package/dist/tools/ctx-expand/v2-archive-reader.d.ts.map +1 -0
  177. package/dist/{transform-postprocess-phase-ph38mhrs.js → transform-postprocess-phase-4gj0mtcg.js} +39 -32
  178. package/dist/v2/auto-search-worker.js +163 -155
  179. package/dist/v2/chunk-embedding-write-worker.js +71 -67
  180. package/dist/v2/compaction-marker-candidates-worker.js +24 -23
  181. package/dist/v2/{compaction-marker-candidates-m4vmye3w.js → compaction-marker-candidates-yeb2ky46.js} +6 -3
  182. package/dist/v2/{compartment-chunk-embedding-rc31e6md.js → compartment-chunk-embedding-qfk791bd.js} +11 -9
  183. package/dist/v2/{context-s60hcatx.js → context-bxr039be.js} +2678 -1246
  184. package/dist/v2/{derive-budgets-knf763tt.js → derive-budgets-sa0v7bz0.js} +4 -3
  185. package/dist/v2/embedding-backfill-00tw59rx.js +27 -0
  186. package/dist/v2/embedding-worker-process.js +2 -1
  187. package/dist/v2/embedding-worker.js +6 -5
  188. package/dist/v2/expand-attachments-h33jbgyz.js +21 -0
  189. package/dist/v2/fold/code-mode-catalog.d.ts +3 -0
  190. package/dist/v2/fold/code-mode-catalog.d.ts.map +1 -0
  191. package/dist/v2/fold/idle.d.ts +16 -0
  192. package/dist/v2/fold/idle.d.ts.map +1 -0
  193. package/dist/v2/fold/manual-baseline.d.ts +8 -0
  194. package/dist/v2/fold/manual-baseline.d.ts.map +1 -0
  195. package/dist/v2/fold/native-replay-v3.d.ts +75 -0
  196. package/dist/v2/fold/native-replay-v3.d.ts.map +1 -0
  197. package/dist/v2/fold/native-replay.d.ts +81 -8
  198. package/dist/v2/fold/native-replay.d.ts.map +1 -1
  199. package/dist/v2/fold/policy.d.ts +2 -1
  200. package/dist/v2/fold/policy.d.ts.map +1 -1
  201. package/dist/v2/fold/restore.d.ts.map +1 -1
  202. package/dist/v2/fold/summary.d.ts +4 -0
  203. package/dist/v2/fold/summary.d.ts.map +1 -0
  204. package/dist/v2/hidden-completion.d.ts.map +1 -1
  205. package/dist/v2/{history-owner-ad0crnrn.js → history-owner-fpka43cn.js} +3 -2
  206. package/dist/v2/hooks/channel2.d.ts +6 -0
  207. package/dist/v2/hooks/channel2.d.ts.map +1 -1
  208. package/dist/v2/hooks/context.d.ts.map +1 -1
  209. package/dist/v2/hooks/expand-attachments.d.ts +8 -0
  210. package/dist/v2/hooks/expand-attachments.d.ts.map +1 -0
  211. package/dist/v2/hooks/overflow-recovery.d.ts +45 -0
  212. package/dist/v2/hooks/overflow-recovery.d.ts.map +1 -0
  213. package/dist/v2/hooks/restore-rows.d.ts +12 -2
  214. package/dist/v2/hooks/restore-rows.d.ts.map +1 -1
  215. package/dist/v2/hooks/store.d.ts +7 -2
  216. package/dist/v2/hooks/store.d.ts.map +1 -1
  217. package/dist/v2/hooks/synthetic-admission.d.ts +7 -0
  218. package/dist/v2/hooks/synthetic-admission.d.ts.map +1 -0
  219. package/dist/v2/hooks/usage-persist.d.ts.map +1 -1
  220. package/dist/v2/{logger-p34mjtja.js → logger-4cj6d03m.js} +2 -1
  221. package/dist/v2/{message-fts-rowid-map-78awh03v.js → message-fts-rowid-map-z86avy0n.js} +8 -6
  222. package/dist/v2/{message-index-bounded-4htdr1j6.js → message-index-bounded-w14496s9.js} +16 -14
  223. package/dist/v2/{message-time-backfill-zvthw6xb.js → message-time-backfill-0c4h7sg6.js} +3 -2
  224. package/dist/v2/migration-worker.js +56 -49
  225. package/dist/v2/ordinal-range.fixture.d.ts +7 -0
  226. package/dist/v2/ordinal-range.fixture.d.ts.map +1 -0
  227. package/dist/v2/{project-embedding-registry-1x5qe2fy.js → project-embedding-registry-jqq2qeqb.js} +17 -14
  228. package/dist/v2/raw-ordinal-warmup-worker.js +114 -113
  229. package/dist/v2/{read-session-chunk-1fa9qzwb.js → read-session-chunk-tqnh1ret.js} +18 -12
  230. package/dist/v2/{read-session-raw-5x088amc.js → read-session-raw-qpp6x9kg.js} +6 -4
  231. package/dist/v2/recomp-orchestrator-9cjk6aej.js +68 -0
  232. package/dist/v2/render-5dz1knf2.js +43 -0
  233. package/dist/v2/{safe-notification-target-khnzg57c.js → safe-notification-target-gphhast7.js} +3 -2
  234. package/dist/v2/search-8yfet25y.js +52 -0
  235. package/dist/v2/search-archive-z6z9jqwf.js +28 -0
  236. package/dist/v2/{send-session-notification-x5nzy34v.js → send-session-notification-kxp47tsw.js} +9 -7
  237. package/dist/v2/{server-cpjk5jd2.js → server-1d042x6w.js} +16 -14
  238. package/dist/v2/server-2amn2s73.js +123 -0
  239. package/dist/v2/{server-6g98c227.js → server-3schkz95.js} +4 -4
  240. package/dist/v2/server-468mya5v.js +209 -0
  241. package/dist/v2/{server-z2wft9zv.js → server-5by3vdzs.js} +562 -5560
  242. package/dist/v2/{server-qjvk4a9t.js → server-69m30b21.js} +1 -1
  243. package/dist/v2/server-6emy0v9a.js +531 -0
  244. package/dist/v2/{server-vr4szghm.js → server-6vzh6wej.js} +3 -3
  245. package/dist/v2/{server-ajxhrgjv.js → server-7094pk3w.js} +80 -19
  246. package/dist/v2/{server-ab8017gw.js → server-7acq7815.js} +34 -141
  247. package/dist/v2/server-7v05d9b7.js +58 -0
  248. package/dist/v2/{server-24g8r2d0.js → server-7zacmty5.js} +75 -75
  249. package/dist/v2/{server-3mz2qh5a.js → server-969cdpmg.js} +1 -1
  250. package/dist/v2/server-96ztjvkn.js +204 -0
  251. package/dist/v2/{server-grakwy1v.js → server-a9w5f0yw.js} +37 -7
  252. package/dist/v2/{server-835q39kd.js → server-avdveykk.js} +3 -3
  253. package/dist/v2/{server-qc915kw2.js → server-bez34e60.js} +4 -4
  254. package/dist/v2/{server-h1byrhwx.js → server-cp1a03vc.js} +19 -8
  255. package/dist/v2/{server-bsgd4dk1.js → server-dcws5831.js} +2 -2
  256. package/dist/v2/{server-m1pfg2d4.js → server-dfq5vb8j.js} +4 -4
  257. package/dist/v2/server-e51xmr4d.js +194 -0
  258. package/dist/v2/server-ef1mskas.js +777 -0
  259. package/dist/v2/{server-1bw1wcbp.js → server-f0j864ma.js} +1 -1
  260. package/dist/v2/{server-jw5qe9y8.js → server-g3gqq4ac.js} +18 -217
  261. package/dist/v2/{server-2aasmpsp.js → server-gkse1wyz.js} +5 -5
  262. package/dist/v2/{server-6495nmn9.js → server-jb6tjyeb.js} +5 -222
  263. package/dist/v2/{server-qvy4qavp.js → server-jd7vzwn4.js} +125 -143
  264. package/dist/v2/{server-a7x00tw8.js → server-mfn1yf9d.js} +1 -1
  265. package/dist/v2/{server-awr8qa4c.js → server-nmyganc8.js} +2 -2
  266. package/dist/v2/{server-tkdabx8q.js → server-nq3cb7be.js} +5 -530
  267. package/dist/v2/server-qjyp27vf.js +270 -0
  268. package/dist/v2/{server-gyy4k6mf.js → server-qmmkhz2z.js} +1 -1
  269. package/dist/v2/{server-29qp8nz4.js → server-qxzbmtqt.js} +1 -1
  270. package/dist/v2/{server-806rzhs6.js → server-r4430x9m.js} +10 -4
  271. package/dist/v2/{server-53eh1r8r.js → server-sd8hvzte.js} +2 -2
  272. package/dist/v2/{server-k3t06fxr.js → server-sefxj8k1.js} +1 -1
  273. package/dist/v2/server-t8y64xj7.js +4513 -0
  274. package/dist/v2/{server-6vd2n183.js → server-tnzbk64q.js} +35 -5
  275. package/dist/v2/{server-v77xa5wj.js → server-tpt7bwq8.js} +1 -1
  276. package/dist/v2/{server-51779zs2.js → server-v0p37hm2.js} +4 -1
  277. package/dist/v2/{server-nxas8v1d.js → server-xfjjbrkt.js} +15 -4
  278. package/dist/v2/{server-cqjvxyrp.js → server-xy7w7hrd.js} +2 -2
  279. package/dist/v2/server-ypf1ap0v.js +529 -0
  280. package/dist/v2/server-z4p0ry94.js +222 -0
  281. package/dist/v2/server-z9zygwse.js +89 -0
  282. package/dist/v2/{server-ab1g0wn9.js → server-zzgtgqmd.js} +2 -2
  283. package/dist/v2/server.js +7 -6
  284. package/dist/v2/{storage-tags-18nbaanf.js → storage-tags-cw07ky67.js} +5 -4
  285. package/dist/v2/store-reader-cgx47zkp.js +14 -0
  286. package/dist/v2/store-reader.d.ts +9 -2
  287. package/dist/v2/store-reader.d.ts.map +1 -1
  288. package/dist/v2/store-z3qe67cg.js +21 -0
  289. package/dist/v2/v2-archive-reader-z7wr42ry.js +11 -0
  290. package/dist/v2/{wrapup-orchestrator-wxf7n5k6.js → wrapup-orchestrator-j1v62bkj.js} +50 -42
  291. package/dist/v2-archive-reader-028z6kck.js +11 -0
  292. package/dist/wrapup-orchestrator-xg9avt2p.js +56 -0
  293. package/package.json +1 -1
  294. package/src/shared/model-suggestion-retry.ts +1 -1
  295. package/src/shared/prompt-async-transport.test.ts +64 -3
  296. package/src/shared/prompt-async-transport.ts +61 -16
  297. package/src/shared/reusable-worker-entry.ts +58 -0
  298. package/src/shared/reusable-worker-reset.test.ts +108 -0
  299. package/src/shared/reusable-worker.fixture.ts +35 -0
  300. package/src/shared/reusable-worker.test.ts +253 -0
  301. package/src/shared/reusable-worker.ts +240 -0
  302. package/src/shared/sqlite-transaction-mode-guard.test.ts +2 -0
  303. package/src/shared/worker-shutdown.ts +21 -17
  304. package/dist/embedding-backfill-0jgtqxen.js +0 -25
  305. package/dist/recomp-orchestrator-0y983w7h.js +0 -62
  306. package/dist/search-archive-1kw2rp19.js +0 -26
  307. package/dist/search-p684j8ww.js +0 -50
  308. package/dist/v2/embedding-backfill-f43hd8y6.js +0 -24
  309. package/dist/v2/recomp-orchestrator-7q9nvxte.js +0 -61
  310. package/dist/v2/search-archive-xfp51s0g.js +0 -25
  311. package/dist/v2/search-wf8rqxhm.js +0 -48
  312. package/dist/wrapup-orchestrator-ys2nrkkb.js +0 -49
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log2
3
- } from "./server-6495nmn9.js";
3
+ } from "./server-jb6tjyeb.js";
4
4
 
5
5
  // src/shared/safe-notification-target.ts
6
6
  var DEFAULT_TITLE_RE = /^(New session - |Child session - )\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d{3}Z$/;
@@ -13,7 +13,7 @@ import {
13
13
  } from "./server-gzy5w8ya.js";
14
14
  import {
15
15
  scheduleAfterBootQuiet
16
- } from "./server-qjvk4a9t.js";
16
+ } from "./server-69m30b21.js";
17
17
  import {
18
18
  getHarness2,
19
19
  harnessOwnsOpenCodeStore2
@@ -21,11 +21,10 @@ import {
21
21
  import {
22
22
  getMagicContextStorageDir,
23
23
  getLegacyOpenCodeMagicContextStorageDir,
24
- sanitizeDiagnosticText,
25
24
  importPluginModule,
26
25
  writeForwardedLogLine2,
27
26
  log2
28
- } from "./server-6495nmn9.js";
27
+ } from "./server-jb6tjyeb.js";
29
28
  import {
30
29
  isOwnRpcServerRecord,
31
30
  isPidAlive,
@@ -36,13 +35,19 @@ import {
36
35
  parseRpcPortFile,
37
36
  inspectProcessesAsync,
38
37
  inspectWindowsProcessesSync
39
- } from "./server-k3t06fxr.js";
38
+ } from "./server-sefxj8k1.js";
40
39
  import {
41
40
  configureContextDatabasePragmas2
42
41
  } from "./server-fb3zxn06.js";
42
+ import {
43
+ attachFailClosedBlockingProcessEvidence
44
+ } from "./server-468mya5v.js";
45
+ import {
46
+ reuseWorker
47
+ } from "./server-96ztjvkn.js";
43
48
  import {
44
49
  startMessageFtsRowidMapBackfill2
45
- } from "./server-awr8qa4c.js";
50
+ } from "./server-nmyganc8.js";
46
51
  import {
47
52
  LKG_SLOT_CHUNKS_DDL,
48
53
  SESSION_REPLAY_DECISIONS_DDL,
@@ -52,12 +57,12 @@ import {
52
57
  hasPendingMigrations,
53
58
  getMainThreadMigrationBodyCount,
54
59
  runMigrations
55
- } from "./server-6g98c227.js";
60
+ } from "./server-3schkz95.js";
56
61
  import {
57
62
  ensureColumn,
58
63
  installV95PerfSchema,
59
64
  installTagIdentityRevisionTrigger
60
- } from "./server-v77xa5wj.js";
65
+ } from "./server-tpt7bwq8.js";
61
66
  import {
62
67
  resolveOpenCodeDbPath,
63
68
  hasV1MessageTables
@@ -65,7 +70,7 @@ import {
65
70
  import {
66
71
  setDatabase,
67
72
  loadToolDefinitionMeasurements
68
- } from "./server-cqjvxyrp.js";
73
+ } from "./server-xy7w7hrd.js";
69
74
  import {
70
75
  getErrorMessage
71
76
  } from "./server-y8v6yerm.js";
@@ -74,7 +79,7 @@ import {
74
79
  } from "./server-8ajstryz.js";
75
80
  import {
76
81
  logSlowWriteTransaction
77
- } from "./server-gyy4k6mf.js";
82
+ } from "./server-qmmkhz2z.js";
78
83
  import {
79
84
  shouldEnforcePrivateStoragePermissions,
80
85
  ensureStorageDirectorySync,
@@ -114,210 +119,6 @@ function ensureContextStoreUuid(db) {
114
119
  return getContextStoreUuid(db) ?? minted;
115
120
  }
116
121
 
117
- // src/features/magic-context/fail-closed-block.ts
118
- var FAIL_CLOSED_DOCTOR_COMMAND = "npx @cortexkit/magic-context@latest doctor";
119
- function attachFailClosedBlockingProcessEvidence(process2, evidence) {
120
- Object.defineProperties(process2, {
121
- startTime: { configurable: true, value: evidence.startTime },
122
- commandLine: { configurable: true, value: evidence.commandLine }
123
- });
124
- return process2;
125
- }
126
-
127
- class FailClosedBlockingError extends Error {
128
- code = "FAIL_CLOSED_BLOCKING";
129
- reason;
130
- constructor(message, reason, options) {
131
- super(message, options);
132
- this.name = "FailClosedBlockingError";
133
- this.reason = reason;
134
- }
135
- }
136
- var OPENCODE_INTERNAL_AGENT_NAMES = new Set(["title", "summary", "compaction"]);
137
- function isMagicContextHiddenAgentName(agent) {
138
- if (agent === "smart-note-compiler" || agent.startsWith("smart-note-")) {
139
- return true;
140
- }
141
- if (agent === "historian" || agent.startsWith("historian-"))
142
- return true;
143
- if (agent === "dreamer" || agent.startsWith("dreamer-"))
144
- return true;
145
- return false;
146
- }
147
- var MAX_FORMATTED_BLOCKING_PROCESSES = 8;
148
- var MAX_FORMATTED_COMMAND_LINE_LENGTH = 80;
149
- function normalizeFailClosedProcessKind(process2) {
150
- switch (process2.kind) {
151
- case "OpenCode server":
152
- case "OpenCode instance (TUI/CLI)":
153
- case "Pi":
154
- case "process":
155
- return process2.kind;
156
- }
157
- switch (process2.harness?.trim().toLowerCase()) {
158
- case "opencode server":
159
- return "OpenCode server";
160
- case "opencode instance (tui/cli)":
161
- case "opencode instance":
162
- return "OpenCode instance (TUI/CLI)";
163
- case "pi":
164
- case "pi harness":
165
- case "omp":
166
- return "Pi";
167
- default:
168
- return "process";
169
- }
170
- }
171
- function formatFailClosedProcessStartTime(startTime) {
172
- if (!Number.isFinite(startTime) || startTime <= 0)
173
- return "unverified";
174
- try {
175
- const parts = new Intl.DateTimeFormat("en-US", {
176
- day: "numeric",
177
- hour: "2-digit",
178
- minute: "2-digit",
179
- month: "short",
180
- hour12: false
181
- }).formatToParts(new Date(startTime));
182
- const values = Object.fromEntries(parts.map(({ type, value }) => [type, value]));
183
- if (!values.month || !values.day || !values.hour || !values.minute)
184
- return "unverified";
185
- return `${values.month} ${values.day} ${values.hour}:${values.minute}`;
186
- } catch {
187
- return "unverified";
188
- }
189
- }
190
- function formatFailClosedCommandLine(commandLine) {
191
- if (typeof commandLine !== "string" || commandLine.trim().length === 0)
192
- return "unverified";
193
- try {
194
- const normalized = commandLine.replaceAll("\x00", " ").replace(/\s+/g, " ").trim();
195
- if (normalized.length === 0)
196
- return "unverified";
197
- const sanitized = sanitizeDiagnosticText(normalized).trim();
198
- if (sanitized.length === 0)
199
- return "unverified";
200
- return sanitized.length > MAX_FORMATTED_COMMAND_LINE_LENGTH ? `${sanitized.slice(0, MAX_FORMATTED_COMMAND_LINE_LENGTH - 3)}...` : sanitized;
201
- } catch {
202
- return "unverified";
203
- }
204
- }
205
- function formatFailClosedBlockingProcesses(processes) {
206
- const uniqueProcesses = new Map;
207
- for (const process2 of processes) {
208
- if (!Number.isInteger(process2.pid) || process2.pid <= 0)
209
- continue;
210
- const candidate = {
211
- kind: normalizeFailClosedProcessKind(process2),
212
- pid: process2.pid,
213
- startTime: process2.startTime,
214
- commandLine: process2.commandLine
215
- };
216
- const previous = uniqueProcesses.get(process2.pid);
217
- if (!previous || previous.kind === "process" && candidate.kind !== "process") {
218
- uniqueProcesses.set(process2.pid, candidate);
219
- } else {
220
- uniqueProcesses.set(process2.pid, {
221
- ...previous,
222
- startTime: previous.startTime ?? candidate.startTime,
223
- commandLine: previous.commandLine ?? candidate.commandLine
224
- });
225
- }
226
- }
227
- const entries = [...uniqueProcesses.values()];
228
- const visible = entries.slice(0, MAX_FORMATTED_BLOCKING_PROCESSES);
229
- const rendered = visible.map(({ kind, pid }) => `${kind} (PID ${pid})`);
230
- const omitted = entries.length - visible.length;
231
- if (omitted > 0)
232
- rendered.push(`${omitted} more blocking process(es)`);
233
- if (rendered.length === 0)
234
- return "a live process";
235
- const summary = rendered.length === 1 ? rendered[0] : `${rendered.slice(0, -1).join(", ")}, and ${rendered.at(-1)}`;
236
- const evidence = entries.map(({ kind, pid, startTime, commandLine }) => `- PID ${pid}: ${kind}, started ${formatFailClosedProcessStartTime(startTime)}, cmd: ${formatFailClosedCommandLine(commandLine)}`).join(`
237
- `);
238
- return `${summary}
239
- Blocking process evidence:
240
- ${evidence}`;
241
- }
242
- function formatFailClosedBlockingMessage(reason) {
243
- if (reason.kind === "migration_guard") {
244
- if (reason.unreadableFile) {
245
- const arm = reason.unreadableArm ?? "io";
246
- const recovery = arm === "io" ? `If none of these processes are running, it is safe to delete ${reason.unreadableFile} and retry.` : `The file may be a recent incomplete write; retry after the file is older than the ten-minute grace window, or stop the relevant process before deleting it.`;
247
- return [
248
- `Magic Context cannot migrate the shared database because RPC discovery file ${reason.unreadableFile} is uncertain (${arm} arm), so the absence of a live process cannot be proven.`,
249
- recovery,
250
- `Recovery: ${FAIL_CLOSED_DOCTOR_COMMAND}`
251
- ].join(" ");
252
- }
253
- return [
254
- `Magic Context cannot migrate the shared database (one database serves every project on this machine) because ${formatFailClosedBlockingProcesses(reason.blockingProcesses)} may be running an older Magic Context build that would fail against the migrated database.`,
255
- `The database is at upstream migration v${reason.persistedVersion}; this build needs v${reason.supportedVersion}.`,
256
- "Restart the blocking process — even one from a different project — and it will pick up the new build and migrate on start; or shut it down and retry.",
257
- "If that host loads a pinned or cached older Magic Context build, a restart alone is not enough: stop it or update its Magic Context build, then start this host once so it migrates the database with nothing older attached.",
258
- `Recovery: ${FAIL_CLOSED_DOCTOR_COMMAND}`
259
- ].join(" ");
260
- }
261
- if (reason.kind === "schema_fence") {
262
- return [
263
- `Magic Context cannot operate: this Magic Context build is older than the database; upgrade/restart this harness (upstream migration lane v${reason.persistedVersion}, build supports through v${reason.supportedVersion}).`,
264
- `Recovery: ${FAIL_CLOSED_DOCTOR_COMMAND}`
265
- ].join(" ");
266
- }
267
- const cause = reason.cause.trim().length > 0 ? reason.cause.trim() : "unknown storage error";
268
- return [
269
- `Magic Context cannot operate: persistent storage failed (${cause}).`,
270
- "The plugin will not silently degrade to native compaction while enabled.",
271
- `Recovery: ${FAIL_CLOSED_DOCTOR_COMMAND}`
272
- ].join(" ");
273
- }
274
- function formatFailClosedBlockingSummary(reason) {
275
- if (reason.kind === "migration_guard") {
276
- if (reason.unreadableFile) {
277
- return `Magic Context cannot migrate the shared database from v${reason.persistedVersion} to v${reason.supportedVersion}: RPC discovery file ${reason.unreadableFile} could not be read, so an older host may still be attached.`;
278
- }
279
- const blockers = reason.blockingProcesses.filter((process2) => Number.isInteger(process2.pid) && process2.pid > 0).map((process2) => `${normalizeFailClosedProcessKind(process2)} (PID ${process2.pid})`);
280
- const named = blockers.length > 0 ? blockers.join(", ") : "a live process";
281
- return `Magic Context cannot migrate the shared database from v${reason.persistedVersion} to v${reason.supportedVersion} while ${named} may still run an older Magic Context build. Stop or update that host, then start this one once.`;
282
- }
283
- if (reason.kind === "schema_fence") {
284
- return `Magic Context cannot operate: the shared database is at v${reason.persistedVersion}, newer than this build supports (v${reason.supportedVersion}). Update and restart this host.`;
285
- }
286
- const cause = reason.cause.trim().length > 0 ? reason.cause.trim() : "unknown storage error";
287
- return `Magic Context cannot operate: persistent storage failed (${cause}).`;
288
- }
289
- function createFailClosedBlockingError(reason, options) {
290
- return new FailClosedBlockingError(formatFailClosedBlockingMessage(reason), reason, options);
291
- }
292
- function isFailClosedBlockingError(error) {
293
- return error instanceof FailClosedBlockingError || typeof error === "object" && error !== null && error.name === "FailClosedBlockingError" && error.code === "FAIL_CLOSED_BLOCKING";
294
- }
295
- function shouldBypassFailClosedBlock(input) {
296
- if (input.isPiSubagentEnv === true)
297
- return true;
298
- if (input.isInternalChildSession === true)
299
- return true;
300
- const agent = typeof input.agent === "string" ? input.agent.trim() : "";
301
- if (agent.length === 0)
302
- return false;
303
- if (OPENCODE_INTERNAL_AGENT_NAMES.has(agent))
304
- return true;
305
- if (isMagicContextHiddenAgentName(agent))
306
- return true;
307
- return false;
308
- }
309
- function resolveAgentNameFromMessages(messages) {
310
- for (let i = messages.length - 1;i >= 0; i -= 1) {
311
- const info = messages[i]?.info;
312
- if (!info || typeof info !== "object")
313
- continue;
314
- const agent = info.agent;
315
- if (typeof agent === "string" && agent.length > 0)
316
- return agent;
317
- }
318
- return;
319
- }
320
-
321
122
  // src/features/magic-context/migration-worker-client.ts
322
123
  import { Worker } from "node:worker_threads";
323
124
 
@@ -424,7 +225,7 @@ function runMigrationsOffThread(data) {
424
225
  return new Promise((resolve, reject) => {
425
226
  let worker;
426
227
  try {
427
- worker = inRootAsyncContext2(() => new Worker(workerEntryOverride ?? defaultWorkerEntry(), { workerData: data }));
228
+ worker = inRootAsyncContext2(() => workerEntryOverride ? new Worker(workerEntryOverride, { workerData: data }) : reuseWorker(defaultWorkerEntry(), { workerData: data }));
428
229
  } catch (error) {
429
230
  reject(workerStartError(error instanceof Error ? error.message : String(error)));
430
231
  return;
@@ -1221,8 +1022,8 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
1221
1022
  state.running = startMessageFtsRowidMapBackfill2(db, signal).then(async () => {
1222
1023
  if (signal.aborted || !readsOpenCodeStore)
1223
1024
  return;
1224
- const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-1fa9qzwb.js"));
1225
- const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-zvthw6xb.js"));
1025
+ const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-tqnh1ret.js"));
1026
+ const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-0c4h7sg6.js"));
1226
1027
  if (signal.aborted)
1227
1028
  return;
1228
1029
  await startMessageTimeBackfill(db, Object.assign(readRawSessionMessages, {
@@ -2726,4 +2527,4 @@ function getDatabasePersistenceError(db) {
2726
2527
  return persistenceErrorByDatabase.get(db) ?? null;
2727
2528
  }
2728
2529
 
2729
- export { FAIL_CLOSED_DOCTOR_COMMAND, formatFailClosedBlockingMessage, formatFailClosedBlockingSummary, createFailClosedBlockingError, isFailClosedBlockingError, shouldBypassFailClosedBlock, resolveAgentNameFromMessages, startBootDeadline, getUnconfirmedMigrationHolders, getSchemaFenceRejection, getMigrationOnOpenRefusal, LATEST_SUPPORTED_VERSION, BOOT_SQLITE_BUSY_TIMEOUT_MS, getDatabasePath, getPersistedSchemaVersion, enforceSchemaFence, setSqlitePragmaConfig, runSqliteOptimize, initializeDatabase, openDatabase, openCurrentDatabase, openDatabaseAsync, isDatabasePersisted, getDatabasePersistenceError };
2530
+ export { startBootDeadline, getUnconfirmedMigrationHolders, getSchemaFenceRejection, getMigrationOnOpenRefusal, LATEST_SUPPORTED_VERSION, BOOT_SQLITE_BUSY_TIMEOUT_MS, getDatabasePath, getPersistedSchemaVersion, enforceSchemaFence, setSqlitePragmaConfig, runSqliteOptimize, initializeDatabase, openDatabase, openCurrentDatabase, openDatabaseAsync, isDatabasePersisted, getDatabasePersistenceError };
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  DEFAULT_LOCAL_EMBEDDING_MODEL
3
- } from "./server-24g8r2d0.js";
3
+ } from "./server-7zacmty5.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-6vzh6wej.js";
14
14
  import {
15
15
  OpenAICompatibleEmbeddingProvider,
16
16
  getProjectEmbeddingSnapshot2,
17
17
  embedBatchForProject2
18
- } from "./server-ab8017gw.js";
18
+ } from "./server-7acq7815.js";
19
19
  import {
20
20
  isEmbeddingHostBusy2
21
21
  } from "./server-qt1qqasc.js";
@@ -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 };