@cortexkit/opencode-magic-context 0.49.48 → 0.49.50

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 (224) hide show
  1. package/dist/{announcement-g789dmt6.js → announcement-9pr71hd5.js} +3 -2
  2. package/dist/auto-search-worker.js +5 -5
  3. package/dist/chunk-embedding-write-worker.js +14 -15
  4. package/dist/{compaction-marker-candidates-dkfp1q9j.js → compaction-marker-candidates-8hazqfvj.js} +2 -3
  5. package/dist/compaction-marker-candidates-worker.js +1 -1
  6. package/dist/{compartment-chunk-embedding-snj51nmg.js → compartment-chunk-embedding-gfd093f8.js} +7 -8
  7. package/dist/config/project-security.d.ts.map +1 -1
  8. package/dist/config/schema/magic-context.d.ts +10 -0
  9. package/dist/config/schema/magic-context.d.ts.map +1 -1
  10. package/dist/{conflict-warning-hook-w1aw6w5t.js → conflict-warning-hook-56qpq7ws.js} +7 -8
  11. package/dist/{context-8r125qv3.js → context-4js5qnnm.js} +61 -49
  12. package/dist/{derive-budgets-nkw09vq7.js → derive-budgets-z53424qx.js} +2 -3
  13. package/dist/embedding-backfill-3wdjzrvs.js +27 -0
  14. package/dist/embedding-worker-process.js +2 -3
  15. package/dist/embedding-worker.js +6 -7
  16. package/dist/features/magic-context/dreamer/docs-proposals.d.ts.map +1 -1
  17. package/dist/features/magic-context/dreamer/provider-output-failure.d.ts +5 -7
  18. package/dist/features/magic-context/dreamer/provider-output-failure.d.ts.map +1 -1
  19. package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
  20. package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
  21. package/dist/features/magic-context/memory/embedding-identity.d.ts.map +1 -1
  22. package/dist/features/magic-context/memory/embedding-openai.d.ts +4 -0
  23. package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -1
  24. package/dist/features/magic-context/memory/embedding-probe.d.ts +10 -0
  25. package/dist/features/magic-context/memory/embedding-probe.d.ts.map +1 -1
  26. package/dist/features/magic-context/memory/embedding.d.ts.map +1 -1
  27. package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
  28. package/dist/features/magic-context/storage-db.d.ts +14 -0
  29. package/dist/features/magic-context/storage-db.d.ts.map +1 -1
  30. package/dist/features/magic-context/transform-decision-log.d.ts +2 -0
  31. package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
  32. package/dist/{history-owner-0z620wgz.js → history-owner-n50e0e8y.js} +2 -3
  33. package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
  34. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
  35. package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
  36. package/dist/hooks/magic-context/protected-tail-boundary.d.ts +5 -3
  37. package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
  38. package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
  39. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  40. package/dist/{index-rvmhyk89.js → index-07rp6xcn.js} +9 -9
  41. package/dist/{index-txs8tce6.js → index-0k283v27.js} +2 -4
  42. package/dist/{index-ak11t3gm.js → index-0tz2fzpq.js} +1 -1
  43. package/dist/{index-2qbtqg1w.js → index-25tm250q.js} +1 -1
  44. package/dist/{index-h9m41624.js → index-2ny9xwdn.js} +2 -2
  45. package/dist/{index-xa9mmq6c.js → index-36wseasx.js} +1 -1
  46. package/dist/{index-cgzpbz78.js → index-5dptmnvd.js} +5 -5
  47. package/dist/{index-q41sm60t.js → index-5g6npyw5.js} +89 -63
  48. package/dist/{index-qsyx931k.js → index-5t1mr0bt.js} +13 -15
  49. package/dist/{index-jrfre9ah.js → index-82dfe8en.js} +146 -5
  50. package/dist/{index-d4qw2h43.js → index-8d7gkgjs.js} +6 -5
  51. package/dist/{index-gn6gfz4y.js → index-90z05d0p.js} +1 -1
  52. package/dist/{index-trkxkgmd.js → index-97bjd14c.js} +5 -5
  53. package/dist/{index-9wnbnx8f.js → index-a6aqpfp6.js} +1 -1
  54. package/dist/{index-s79g172v.js → index-bamnjp2t.js} +29 -13
  55. package/dist/{index-4wpfbzks.js → index-bkg4hdyh.js} +3 -3
  56. package/dist/{index-gp3kcpc4.js → index-cd3vp8xa.js} +1 -1
  57. package/dist/{index-vk6srk5r.js → index-ct3ettqt.js} +3 -3
  58. package/dist/{index-sd2s4t4p.js → index-cwj6qhmf.js} +2 -2
  59. package/dist/{index-brj6was5.js → index-em92bp7f.js} +2 -2
  60. package/dist/{index-2p37txes.js → index-ga5q492k.js} +1 -1
  61. package/dist/{index-8cfnaagj.js → index-gapnh6tk.js} +2 -4
  62. package/dist/{index-fw42ms3m.js → index-gz001bx7.js} +1 -1
  63. package/dist/{index-zetm0ayn.js → index-h8g08nxs.js} +164 -106
  64. package/dist/{index-qcz1fy7h.js → index-hexdee98.js} +4 -4
  65. package/dist/{index-fgft4qjn.js → index-hkveze74.js} +4 -4
  66. package/dist/{index-smtbdmc3.js → index-hsv31e69.js} +2 -2
  67. package/dist/{index-dj2p8653.js → index-hsyczpn7.js} +2 -2
  68. package/dist/{index-4dpvnp8k.js → index-jjy5a5w0.js} +3 -0
  69. package/dist/{index-1hwn96x1.js → index-kn1bx21r.js} +3 -3
  70. package/dist/{index-t6s0tsp7.js → index-mjh63zvw.js} +3 -3
  71. package/dist/{index-ta87fpfs.js → index-n0twfvah.js} +64 -15
  72. package/dist/{index-nj360hcs.js → index-pb8ysnq2.js} +4 -4
  73. package/dist/{index-jz5bk7xd.js → index-qperbvjn.js} +2 -2
  74. package/dist/{index-25ka1jza.js → index-r9agn061.js} +4 -4
  75. package/dist/{index-hkh8x221.js → index-rbs27k1d.js} +7 -7
  76. package/dist/{index-hacf2tyx.js → index-reyws9fy.js} +1 -1
  77. package/dist/{index-cgsmttyj.js → index-s131svmx.js} +4 -4
  78. package/dist/{index-fxbk7gk3.js → index-tad3can2.js} +1 -1
  79. package/dist/{index-8ka0ne8t.js → index-v4a1pnny.js} +6 -6
  80. package/dist/{index-xh3jyejb.js → index-wr2t8zb0.js} +17 -19
  81. package/dist/{index-q6pjqm49.js → index-z4832qfe.js} +14 -14
  82. package/dist/index.js +54 -56
  83. package/dist/{logger-qwnbcfj9.js → logger-sw7z6sjz.js} +1 -2
  84. package/dist/{message-fts-rowid-map-msffhkve.js → message-fts-rowid-map-kx1bsdyg.js} +4 -5
  85. package/dist/{message-index-bounded-0q7sy04w.js → message-index-bounded-k0ebpy3y.js} +12 -13
  86. package/dist/{message-time-backfill-39bm498k.js → message-time-backfill-hp2jgn49.js} +2 -3
  87. package/dist/migration-worker.js +12 -13
  88. package/dist/plugin/embedding-bootstrap-helpers.d.ts.map +1 -1
  89. package/dist/plugin/embedding-routing.d.ts.map +1 -1
  90. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  91. package/dist/plugin/rpc-handlers.d.ts.map +1 -1
  92. package/dist/{project-embedding-registry-r6xfsrbe.js → project-embedding-registry-5dwh5zfn.js} +12 -13
  93. package/dist/raw-ordinal-warmup-worker.js +8 -8
  94. package/dist/{read-session-chunk-7fmg9p5m.js → read-session-chunk-6712p893.js} +10 -11
  95. package/dist/{read-session-raw-x7a9b3jm.js → read-session-raw-04ger9zt.js} +2 -3
  96. package/dist/{recomp-orchestrator-jqa5z4ar.js → recomp-orchestrator-8ebydg5j.js} +31 -32
  97. package/dist/render-dtc4qkq4.js +43 -0
  98. package/dist/{safe-notification-target-wztd7bgk.js → safe-notification-target-mx5khyxf.js} +2 -3
  99. package/dist/{search-archive-df09r8qn.js → search-archive-f6hjbnsa.js} +12 -13
  100. package/dist/{search-kt764afk.js → search-edv0gy1d.js} +24 -25
  101. package/dist/{send-session-notification-j93pn2hn.js → send-session-notification-gamjee2f.js} +5 -6
  102. package/dist/shared/data-path.d.ts +7 -13
  103. package/dist/shared/data-path.d.ts.map +1 -1
  104. package/dist/shared/hidden-model-cooldown.d.ts +23 -0
  105. package/dist/shared/hidden-model-cooldown.d.ts.map +1 -0
  106. package/dist/shared/model-suggestion-retry.d.ts +0 -2
  107. package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
  108. package/dist/shared/provider-response-completion.d.ts +10 -0
  109. package/dist/shared/provider-response-completion.d.ts.map +1 -1
  110. package/dist/shared/rpc-types.d.ts +1 -0
  111. package/dist/shared/rpc-types.d.ts.map +1 -1
  112. package/dist/shared/status-summary.d.ts +1 -0
  113. package/dist/shared/status-summary.d.ts.map +1 -1
  114. package/dist/shared/status-view-check.d.ts.map +1 -1
  115. package/dist/shared/status-view.d.ts +1 -0
  116. package/dist/shared/status-view.d.ts.map +1 -1
  117. package/dist/shared/test-db.d.ts +13 -0
  118. package/dist/shared/test-db.d.ts.map +1 -0
  119. package/dist/{storage-tags-96vyd6ra.js → storage-tags-kdb4qsyq.js} +4 -5
  120. package/dist/test-preload.d.ts +2 -0
  121. package/dist/test-preload.d.ts.map +1 -0
  122. package/dist/{transform-postprocess-phase-a7ety10n.js → transform-postprocess-phase-1bg25094.js} +32 -33
  123. package/dist/v2/auto-search-worker.js +5 -5
  124. package/dist/v2/chunk-embedding-write-worker.js +14 -14
  125. package/dist/v2/{compaction-marker-candidates-y737qb1v.js → compaction-marker-candidates-re14353a.js} +2 -2
  126. package/dist/v2/compaction-marker-candidates-worker.js +1 -1
  127. package/dist/v2/{compartment-chunk-embedding-nj5nrnbj.js → compartment-chunk-embedding-0pxsrzrt.js} +7 -7
  128. package/dist/v2/{context-9x7mnb7x.js → context-qkr7z6d0.js} +99 -63
  129. package/dist/v2/{derive-budgets-b5cgrtp8.js → derive-budgets-w0815q82.js} +3 -3
  130. package/dist/v2/embedding-backfill-x1zpc04f.js +27 -0
  131. package/dist/v2/embedding-worker-process.js +1 -1
  132. package/dist/v2/embedding-worker.js +5 -5
  133. package/dist/v2/hidden-completion.d.ts.map +1 -1
  134. package/dist/v2/{history-owner-fpka43cn.js → history-owner-ep91wgqj.js} +2 -2
  135. package/dist/v2/hooks/context.d.ts.map +1 -1
  136. package/dist/v2/hooks/usage-persist.d.ts +1 -1
  137. package/dist/v2/hooks/usage-persist.d.ts.map +1 -1
  138. package/dist/v2/hooks/usage-reading.d.ts +3 -0
  139. package/dist/v2/hooks/usage-reading.d.ts.map +1 -1
  140. package/dist/v2/{logger-4cj6d03m.js → logger-xnscpj6w.js} +1 -1
  141. package/dist/v2/{message-fts-rowid-map-qe7cpksd.js → message-fts-rowid-map-57jh6xpb.js} +4 -4
  142. package/dist/v2/{message-index-bounded-hctgp22r.js → message-index-bounded-a36rw93p.js} +12 -12
  143. package/dist/v2/{message-time-backfill-0c4h7sg6.js → message-time-backfill-baxebka0.js} +2 -2
  144. package/dist/v2/migration-worker.js +11 -11
  145. package/dist/v2/{project-embedding-registry-ek0cy0d5.js → project-embedding-registry-v2fxrs8b.js} +12 -12
  146. package/dist/v2/raw-ordinal-warmup-worker.js +8 -8
  147. package/dist/v2/{read-session-chunk-zknadvjr.js → read-session-chunk-hzhxvhyv.js} +10 -10
  148. package/dist/v2/{read-session-raw-yss2ev98.js → read-session-raw-3e482h3c.js} +2 -2
  149. package/dist/v2/{recomp-orchestrator-m5w0eqke.js → recomp-orchestrator-yzr49pd0.js} +32 -32
  150. package/dist/v2/{render-89asy54r.js → render-rhaevxv1.js} +21 -21
  151. package/dist/v2/{safe-notification-target-gphhast7.js → safe-notification-target-9r79xnbt.js} +2 -2
  152. package/dist/v2/{search-archive-axz2gbdb.js → search-archive-9924fyk8.js} +12 -12
  153. package/dist/v2/{search-kdtja5rx.js → search-ggvexvv7.js} +23 -23
  154. package/dist/v2/{send-session-notification-na3q825m.js → send-session-notification-95p89k7q.js} +5 -5
  155. package/dist/v2/{server-yyqmvbvv.js → server-016a1whm.js} +161 -102
  156. package/dist/v2/{server-z3tyd1mx.js → server-0k586y7d.js} +3 -3
  157. package/dist/v2/{server-p9s40wfa.js → server-0ms13pc8.js} +3 -0
  158. package/dist/v2/{server-e3m10ds0.js → server-16kfxcxj.js} +4 -4
  159. package/dist/v2/{server-nn4hbymt.js → server-3bfc26r7.js} +9 -9
  160. package/dist/v2/{server-7vb38e51.js → server-3jc6qmdz.js} +1 -1
  161. package/dist/v2/{server-jra7awr5.js → server-3qf9n5ck.js} +11 -11
  162. package/dist/v2/{server-69m30b21.js → server-3yk44ddz.js} +1 -1
  163. package/dist/v2/{server-2gjqhmn9.js → server-4h4acntc.js} +27 -11
  164. package/dist/v2/{server-3schkz95.js → server-58h6rrnx.js} +4 -4
  165. package/dist/v2/{server-af1rmkyn.js → server-5kgesxck.js} +2 -2
  166. package/dist/v2/{server-mfn1yf9d.js → server-7vrtk78d.js} +1 -1
  167. package/dist/v2/{server-27kccwe7.js → server-88yvx6r9.js} +63 -12
  168. package/dist/v2/{server-f0j864ma.js → server-91gb0vh8.js} +1 -1
  169. package/dist/v2/{server-131h608x.js → server-966dq3pd.js} +2 -2
  170. package/dist/v2/{server-jb6tjyeb.js → server-bb6kf05j.js} +23 -20
  171. package/dist/v2/{server-sg2qjkrb.js → server-brsx45r6.js} +6 -4
  172. package/dist/v2/{server-gwxys0d0.js → server-c8z2grq0.js} +1 -1
  173. package/dist/v2/{server-y8n33d9j.js → server-g61hgy1y.js} +4 -4
  174. package/dist/v2/{server-zahgxer8.js → server-jxrqsn84.js} +3 -3
  175. package/dist/v2/{server-2j87594q.js → server-kgq2e2hh.js} +2 -2
  176. package/dist/v2/{server-ddw42d76.js → server-mxsy9h1d.js} +2 -2
  177. package/dist/v2/{server-qmmkhz2z.js → server-np27dgyt.js} +1 -1
  178. package/dist/v2/{server-jqn7q7tm.js → server-q93jdtz8.js} +5 -5
  179. package/dist/v2/{server-dcws5831.js → server-qp5sj6n5.js} +2 -2
  180. package/dist/v2/{server-7be0ersd.js → server-rcchadw0.js} +3 -3
  181. package/dist/v2/{server-b3r080cm.js → server-rz5jnhnv.js} +1 -1
  182. package/dist/v2/{server-zt1m5rwj.js → server-sa1fdt41.js} +1 -1
  183. package/dist/v2/{server-wa4qhryh.js → server-sb55ddgn.js} +5 -4
  184. package/dist/v2/{server-4x7n5qz7.js → server-scp3y4dh.js} +13 -11
  185. package/dist/v2/{server-pej5rnye.js → server-sgn61hht.js} +2 -2
  186. package/dist/v2/{server-ypf1ap0v.js → server-t8n27rbt.js} +1 -1
  187. package/dist/v2/{server-sefxj8k1.js → server-tmf0ayqp.js} +1 -1
  188. package/dist/v2/{server-sr8tf5dt.js → server-vjadwb3j.js} +6 -5
  189. package/dist/v2/{server-bez34e60.js → server-vqq3g1t7.js} +4 -4
  190. package/dist/v2/{server-tpt7bwq8.js → server-ww7xbxxf.js} +1 -1
  191. package/dist/v2/server.js +6 -6
  192. package/dist/v2/{storage-tags-xq8hjqkf.js → storage-tags-rzv7y0n3.js} +4 -4
  193. package/dist/v2/{v2-archive-reader-ky1wqcws.js → v2-archive-reader-5ggewg8q.js} +1 -1
  194. package/dist/v2/{wrapup-orchestrator-6wt67saz.js → wrapup-orchestrator-36c5wyvq.js} +32 -32
  195. package/dist/{v2-archive-reader-665x2x4d.js → v2-archive-reader-gx5ke1d7.js} +1 -1
  196. package/dist/wrapup-orchestrator-ya31knav.js +55 -0
  197. package/package.json +1 -1
  198. package/src/config/index.test.ts +20 -0
  199. package/src/config/project-security.test.ts +5 -1
  200. package/src/config/project-security.ts +4 -0
  201. package/src/config/schema/magic-context.test.ts +43 -0
  202. package/src/config/schema/magic-context.ts +19 -0
  203. package/src/shared/data-path.test.ts +104 -56
  204. package/src/shared/data-path.ts +30 -30
  205. package/src/shared/hidden-model-cooldown.test.ts +117 -0
  206. package/src/shared/hidden-model-cooldown.ts +123 -0
  207. package/src/shared/model-suggestion-retry.test.ts +53 -76
  208. package/src/shared/model-suggestion-retry.ts +38 -53
  209. package/src/shared/provider-response-completion.test.ts +49 -0
  210. package/src/shared/provider-response-completion.ts +64 -0
  211. package/src/shared/rpc-types.ts +1 -0
  212. package/src/shared/startup-maintenance-policy.test.ts +115 -0
  213. package/src/shared/status-detail-text.test.ts +7 -0
  214. package/src/shared/status-summary.ts +3 -0
  215. package/src/shared/status-view-check.ts +1 -0
  216. package/src/shared/status-view.test.ts +15 -0
  217. package/src/shared/status-view.ts +11 -1
  218. package/src/shared/test-db.test.ts +84 -0
  219. package/src/shared/test-db.ts +36 -0
  220. package/dist/embedding-backfill-kpy5shsa.js +0 -28
  221. package/dist/index-g2q4htwp.js +0 -146
  222. package/dist/render-mnqc74ar.js +0 -44
  223. package/dist/v2/embedding-backfill-360efh1t.js +0 -27
  224. package/dist/wrapup-orchestrator-7kmb3jf9.js +0 -56
@@ -3,22 +3,22 @@ import {
3
3
  removeNestedBlocks,
4
4
  hasMeaningfulUserText2,
5
5
  extractTexts2
6
- } from "./server-7vb38e51.js";
6
+ } from "./server-3jc6qmdz.js";
7
7
  import {
8
8
  getHarness2
9
9
  } from "./server-pavzsdc6.js";
10
10
  import {
11
11
  cleanUserText2
12
- } from "./server-nn4hbymt.js";
12
+ } from "./server-3bfc26r7.js";
13
13
  import {
14
14
  recordMessageFtsRowid2,
15
15
  recordIndexedMessageTime2,
16
16
  messageFtsOrdinalRangeIsMapped2,
17
17
  deleteUnmappedMessageFtsRows2
18
- } from "./server-131h608x.js";
18
+ } from "./server-966dq3pd.js";
19
19
  import {
20
20
  logSlowWriteTransaction
21
- } from "./server-qmmkhz2z.js";
21
+ } from "./server-np27dgyt.js";
22
22
 
23
23
  // src/features/magic-context/message-index.ts
24
24
  import { createHash } from "node:crypto";
@@ -18,7 +18,7 @@ import {
18
18
  TAG_SELECT_COLUMNS2,
19
19
  getCandidateToolOwners2,
20
20
  pickNearestPriorOwner2
21
- } from "./server-7be0ersd.js";
21
+ } from "./server-rcchadw0.js";
22
22
  import {
23
23
  OMO_INTERNAL_INITIATOR_MARKER,
24
24
  isSystemDirective,
@@ -36,24 +36,24 @@ import {
36
36
  formatBlock,
37
37
  compactTextForSummary,
38
38
  mergeCommitHashes
39
- } from "./server-7vb38e51.js";
39
+ } from "./server-3jc6qmdz.js";
40
40
  import {
41
41
  getHarness2
42
42
  } from "./server-pavzsdc6.js";
43
43
  import {
44
44
  sessionLog2
45
- } from "./server-jb6tjyeb.js";
45
+ } from "./server-bb6kf05j.js";
46
46
  import {
47
47
  prepareCachedStatement2
48
48
  } from "./server-gzy5w8ya.js";
49
49
  import {
50
50
  stableStringify
51
- } from "./server-tpt7bwq8.js";
51
+ } from "./server-ww7xbxxf.js";
52
52
  import {
53
53
  renderToolTemplate,
54
54
  resolveModelConfigValue,
55
55
  deriveDefaultProtectedTokens
56
- } from "./server-p9s40wfa.js";
56
+ } from "./server-0ms13pc8.js";
57
57
  import {
58
58
  readRawSessionMessagesFromDb2,
59
59
  readRawSessionMessagePageFromDb2,
@@ -70,18 +70,18 @@ import {
70
70
  readRawSeedTailFromDb2,
71
71
  readRawSessionBoundaryEndpointsFromDb2,
72
72
  prewarmRawSessionOrdinalsForDb
73
- } from "./server-b3r080cm.js";
73
+ } from "./server-rz5jnhnv.js";
74
74
  import {
75
75
  openCodeDbExists,
76
76
  withReadOnlySessionDb,
77
77
  getRawSessionMessageCountFromDb,
78
78
  getMessageTimesFromOpenCodeDb
79
- } from "./server-mfn1yf9d.js";
79
+ } from "./server-7vrtk78d.js";
80
80
  import {
81
81
  getToolDefinitionMeasurementSignature,
82
82
  getMeasuredToolDefinitionTokens,
83
83
  getSessionToolDefinitionTokens
84
- } from "./server-2j87594q.js";
84
+ } from "./server-kgq2e2hh.js";
85
85
  import {
86
86
  markHostUnservedRow,
87
87
  isHostUnservedRow
@@ -92,7 +92,7 @@ import {
92
92
  } from "./server-avwt563y.js";
93
93
  import {
94
94
  logSlowWriteTransaction
95
- } from "./server-qmmkhz2z.js";
95
+ } from "./server-np27dgyt.js";
96
96
  // src/shared/historian-tool-defaults.json
97
97
  var historian_tool_defaults_default = {
98
98
  ctx_note: "Note ${input.action} ${input.note_ids}: ${input.content} → ${output.truncate(160)}",
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log2
3
- } from "./server-jb6tjyeb.js";
3
+ } from "./server-bb6kf05j.js";
4
4
 
5
5
  // src/hooks/magic-context/read-session-formatting.ts
6
6
  import { existsSync, readFileSync, realpathSync, statSync } from "node:fs";
@@ -5,17 +5,17 @@ import {
5
5
  getDataDir,
6
6
  log2,
7
7
  sessionLog2
8
- } from "./server-jb6tjyeb.js";
8
+ } from "./server-bb6kf05j.js";
9
9
  import {
10
10
  inRootAsyncContext2,
11
11
  withSqliteBackgroundWriter2
12
12
  } from "./server-gzy5w8ya.js";
13
13
  import {
14
14
  scheduleAfterBootQuiet
15
- } from "./server-69m30b21.js";
15
+ } from "./server-3yk44ddz.js";
16
16
  import {
17
17
  isRecord
18
- } from "./server-7be0ersd.js";
18
+ } from "./server-rcchadw0.js";
19
19
  import {
20
20
  cleanSearchText,
21
21
  hintKeywordRelevance,
@@ -25,7 +25,7 @@ import {
25
25
  isMessageIndexReconciledThrough,
26
26
  clearIndexedMessages,
27
27
  indexMessagesAfterOrdinal
28
- } from "./server-e3m10ds0.js";
28
+ } from "./server-16kfxcxj.js";
29
29
  import {
30
30
  Priority,
31
31
  AdmissionClass,
@@ -34,13 +34,13 @@ import {
34
34
  StaleRouteHandleError,
35
35
  SubcClient,
36
36
  isConsumerReconnectTransient
37
- } from "./server-ddw42d76.js";
37
+ } from "./server-mxsy9h1d.js";
38
38
  import {
39
39
  buildCanonicalChunkTextFromFts2,
40
40
  loadCompartmentChunkEmbeddingsForSearch2,
41
41
  peekCompartmentChunkSearchPool2,
42
42
  warmCompartmentChunkSearchPool2
43
- } from "./server-y8n33d9j.js";
43
+ } from "./server-g61hgy1y.js";
44
44
  import {
45
45
  saveCommitEmbedding,
46
46
  loadProjectCommitEmbeddings,
@@ -56,7 +56,7 @@ import {
56
56
  enqueueShadowEmbeddingItems2,
57
57
  getProjectEmbeddingSnapshot2,
58
58
  embedItemsForProject2
59
- } from "./server-2gjqhmn9.js";
59
+ } from "./server-4h4acntc.js";
60
60
  import {
61
61
  recordEmbeddingMeasurement
62
62
  } from "./server-2amn2s73.js";
@@ -68,7 +68,7 @@ import {
68
68
  isEmbeddingEnabled,
69
69
  embedText,
70
70
  ensureMemoryEmbeddings2
71
- } from "./server-sr8tf5dt.js";
71
+ } from "./server-vjadwb3j.js";
72
72
  import {
73
73
  ModuleMemoryAuthorityError2,
74
74
  getMemoriesByProject2,
@@ -81,7 +81,7 @@ import {
81
81
  sanitizeFtsQuery,
82
82
  searchMemoriesFTS,
83
83
  searchMemoriesFTSUnion
84
- } from "./server-pej5rnye.js";
84
+ } from "./server-sgn61hht.js";
85
85
  import {
86
86
  MESSAGE_FTS_SESSION_FILTER_SQL,
87
87
  withMessageFtsSessionFilter
@@ -92,11 +92,11 @@ import {
92
92
  expandWorkspaceIdentitySetWithAliases,
93
93
  resolveStoredPathWorkspaceIdentity,
94
94
  sourceNameForMemory
95
- } from "./server-3schkz95.js";
95
+ } from "./server-58h6rrnx.js";
96
96
  import {
97
97
  getNotes,
98
98
  getActivePrimers
99
- } from "./server-ypf1ap0v.js";
99
+ } from "./server-t8n27rbt.js";
100
100
  import {
101
101
  isKnownAutocommit
102
102
  } from "./server-8ajstryz.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getMagicContextStorageDir,
3
3
  log2
4
- } from "./server-jb6tjyeb.js";
4
+ } from "./server-bb6kf05j.js";
5
5
  import {
6
6
  inRootAsyncContext2
7
7
  } from "./server-gzy5w8ya.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_LOCAL_EMBEDDING_MODEL
3
- } from "./server-p9s40wfa.js";
3
+ } from "./server-0ms13pc8.js";
4
4
  import {
5
5
  embedPauseBySession,
6
6
  activeEmbeddingSessions,
@@ -15,7 +15,7 @@ import {
15
15
  } from "./server-gzy5w8ya.js";
16
16
  import {
17
17
  setBootQuietPeriodForTests
18
- } from "./server-69m30b21.js";
18
+ } from "./server-3yk44ddz.js";
19
19
  import {
20
20
  isEmbeddingHostBusy2
21
21
  } from "./server-qt1qqasc.js";
@@ -24,7 +24,7 @@ import {
24
24
  } from "./server-pavzsdc6.js";
25
25
  import {
26
26
  log2
27
- } from "./server-jb6tjyeb.js";
27
+ } from "./server-bb6kf05j.js";
28
28
  import {
29
29
  sanitizeDiagnosticText
30
30
  } from "./server-z4p0ry94.js";
@@ -39,10 +39,10 @@ import {
39
39
  isSynapseEmbeddingTruncated,
40
40
  getSynapseBatchRequestKey,
41
41
  SynapseEmbeddingProvider
42
- } from "./server-ddw42d76.js";
42
+ } from "./server-mxsy9h1d.js";
43
43
  import {
44
44
  estimateTokens
45
- } from "./server-7vb38e51.js";
45
+ } from "./server-3jc6qmdz.js";
46
46
  import {
47
47
  DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS2,
48
48
  CHUNK_WINDOW_SAFETY_RATIO2,
@@ -60,7 +60,7 @@ import {
60
60
  countSessionCompartmentEmbedCoverage2,
61
61
  countSessionCompartmentEmbedCoveragePolite2,
62
62
  countUnembeddedSessionCompartmentsPolite2
63
- } from "./server-y8n33d9j.js";
63
+ } from "./server-g61hgy1y.js";
64
64
  import {
65
65
  acquireGitSweepLease,
66
66
  renewGitSweepLease,
@@ -68,7 +68,7 @@ import {
68
68
  findMisScopedCompartmentChunkEmbeddingIdsForProject,
69
69
  recordSessionProjectIdentity,
70
70
  repairMisScopedCompartmentChunkEmbeddingsForProject
71
- } from "./server-dcws5831.js";
71
+ } from "./server-qp5sj6n5.js";
72
72
  import {
73
73
  saveEmbeddingIfHashMatches,
74
74
  getMemoryEmbedCoverage,
@@ -83,13 +83,13 @@ import {
83
83
  logLocalEmbeddingPoolingUnavailableOnce,
84
84
  getEmbeddingProviderIdentity,
85
85
  LocalEmbeddingProvider
86
- } from "./server-sg2qjkrb.js";
86
+ } from "./server-brsx45r6.js";
87
87
  import {
88
88
  isKnownAutocommit
89
89
  } from "./server-8ajstryz.js";
90
90
  import {
91
91
  logSlowWriteTransaction
92
- } from "./server-qmmkhz2z.js";
92
+ } from "./server-np27dgyt.js";
93
93
 
94
94
  // src/features/magic-context/project-embedding-registry.ts
95
95
  import { createHash as createHash2, randomUUID } from "node:crypto";
@@ -592,6 +592,7 @@ class OpenAICompatibleEmbeddingProvider {
592
592
  queryPrefix;
593
593
  documentPrefix;
594
594
  truncate;
595
+ dimensions;
595
596
  initialized = false;
596
597
  failureTimes = [];
597
598
  circuitOpenUntil = 0;
@@ -611,6 +612,7 @@ class OpenAICompatibleEmbeddingProvider {
611
612
  this.queryPrefix = prefixes.queryPrefix;
612
613
  this.documentPrefix = prefixes.documentPrefix;
613
614
  this.truncate = options.truncate?.trim() ?? "";
615
+ this.dimensions = typeof options.dimensions === "number" && Number.isInteger(options.dimensions) && options.dimensions > 0 ? options.dimensions : undefined;
614
616
  this.rateLimitKey = rateLimitStateKey(this.endpoint, this.apiKey);
615
617
  const maxInputTokensSet = typeof options.maxInputTokens === "number" && Number.isFinite(options.maxInputTokens);
616
618
  this.maxInputTokens = maxInputTokensSet ? Math.max(1, Math.floor(options.maxInputTokens)) : DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS2;
@@ -628,7 +630,8 @@ class OpenAICompatibleEmbeddingProvider {
628
630
  ...this.apiKey ? { api_key: this.apiKey } : {},
629
631
  ...this.inputType ? { input_type: this.inputType } : {},
630
632
  ...options.documentPrefix !== undefined ? { document_prefix: options.documentPrefix } : {},
631
- ...this.truncate ? { truncate: this.truncate } : {}
633
+ ...this.truncate ? { truncate: this.truncate } : {},
634
+ ...this.dimensions ? { dimensions: this.dimensions } : {}
632
635
  });
633
636
  }
634
637
  async initialize() {
@@ -734,7 +737,8 @@ class OpenAICompatibleEmbeddingProvider {
734
737
  model: this.model,
735
738
  input: requestTexts,
736
739
  ...inputTypeForRequest ? { input_type: inputTypeForRequest } : {},
737
- ...this.truncate ? { truncate: this.truncate } : {}
740
+ ...this.truncate ? { truncate: this.truncate } : {},
741
+ ...this.dimensions ? { dimensions: this.dimensions } : {}
738
742
  }),
739
743
  redirect: "error",
740
744
  signal: internalController.signal
@@ -807,6 +811,16 @@ class OpenAICompatibleEmbeddingProvider {
807
811
  results[slot] = Float32Array.from(embedding);
808
812
  }
809
813
  });
814
+ if (this.dimensions !== undefined) {
815
+ const requested = this.dimensions;
816
+ const returned = results.find((r) => r !== null && r.length !== requested)?.length;
817
+ if (returned !== undefined) {
818
+ const failure = this.failure("invalid_envelope", `requested dimensions=${requested} but endpoint returned ${returned}-dim vectors; the endpoint may not support the dimensions parameter for this model`, false);
819
+ log2(`[magic-context] openai-compatible embedding request failed: ${failure.reason}`);
820
+ this.recordFailure(requestStartedAt, isProbe, failure);
821
+ return Array.from({ length: texts.length }, () => null);
822
+ }
823
+ }
810
824
  if (results.every((r) => r === null)) {
811
825
  const failure = this.failure("invalid_envelope", `response had keys [${responseKeys.join(", ")}] but data[].embedding was absent`, false);
812
826
  log2(`[magic-context] openai-compatible embedding request failed: ${failure.reason}`);
@@ -1256,6 +1270,7 @@ function resolveEmbeddingConfig(config) {
1256
1270
  ...config.query_instruction !== undefined ? { query_instruction: config.query_instruction } : {},
1257
1271
  ...config.document_prefix !== undefined ? { document_prefix: config.document_prefix } : {},
1258
1272
  ...truncate ? { truncate } : {},
1273
+ ...config.dimensions ? { dimensions: config.dimensions } : {},
1259
1274
  ...config.max_input_tokens ? {
1260
1275
  max_input_tokens: normalizeCompartmentChunkMaxInputTokens2(config.max_input_tokens)
1261
1276
  } : {}
@@ -1305,6 +1320,7 @@ function createProvider(config, context) {
1305
1320
  queryInstruction: config.query_instruction,
1306
1321
  documentPrefix: config.document_prefix,
1307
1322
  truncate: config.truncate,
1323
+ dimensions: config.dimensions,
1308
1324
  maxInputTokens: config.max_input_tokens
1309
1325
  });
1310
1326
  }
@@ -3,12 +3,12 @@ import {
3
3
  } from "./server-fr0wbhdn.js";
4
4
  import {
5
5
  log2
6
- } from "./server-jb6tjyeb.js";
6
+ } from "./server-bb6kf05j.js";
7
7
  import {
8
8
  ensureColumn,
9
9
  healAllNullColumns,
10
10
  installV95PerfSchema
11
- } from "./server-tpt7bwq8.js";
11
+ } from "./server-ww7xbxxf.js";
12
12
  import {
13
13
  resolveOpenCodeDbPath,
14
14
  openCodeDbPathExists,
@@ -20,10 +20,10 @@ import {
20
20
  import {
21
21
  normalizeStoredProjectPath,
22
22
  storedPathBelongsToIdentity
23
- } from "./server-69m30b21.js";
23
+ } from "./server-3yk44ddz.js";
24
24
  import {
25
25
  logSlowWriteTransaction
26
- } from "./server-qmmkhz2z.js";
26
+ } from "./server-np27dgyt.js";
27
27
 
28
28
  // src/features/magic-context/migrations.ts
29
29
  import { isMainThread } from "node:worker_threads";
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  log2
3
- } from "./server-jb6tjyeb.js";
3
+ } from "./server-bb6kf05j.js";
4
4
  import {
5
5
  getSdkWindowGeometry,
6
6
  getSdkContextLimit,
7
7
  getSdkInputLimit
8
- } from "./server-zt1m5rwj.js";
8
+ } from "./server-sa1fdt41.js";
9
9
  import {
10
10
  localBudget,
11
11
  calibrationForModelKey
@@ -4,7 +4,7 @@ import {
4
4
  } from "./server-pavzsdc6.js";
5
5
  import {
6
6
  log2
7
- } from "./server-jb6tjyeb.js";
7
+ } from "./server-bb6kf05j.js";
8
8
  import {
9
9
  resolveOpenCodeDbPath,
10
10
  assertOpenCodeStoreGeneration,
@@ -10,7 +10,7 @@ import {
10
10
  getMagicContextStorageDir,
11
11
  log2,
12
12
  sessionLog2
13
- } from "./server-jb6tjyeb.js";
13
+ } from "./server-bb6kf05j.js";
14
14
  import {
15
15
  prepareCachedStatement2,
16
16
  withSqliteBackgroundWriter2,
@@ -18,14 +18,14 @@ import {
18
18
  } from "./server-gzy5w8ya.js";
19
19
  import {
20
20
  deleteUnmappedMessageFtsRows2
21
- } from "./server-131h608x.js";
21
+ } from "./server-966dq3pd.js";
22
22
  import {
23
23
  deleteChunkEmbedBackoffForSession2
24
- } from "./server-y8n33d9j.js";
24
+ } from "./server-g61hgy1y.js";
25
25
  import {
26
26
  isPidAlive,
27
27
  readProcessStartTime
28
- } from "./server-sefxj8k1.js";
28
+ } from "./server-tmf0ayqp.js";
29
29
  import {
30
30
  MERGED_REASONING_PARTS_PREFIX,
31
31
  decodeMergedReasoningParts,
@@ -53,7 +53,7 @@ import {
53
53
  serializeProcessedImageMarkers,
54
54
  getPendingPiCompactionMarkerState,
55
55
  logPiCompactionMarkerClear
56
- } from "./server-nn4hbymt.js";
56
+ } from "./server-3bfc26r7.js";
57
57
  import {
58
58
  getTableColumnNames,
59
59
  tagTombstoneOwnerRange,
@@ -61,23 +61,23 @@ import {
61
61
  tagRevisionKey,
62
62
  tagIdentityRevisionKey,
63
63
  deleteTagIdentityRevisions
64
- } from "./server-tpt7bwq8.js";
64
+ } from "./server-ww7xbxxf.js";
65
65
  import {
66
66
  stripTagPrefix,
67
67
  isRecord,
68
68
  providerVisibleMessage
69
- } from "./server-7be0ersd.js";
69
+ } from "./server-rcchadw0.js";
70
70
  import {
71
71
  withReadOnlySessionDb
72
- } from "./server-mfn1yf9d.js";
72
+ } from "./server-7vrtk78d.js";
73
73
  import {
74
74
  BoundedSessionMap,
75
75
  getMeasuredToolDefinitionTokens
76
- } from "./server-2j87594q.js";
76
+ } from "./server-kgq2e2hh.js";
77
77
  import {
78
78
  layoutLkgPrefix,
79
79
  assembleLkgPrefix
80
- } from "./server-3schkz95.js";
80
+ } from "./server-58h6rrnx.js";
81
81
  import {
82
82
  gaDatabasePath2,
83
83
  V2StoreReader2
@@ -94,7 +94,7 @@ import {
94
94
  } from "./server-avwt563y.js";
95
95
  import {
96
96
  logSlowWriteTransaction
97
- } from "./server-qmmkhz2z.js";
97
+ } from "./server-np27dgyt.js";
98
98
  import {
99
99
  ensurePrivateStorageDirectorySync,
100
100
  writeStorageFileSync,
@@ -589,6 +589,57 @@ import { createHash as createHash6 } from "node:crypto";
589
589
  import { createHash as createHash4 } from "node:crypto";
590
590
 
591
591
  // src/shared/provider-response-completion.ts
592
+ var SERVER_FALLBACK_USAGE_SIGNATURE_PREFIX = "cortexkit-server-fallback-usage-v1:";
593
+ var SERVER_FALLBACK_SIGNATURE_PREFIX = "cortexkit-server-fallback-v1:";
594
+ function parseServerFallbackInputTokens(json) {
595
+ try {
596
+ const payload = JSON.parse(json);
597
+ if (!isRecord(payload) || !Array.isArray(payload.iterations))
598
+ return;
599
+ let last;
600
+ for (const entry of payload.iterations) {
601
+ if (isRecord(entry) && entry.type === "fallback_message")
602
+ last = entry;
603
+ }
604
+ if (!isRecord(last))
605
+ return;
606
+ const counts = [
607
+ last.input_tokens,
608
+ last.cache_read_input_tokens ?? 0,
609
+ last.cache_creation_input_tokens ?? 0
610
+ ];
611
+ if (!counts.every((count) => typeof count === "number" && Number.isFinite(count) && count >= 0))
612
+ return;
613
+ const inputTokens = counts.reduce((sum, count) => sum + Number(count), 0);
614
+ return Number.isFinite(inputTokens) ? inputTokens : undefined;
615
+ } catch {
616
+ return;
617
+ }
618
+ }
619
+ function readServerFallbackUsage(content) {
620
+ if (!Array.isArray(content))
621
+ return;
622
+ let boundary = false;
623
+ let invalidUsage = false;
624
+ for (const part of content) {
625
+ if (!isRecord(part) || part.type !== "reasoning")
626
+ continue;
627
+ for (const location of [part.native, part.state]) {
628
+ if (!isRecord(location) || typeof location.signature !== "string")
629
+ continue;
630
+ const signature = location.signature;
631
+ if (signature.startsWith(SERVER_FALLBACK_USAGE_SIGNATURE_PREFIX)) {
632
+ const inputTokens = parseServerFallbackInputTokens(signature.slice(SERVER_FALLBACK_USAGE_SIGNATURE_PREFIX.length));
633
+ if (inputTokens !== undefined)
634
+ return { kind: "usage", inputTokens };
635
+ invalidUsage = true;
636
+ } else if (signature.startsWith(SERVER_FALLBACK_SIGNATURE_PREFIX)) {
637
+ boundary = true;
638
+ }
639
+ }
640
+ }
641
+ return boundary || invalidUsage ? { kind: "boundary", invalidUsage } : undefined;
642
+ }
592
643
  function providerResponseFailed(input) {
593
644
  if (input.error !== undefined && input.error !== null && input.error !== "")
594
645
  return true;
@@ -4551,4 +4602,4 @@ var ERROR_CLASSES = new Set([
4551
4602
  "permission_denied",
4552
4603
  "unknown"
4553
4604
  ]);
4554
- export { COMPARTMENT_LEASE_RENEWAL_MS, getCompartmentLeaseBlocker, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, isNoContentCompartment, queueM0Mutation, getMaxM0MutationId, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getCompartmentsByEndMessageId, appendCompartments, buildCompartmentBlock, saveRecompStagingPass, getRecompStaging, clearRecompStaging, getRecompPartialRange, setRecompPartialRange, escapeXmlAttr, escapeXmlContent, getUncoveredCompartmentEndsThrough, isPartialCompartmentEnd, readProjectDocsCanonical, providerResponseFailed, isSuccessfulProviderCompletion, LkgRecoveryFenceError, lkgServedArrayDigest, hasCleanLkgRecoveryFence, dirtyLkgRecoveryRevision, ownsLkgDirtyFence, invalidateCleanLkgRecoveryFence, prepareLkgCaptureFence, certifyCommittedLkgCapture, markLkgRecoveryDirty, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, advanceSessionActivity, backfillSessionActivity, readSessionMeta, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, requestPendingMaterialization, pendingMaterializationOrigin, hasPendingMaterializationOrigin, clearPendingMaterialization, clearPendingMaterializationOrigin, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, isHeldHeadForRequest, deferDeliveredSystemRefresh, retirePendingSystemPromptDelivery, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, currentLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, clearLkgMeasuredRequest, saveLkgSlotToDb, clearPersistedLkgSlotStrict, loadPersistedLkgSlot, drainStaleLkgSlots, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, validateAnthropicReasoningRuns, validateLkgSeam, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, readPersistedLkgUntaggedInputIds, persistLkgUntaggedInputIds, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, lkgInputIdentity, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, exactReusablePrefix, incrementalLkgContentDigests, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, externalHistorianFailureReason, recordHistorianRun, summarizeImportance, tallyFactsByCategory, MEMORY_VISIBILITY_MUTATION_CATEGORY, queueMemoryMutation, getMemoryMutationsForRender, getMemoryMutationsForRenderByProjects, getMaxMemoryMutationId, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, recordSubagentInvocation, getLatestHistorianInvocationId };
4605
+ export { COMPARTMENT_LEASE_RENEWAL_MS, getCompartmentLeaseBlocker, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, isNoContentCompartment, queueM0Mutation, getMaxM0MutationId, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getCompartmentsByEndMessageId, appendCompartments, buildCompartmentBlock, saveRecompStagingPass, getRecompStaging, clearRecompStaging, getRecompPartialRange, setRecompPartialRange, escapeXmlAttr, escapeXmlContent, getUncoveredCompartmentEndsThrough, isPartialCompartmentEnd, readProjectDocsCanonical, readServerFallbackUsage, providerResponseFailed, isSuccessfulProviderCompletion, LkgRecoveryFenceError, lkgServedArrayDigest, hasCleanLkgRecoveryFence, dirtyLkgRecoveryRevision, ownsLkgDirtyFence, invalidateCleanLkgRecoveryFence, prepareLkgCaptureFence, certifyCommittedLkgCapture, markLkgRecoveryDirty, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, advanceSessionActivity, backfillSessionActivity, readSessionMeta, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, requestPendingMaterialization, pendingMaterializationOrigin, hasPendingMaterializationOrigin, clearPendingMaterialization, clearPendingMaterializationOrigin, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, isHeldHeadForRequest, deferDeliveredSystemRefresh, retirePendingSystemPromptDelivery, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, currentLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, clearLkgMeasuredRequest, saveLkgSlotToDb, clearPersistedLkgSlotStrict, loadPersistedLkgSlot, drainStaleLkgSlots, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, validateAnthropicReasoningRuns, validateLkgSeam, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, readPersistedLkgUntaggedInputIds, persistLkgUntaggedInputIds, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, lkgInputIdentity, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, exactReusablePrefix, incrementalLkgContentDigests, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, externalHistorianFailureReason, recordHistorianRun, summarizeImportance, tallyFactsByCategory, MEMORY_VISIBILITY_MUTATION_CATEGORY, queueMemoryMutation, getMemoryMutationsForRender, getMemoryMutationsForRenderByProjects, getMaxMemoryMutationId, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, recordSubagentInvocation, getLatestHistorianInvocationId };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log2
3
- } from "./server-jb6tjyeb.js";
3
+ } from "./server-bb6kf05j.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$/;
@@ -5,10 +5,10 @@ import {
5
5
  } from "./server-gzy5w8ya.js";
6
6
  import {
7
7
  runSessionWarmupWorker
8
- } from "./server-b3r080cm.js";
8
+ } from "./server-rz5jnhnv.js";
9
9
  import {
10
10
  logSlowWriteTransaction
11
- } from "./server-qmmkhz2z.js";
11
+ } from "./server-np27dgyt.js";
12
12
 
13
13
  // src/features/magic-context/message-fts-rowid-map.ts
14
14
  import { createHash } from "node:crypto";
@@ -18,6 +18,7 @@ import {
18
18
  readFileSync,
19
19
  readlinkSync,
20
20
  realpathSync,
21
+ unlinkSync,
21
22
  writeFileSync
22
23
  } from "node:fs";
23
24
  import * as os from "node:os";
@@ -43,29 +44,31 @@ function getMagicContextLogPath(harness = getHarness2()) {
43
44
  function getProjectMagicContextDir(directory) {
44
45
  return path.join(directory, ".cortexkit", "magic-context");
45
46
  }
46
- var GITIGNORE_GUARD_OPEN = "# >>> cortexkit:magic-context";
47
- var GITIGNORE_GUARD_CLOSE = "# <<< cortexkit:magic-context";
48
47
  function ensureCortexKitArtifactGitignore(directory) {
49
48
  try {
50
- const cortexKitDir = path.join(directory, ".cortexkit");
51
- const gitignorePath = path.join(cortexKitDir, ".gitignore");
52
- let existing = "";
53
- if (existsSync(gitignorePath)) {
54
- existing = readFileSync(gitignorePath, "utf8");
55
- if (existing.includes(GITIGNORE_GUARD_OPEN))
56
- return;
49
+ const artifactDir = getProjectMagicContextDir(directory);
50
+ const gitignorePath = path.join(artifactDir, ".gitignore");
51
+ mkdirSync(artifactDir, { recursive: true });
52
+ if (!existsSync(gitignorePath) || readFileSync(gitignorePath, "utf8") !== `*
53
+ `) {
54
+ writeFileSync(gitignorePath, `*
55
+ `, "utf8");
57
56
  }
58
- const block = `${GITIGNORE_GUARD_OPEN}
59
- magic-context/
60
- ${GITIGNORE_GUARD_CLOSE}
61
- `;
62
- const needsLeadingNewline = existing.length > 0 && !existing.endsWith(`
63
- `);
64
- const next = existing + (needsLeadingNewline ? `
65
- ` : "") + block;
66
- mkdirSync(cortexKitDir, { recursive: true });
67
- writeFileSync(gitignorePath, next, "utf8");
68
- } catch {}
57
+ const sharedPath = path.join(directory, ".cortexkit", ".gitignore");
58
+ if (!existsSync(sharedPath))
59
+ return;
60
+ const existing = readFileSync(sharedPath).toString("latin1");
61
+ const next = existing.replace(/^# >>> cortexkit:magic-context\r?\n(?:(?!^# (?:>>>|<<<) cortexkit:)[\s\S])*?^# <<< cortexkit:magic-context(?:\r?\n|$)/gm, "");
62
+ if (next === existing)
63
+ return;
64
+ const remaining = Buffer.from(next, "latin1");
65
+ if (remaining.toString("utf8").trim() === "")
66
+ unlinkSync(sharedPath);
67
+ else
68
+ writeFileSync(sharedPath, remaining);
69
+ } catch (error) {
70
+ log2("Failed to ensure project artifact gitignore", { directory, error: String(error) });
71
+ }
69
72
  }
70
73
  function getProjectMagicContextHistorianDir(directory) {
71
74
  return path.join(getProjectMagicContextDir(directory), "historian");
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_LOCAL_EMBEDDING_MODEL
3
- } from "./server-p9s40wfa.js";
3
+ } from "./server-0ms13pc8.js";
4
4
  import {
5
5
  getHarness2
6
6
  } from "./server-pavzsdc6.js";
@@ -8,10 +8,10 @@ import {
8
8
  getMagicContextStorageDir,
9
9
  importPluginModule,
10
10
  log2
11
- } from "./server-jb6tjyeb.js";
11
+ } from "./server-bb6kf05j.js";
12
12
  import {
13
13
  getSynapseLaneIdentity
14
- } from "./server-ddw42d76.js";
14
+ } from "./server-mxsy9h1d.js";
15
15
  import {
16
16
  inRootAsyncContext2
17
17
  } from "./server-gzy5w8ya.js";
@@ -645,6 +645,7 @@ function getEmbeddingProviderIdentity(config) {
645
645
  throw new Error("Unknown embedding provider");
646
646
  }
647
647
  const truncate = config.provider === "openai-compatible" ? config.truncate?.trim() : undefined;
648
+ const dimensions = config.provider === "openai-compatible" ? config.dimensions : undefined;
648
649
  const documentPrefix = config.provider === "openai-compatible" ? resolveEmbeddingTextPrefixes(config.model, config.query_instruction, config.document_prefix).documentPrefix : "";
649
650
  const localDtype = config.provider === "local" && config.local_dtype && config.local_dtype !== "fp32" ? config.local_dtype : undefined;
650
651
  const localPooling = config.provider === "local" ? getCachedLocalEmbeddingPooling(config.model?.trim() || DEFAULT_LOCAL_EMBEDDING_MODEL) : null;
@@ -656,7 +657,8 @@ function getEmbeddingProviderIdentity(config) {
656
657
  apiKeyPresent: Boolean(config.api_key?.trim()),
657
658
  inputType: config.input_type?.trim() || "",
658
659
  ...documentPrefix ? { documentPrefix } : {},
659
- ...truncate ? { truncate } : {}
660
+ ...truncate ? { truncate } : {},
661
+ ...dimensions ? { dimensions } : {}
660
662
  } : {
661
663
  provider: "local",
662
664
  model: config.model?.trim() || DEFAULT_LOCAL_EMBEDDING_MODEL,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./server-v0p37hm2.js";
4
4
  import {
5
5
  log2
6
- } from "./server-jb6tjyeb.js";
6
+ } from "./server-bb6kf05j.js";
7
7
  import {
8
8
  inRootAsyncContext2,
9
9
  getSqliteDatabasePath2