@cortexkit/opencode-magic-context 0.49.33 → 0.49.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/dist/auto-search-worker.js +11 -6
  2. package/dist/chunk-embedding-write-worker.js +16 -14
  3. package/dist/{compaction-marker-candidates-31h86ph0.js → compaction-marker-candidates-g0p67ced.js} +3 -2
  4. package/dist/compaction-marker-candidates-worker.js +1 -1
  5. package/dist/{compartment-chunk-embedding-5q5gj67r.js → compartment-chunk-embedding-y4136are.js} +8 -7
  6. package/dist/{conflict-warning-hook-xgskea1v.js → conflict-warning-hook-hhw8z5ak.js} +9 -8
  7. package/dist/{context-jyzkstnr.js → context-fk8e3h9p.js} +1400 -701
  8. package/dist/{derive-budgets-pqybnx09.js → derive-budgets-htj16n4x.js} +3 -2
  9. package/dist/embedding-backfill-q6n72sy0.js +27 -0
  10. package/dist/embedding-worker-process.js +2 -1
  11. package/dist/embedding-worker.js +5 -4
  12. package/dist/expand-attachments-h33jbgyz.js +21 -0
  13. package/dist/features/magic-context/auto-search-diagnostics.d.ts +21 -0
  14. package/dist/features/magic-context/auto-search-diagnostics.d.ts.map +1 -0
  15. package/dist/features/magic-context/compaction-marker.d.ts +22 -6
  16. package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
  17. package/dist/features/magic-context/compartment-chunk-embedding.d.ts +1 -1
  18. package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
  19. package/dist/features/magic-context/search.d.ts +4 -0
  20. package/dist/features/magic-context/search.d.ts.map +1 -1
  21. package/dist/features/magic-context/storage-meta-persisted.d.ts +7 -0
  22. package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
  23. package/dist/features/magic-context/store-generation-rebase-labels.d.ts +6 -0
  24. package/dist/features/magic-context/store-generation-rebase-labels.d.ts.map +1 -0
  25. package/dist/features/magic-context/store-generation-rebase.d.ts.map +1 -1
  26. package/dist/{history-owner-36wp3mkb.js → history-owner-0z620wgz.js} +3 -2
  27. package/dist/hooks/magic-context/apply-operations.d.ts +20 -3
  28. package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
  29. package/dist/hooks/magic-context/auto-search-observation.d.ts +13 -0
  30. package/dist/hooks/magic-context/auto-search-observation.d.ts.map +1 -0
  31. package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
  32. package/dist/hooks/magic-context/auto-search-worker-client.d.ts +5 -1
  33. package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
  34. package/dist/hooks/magic-context/compaction-marker-manager.d.ts +5 -5
  35. package/dist/hooks/magic-context/compaction-marker-manager.d.ts.map +1 -1
  36. package/dist/hooks/magic-context/compaction-marker-publication.d.ts +9 -0
  37. package/dist/hooks/magic-context/compaction-marker-publication.d.ts.map +1 -0
  38. package/dist/hooks/magic-context/compartment-commit-hashes.d.ts +4 -0
  39. package/dist/hooks/magic-context/compartment-commit-hashes.d.ts.map +1 -0
  40. package/dist/hooks/magic-context/compartment-runner-validation.d.ts +1 -0
  41. package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
  42. package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
  43. package/dist/hooks/magic-context/final-wire-completeness.d.ts +15 -0
  44. package/dist/hooks/magic-context/final-wire-completeness.d.ts.map +1 -0
  45. package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
  46. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
  47. package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts +1 -0
  48. package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts.map +1 -1
  49. package/dist/hooks/magic-context/read-session-chunk.d.ts +11 -0
  50. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  51. package/dist/hooks/magic-context/read-session-formatting.d.ts +2 -0
  52. package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -1
  53. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  54. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  55. package/dist/{index-as2amvn3.js → index-0c7p8mq5.js} +6 -531
  56. package/dist/{index-51rdvtkz.js → index-1rhgxqs8.js} +2 -2
  57. package/dist/index-2amn2s73.js +123 -0
  58. package/dist/{index-c7phnbvk.js → index-2p37txes.js} +1 -1
  59. package/dist/index-2qbtqg1w.js +529 -0
  60. package/dist/{index-waktfbjy.js → index-2v6nvy3k.js} +4 -4
  61. package/dist/{index-dq5xzeb9.js → index-3d3872c6.js} +7 -5
  62. package/dist/{index-qr2mb02j.js → index-3j9t1v4n.js} +55 -21
  63. package/dist/{index-2xh37qn5.js → index-4bgk5ztz.js} +576 -5524
  64. package/dist/{index-b88dwwrh.js → index-4xyjr62e.js} +1 -1
  65. package/dist/index-66a50f3e.js +777 -0
  66. package/dist/{index-94ef0qe2.js → index-87ctnzz9.js} +33 -5
  67. package/dist/{index-xrnsygfq.js → index-9wnbnx8f.js} +1 -1
  68. package/dist/{index-3fkk2gwj.js → index-b6xz3qbe.js} +246 -420
  69. package/dist/{index-0fe4q77z.js → index-brg2w6qc.js} +146 -134
  70. package/dist/{index-spwjbkc7.js → index-dnqqqc5f.js} +1 -1
  71. package/dist/index-dy7w6wm4.js +194 -0
  72. package/dist/{index-3jmx3fae.js → index-ezv6dz3y.js} +37 -7
  73. package/dist/index-f297z1n8.js +4557 -0
  74. package/dist/{index-qgh1qwjj.js → index-f9b3vtt1.js} +1 -1
  75. package/dist/{index-v15ne3a3.js → index-faxb7mck.js} +2 -2
  76. package/dist/{index-rrv26qjz.js → index-fw42ms3m.js} +1 -1
  77. package/dist/{index-t5pck3ss.js → index-fxbk7gk3.js} +1 -1
  78. package/dist/{index-wfybj1dw.js → index-g4t7850m.js} +2 -2
  79. package/dist/{index-hbt0sbv2.js → index-gyaa159j.js} +18 -276
  80. package/dist/{index-4pnsgvfk.js → index-hacf2tyx.js} +1 -1
  81. package/dist/{index-s1n8dd2n.js → index-jkanybgq.js} +2 -2
  82. package/dist/{index-2743x98y.js → index-jn0ddrhp.js} +29 -138
  83. package/dist/{index-h7tgn49j.js → index-jrfre9ah.js} +5 -222
  84. package/dist/{index-kfyb3k6n.js → index-jz5bk7xd.js} +2 -2
  85. package/dist/{index-np3rgfw4.js → index-ksv0a31x.js} +3 -3
  86. package/dist/{index-7kkphb6c.js → index-nj360hcs.js} +4 -4
  87. package/dist/{index-gkee6p4g.js → index-p56dszfp.js} +3 -3
  88. package/dist/{index-4s4zq97n.js → index-pq0dpwrc.js} +4 -4
  89. package/dist/{index-rfxzazzy.js → index-pswsyf1w.js} +4 -4
  90. package/dist/{index-y1qwzvxn.js → index-pztqab6k.js} +2 -2
  91. package/dist/{index-rverk2vz.js → index-qncw9hey.js} +1 -1
  92. package/dist/index-qx8j6kds.js +270 -0
  93. package/dist/{index-kq5w68dp.js → index-txs8tce6.js} +1 -1
  94. package/dist/index-vzhhr1ht.js +532 -0
  95. package/dist/index-wh9fxds5.js +265 -0
  96. package/dist/{index-b7w46fp2.js → index-x2mrq5xv.js} +170 -48
  97. package/dist/{index-43vqx0za.js → index-xwwsbsd3.js} +15 -13
  98. package/dist/index-z4p0ry94.js +222 -0
  99. package/dist/index-z9zygwse.js +89 -0
  100. package/dist/{index-v7287tzq.js → index-zhqwda72.js} +19 -8
  101. package/dist/index.js +83 -72
  102. package/dist/{logger-94kew5wm.js → logger-qwnbcfj9.js} +2 -1
  103. package/dist/{message-fts-rowid-map-va36knh4.js → message-fts-rowid-map-xg7hr0mk.js} +5 -4
  104. package/dist/{message-index-bounded-zq7a5nm6.js → message-index-bounded-narw7bnz.js} +12 -11
  105. package/dist/{message-time-backfill-4qva0b4f.js → message-time-backfill-39bm498k.js} +3 -2
  106. package/dist/migration-worker.js +13 -11
  107. package/dist/{project-embedding-registry-6yex0r9f.js → project-embedding-registry-tdz7985n.js} +13 -11
  108. package/dist/raw-ordinal-warmup-worker.js +12 -7
  109. package/dist/{read-session-chunk-1ndphmb8.js → read-session-chunk-vmg1zjg0.js} +15 -10
  110. package/dist/{read-session-raw-b2sd67v4.js → read-session-raw-mncmzbm9.js} +3 -2
  111. package/dist/recomp-orchestrator-qyyhnc9b.js +68 -0
  112. package/dist/render-c5p0k846.js +43 -0
  113. package/dist/{safe-notification-target-mkr9yzvr.js → safe-notification-target-wztd7bgk.js} +3 -2
  114. package/dist/{search-archive-sr07c6aj.js → search-archive-0ny7p3bw.js} +13 -11
  115. package/dist/{search-040pac3a.js → search-f6hwvcxk.js} +26 -23
  116. package/dist/{send-session-notification-vz86nt79.js → send-session-notification-0gwcz3fw.js} +7 -6
  117. package/dist/{storage-tags-6hvkk01c.js → storage-tags-zx1023km.js} +5 -4
  118. package/dist/store-620rjzt9.js +21 -0
  119. package/dist/store-reader-yh19h38c.js +14 -0
  120. package/dist/tools/ctx-expand/render.d.ts +5 -3
  121. package/dist/tools/ctx-expand/render.d.ts.map +1 -1
  122. package/dist/tools/ctx-expand/search-archive.d.ts.map +1 -1
  123. package/dist/tools/ctx-expand/tools.d.ts +2 -0
  124. package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
  125. package/dist/tools/ctx-expand/v2-archive-reader.d.ts +33 -0
  126. package/dist/tools/ctx-expand/v2-archive-reader.d.ts.map +1 -0
  127. package/dist/{transform-postprocess-phase-zx1peqma.js → transform-postprocess-phase-807ff6t2.js} +36 -30
  128. package/dist/v2/auto-search-worker.js +11 -6
  129. package/dist/v2/chunk-embedding-write-worker.js +16 -14
  130. package/dist/v2/{compaction-marker-candidates-m4vmye3w.js → compaction-marker-candidates-t1aq6gsj.js} +3 -2
  131. package/dist/v2/compaction-marker-candidates-worker.js +1 -1
  132. package/dist/v2/{compartment-chunk-embedding-rc31e6md.js → compartment-chunk-embedding-ncsk0r9e.js} +8 -7
  133. package/dist/v2/{context-3c4z2wj5.js → context-znqfkap4.js} +1725 -1095
  134. package/dist/v2/{derive-budgets-knf763tt.js → derive-budgets-sa0v7bz0.js} +4 -3
  135. package/dist/v2/embedding-backfill-11j425e0.js +26 -0
  136. package/dist/v2/embedding-worker-process.js +2 -1
  137. package/dist/v2/embedding-worker.js +5 -4
  138. package/dist/v2/expand-attachments-h33jbgyz.js +21 -0
  139. package/dist/v2/fold/idle.d.ts +15 -0
  140. package/dist/v2/fold/idle.d.ts.map +1 -0
  141. package/dist/v2/fold/native-replay-v3.d.ts +68 -0
  142. package/dist/v2/fold/native-replay-v3.d.ts.map +1 -0
  143. package/dist/v2/fold/native-replay.d.ts +58 -2
  144. package/dist/v2/fold/native-replay.d.ts.map +1 -1
  145. package/dist/v2/fold/policy.d.ts +2 -1
  146. package/dist/v2/fold/policy.d.ts.map +1 -1
  147. package/dist/v2/{history-owner-ad0crnrn.js → history-owner-fpka43cn.js} +3 -2
  148. package/dist/v2/hooks/context.d.ts.map +1 -1
  149. package/dist/v2/hooks/expand-attachments.d.ts +8 -0
  150. package/dist/v2/hooks/expand-attachments.d.ts.map +1 -0
  151. package/dist/v2/hooks/overflow-recovery.d.ts +45 -0
  152. package/dist/v2/hooks/overflow-recovery.d.ts.map +1 -0
  153. package/dist/v2/hooks/store.d.ts +7 -2
  154. package/dist/v2/hooks/store.d.ts.map +1 -1
  155. package/dist/v2/{logger-p34mjtja.js → logger-4cj6d03m.js} +2 -1
  156. package/dist/v2/{message-fts-rowid-map-78awh03v.js → message-fts-rowid-map-rmk571mb.js} +5 -4
  157. package/dist/v2/{message-index-bounded-jvgz7vk9.js → message-index-bounded-620bppw7.js} +12 -11
  158. package/dist/v2/{message-time-backfill-zvthw6xb.js → message-time-backfill-0c4h7sg6.js} +3 -2
  159. package/dist/v2/migration-worker.js +13 -11
  160. package/dist/v2/ordinal-range.fixture.d.ts +7 -0
  161. package/dist/v2/ordinal-range.fixture.d.ts.map +1 -0
  162. package/dist/v2/{project-embedding-registry-1x5qe2fy.js → project-embedding-registry-bm5fe1a8.js} +13 -11
  163. package/dist/v2/raw-ordinal-warmup-worker.js +12 -7
  164. package/dist/v2/{read-session-chunk-djzgm4jg.js → read-session-chunk-qfwv1k71.js} +15 -10
  165. package/dist/v2/{read-session-raw-5x088amc.js → read-session-raw-q294t8xs.js} +3 -2
  166. package/dist/v2/recomp-orchestrator-fcnjref7.js +67 -0
  167. package/dist/v2/render-98a1qv0b.js +42 -0
  168. package/dist/v2/{safe-notification-target-khnzg57c.js → safe-notification-target-gphhast7.js} +3 -2
  169. package/dist/v2/{search-archive-n3dhns4r.js → search-archive-r0y1bafr.js} +13 -11
  170. package/dist/v2/{search-q3wkpe8t.js → search-z1zqzsmh.js} +25 -22
  171. package/dist/v2/{send-session-notification-x5nzy34v.js → send-session-notification-fst6hkg7.js} +7 -6
  172. package/dist/v2/{server-rb8m4vry.js → server-1xesqm5h.js} +146 -134
  173. package/dist/v2/server-2amn2s73.js +123 -0
  174. package/dist/v2/{server-6g98c227.js → server-3schkz95.js} +4 -4
  175. package/dist/v2/server-468mya5v.js +209 -0
  176. package/dist/v2/server-55v5hpth.js +270 -0
  177. package/dist/v2/server-5jp38p98.js +532 -0
  178. package/dist/v2/{server-qjvk4a9t.js → server-69m30b21.js} +1 -1
  179. package/dist/v2/{server-d01pe8q5.js → server-7ccxt4nq.js} +14 -216
  180. package/dist/v2/{server-3mz2qh5a.js → server-969cdpmg.js} +1 -1
  181. package/dist/v2/{server-835q39kd.js → server-9k0mjef7.js} +2 -2
  182. package/dist/v2/{server-qc915kw2.js → server-bez34e60.js} +4 -4
  183. package/dist/v2/{server-nxas8v1d.js → server-bpvsvtph.js} +3 -3
  184. package/dist/v2/{server-ab8017gw.js → server-bxpz2dcn.js} +29 -138
  185. package/dist/v2/{server-bsgd4dk1.js → server-dcws5831.js} +2 -2
  186. package/dist/v2/server-ef1mskas.js +777 -0
  187. package/dist/v2/{server-1bw1wcbp.js → server-f0j864ma.js} +1 -1
  188. package/dist/v2/{server-aqbm9c8d.js → server-fqj6ddpr.js} +632 -5540
  189. package/dist/v2/{server-rr4cbkr0.js → server-hnknwaz8.js} +37 -7
  190. package/dist/v2/{server-h1byrhwx.js → server-hsf0qsn5.js} +19 -8
  191. package/dist/v2/{server-6495nmn9.js → server-jb6tjyeb.js} +5 -222
  192. package/dist/v2/{server-2aasmpsp.js → server-kkxzwa6w.js} +4 -4
  193. package/dist/v2/{server-a7x00tw8.js → server-mfn1yf9d.js} +1 -1
  194. package/dist/v2/{server-tkdabx8q.js → server-q0z2q2dx.js} +5 -530
  195. package/dist/v2/{server-n14edf07.js → server-qa74bj91.js} +77 -17
  196. package/dist/v2/server-qf2kzsh2.js +4513 -0
  197. package/dist/v2/{server-gyy4k6mf.js → server-qmmkhz2z.js} +1 -1
  198. package/dist/v2/{server-29qp8nz4.js → server-qxzbmtqt.js} +1 -1
  199. package/dist/v2/{server-hwag0khr.js → server-r3chnxs5.js} +4 -4
  200. package/dist/v2/{server-vr4szghm.js → server-rktnzs89.js} +2 -2
  201. package/dist/v2/{server-6vd2n183.js → server-s9xgyyj9.js} +1 -1
  202. package/dist/v2/{server-53eh1r8r.js → server-sd8hvzte.js} +2 -2
  203. package/dist/v2/{server-k3t06fxr.js → server-sefxj8k1.js} +1 -1
  204. package/dist/v2/{server-v77xa5wj.js → server-tpt7bwq8.js} +1 -1
  205. package/dist/v2/{server-awr8qa4c.js → server-ws5exe6q.js} +2 -2
  206. package/dist/v2/server-x4m6xcn4.js +194 -0
  207. package/dist/v2/{server-806rzhs6.js → server-xbtw0p9t.js} +1 -1
  208. package/dist/v2/{server-cqjvxyrp.js → server-xy7w7hrd.js} +2 -2
  209. package/dist/v2/server-ypf1ap0v.js +529 -0
  210. package/dist/v2/server-z4p0ry94.js +222 -0
  211. package/dist/v2/server-z9zygwse.js +89 -0
  212. package/dist/v2/{server-ab1g0wn9.js → server-zzgtgqmd.js} +2 -2
  213. package/dist/v2/server.js +6 -5
  214. package/dist/v2/{storage-tags-18nbaanf.js → storage-tags-19s0ebf0.js} +5 -4
  215. package/dist/v2/store-reader-cgx47zkp.js +14 -0
  216. package/dist/v2/store-reader.d.ts +9 -2
  217. package/dist/v2/store-reader.d.ts.map +1 -1
  218. package/dist/v2/store-vdm8v3jd.js +21 -0
  219. package/dist/v2/v2-archive-reader-t2c0eypn.js +11 -0
  220. package/dist/v2/{wrapup-orchestrator-ga5vfmwr.js → wrapup-orchestrator-aqpqsveg.js} +46 -39
  221. package/dist/v2-archive-reader-tm2eayp2.js +11 -0
  222. package/dist/wrapup-orchestrator-k5yp19a6.js +55 -0
  223. package/package.json +1 -1
  224. package/src/shared/sqlite-transaction-mode-guard.test.ts +4 -0
  225. package/dist/embedding-backfill-0jgtqxen.js +0 -25
  226. package/dist/recomp-orchestrator-skqzzvby.js +0 -62
  227. package/dist/v2/embedding-backfill-f43hd8y6.js +0 -24
  228. package/dist/v2/recomp-orchestrator-qfqdvbta.js +0 -61
  229. package/dist/wrapup-orchestrator-dy8r3gp8.js +0 -49
@@ -1,23 +1,16 @@
1
1
  import {
2
- getHarness2
3
- } from "./server-pavzsdc6.js";
4
- import {
5
- isTransientSqliteError2
6
- } from "./server-gzy5w8ya.js";
2
+ sanitizeDiagnosticText
3
+ } from "./server-z4p0ry94.js";
7
4
  import {
8
5
  PROMOTABLE_CATEGORIES,
9
6
  CATEGORY_DEFAULT_TTL
10
7
  } from "./server-fr0wbhdn.js";
11
8
  import {
12
- sanitizeDiagnosticText,
13
9
  sessionLog2
14
- } from "./server-6495nmn9.js";
15
- import {
16
- managedAuthorityNoteRow
17
- } from "./server-6g98c227.js";
10
+ } from "./server-jb6tjyeb.js";
18
11
  import {
19
12
  embedTextForProject2
20
- } from "./server-ab8017gw.js";
13
+ } from "./server-bxpz2dcn.js";
21
14
  import {
22
15
  saveEmbeddingIfHashMatches
23
16
  } from "./server-4dhv7mqz.js";
@@ -35,524 +28,6 @@ import {
35
28
  computeNormalizedHash
36
29
  } from "./server-2bvekkfy.js";
37
30
 
38
- // src/features/magic-context/storage-notes.ts
39
- var NOTE_TYPES = new Set(["session", "smart"]);
40
- var NOTE_STATUSES = new Set(["active", "pending", "ready", "dismissed"]);
41
- var NOTE_CHECK_STATUSES = new Set([
42
- "uncompiled",
43
- "compiled",
44
- "failing",
45
- "fallback",
46
- "parked"
47
- ]);
48
- var CONDITION_COMPILE_STATUSES = new Set([
49
- "compiled",
50
- "plain",
51
- "refused"
52
- ]);
53
- var DEFAULT_SMART_STATUSES = ["pending", "ready"];
54
- function toNullableString(value) {
55
- return typeof value === "string" && value.length > 0 ? value : null;
56
- }
57
- function toNullableNumber(value) {
58
- return typeof value === "number" ? value : null;
59
- }
60
- function isNoteRow(row) {
61
- if (row === null || typeof row !== "object")
62
- return false;
63
- const candidate = row;
64
- return typeof candidate.id === "number" && typeof candidate.type === "string" && NOTE_TYPES.has(candidate.type) && typeof candidate.status === "string" && NOTE_STATUSES.has(candidate.status) && typeof candidate.content === "string" && (candidate.session_id === null || typeof candidate.session_id === "string") && (candidate.project_path === null || typeof candidate.project_path === "string") && (candidate.surface_condition === null || typeof candidate.surface_condition === "string") && typeof candidate.created_at === "number" && typeof candidate.updated_at === "number" && (candidate.last_checked_at === null || typeof candidate.last_checked_at === "number") && (candidate.ready_at === null || typeof candidate.ready_at === "number") && (candidate.ready_reason === null || typeof candidate.ready_reason === "string");
65
- }
66
- function toNote(row) {
67
- return {
68
- id: row.id,
69
- type: row.type,
70
- status: row.status,
71
- content: row.content,
72
- sessionId: toNullableString(row.session_id),
73
- projectPath: toNullableString(row.project_path),
74
- surfaceCondition: toNullableString(row.surface_condition),
75
- compiledProvider: toNullableString(row.compiled_provider),
76
- compiledConfig: toNullableString(row.compiled_config),
77
- compiledAt: toNullableNumber(row.compiled_at),
78
- compileStatus: typeof row.compile_status === "string" && CONDITION_COMPILE_STATUSES.has(row.compile_status) ? row.compile_status : null,
79
- createdAt: row.created_at,
80
- updatedAt: row.updated_at,
81
- lastCheckedAt: toNullableNumber(row.last_checked_at),
82
- readyAt: toNullableNumber(row.ready_at),
83
- readyReason: toNullableString(row.ready_reason),
84
- anchorOrdinal: toNullableNumber(row.anchor_ordinal),
85
- compiledCheck: toNullableString(row.compiled_check),
86
- manifestJson: toNullableString(row.manifest_json),
87
- checkHash: toNullableString(row.check_hash),
88
- checkCron: toNullableString(row.check_cron),
89
- checkVersion: toNullableNumber(row.check_version),
90
- checkStatus: typeof row.check_status === "string" && NOTE_CHECK_STATUSES.has(row.check_status) ? row.check_status : null,
91
- checkFailureCount: toNullableNumber(row.check_failure_count) ?? 0,
92
- checkNetworkFailureCount: toNullableNumber(row.check_network_failure_count) ?? 0,
93
- checkQuarantinedUntil: toNullableNumber(row.check_quarantined_until),
94
- checkNextDueAt: toNullableNumber(row.check_next_due_at),
95
- checkCompiledAt: toNullableNumber(row.check_compiled_at),
96
- checkFalseSinceAt: toNullableNumber(row.check_false_since_at),
97
- checkLastLivenessAt: toNullableNumber(row.check_last_liveness_at),
98
- policyVersion: toNullableNumber(row.policy_version)
99
- };
100
- }
101
- function noteCheckColumnsExist(db) {
102
- try {
103
- const rows = db.prepare("PRAGMA table_info(notes)").all();
104
- return rows.some((row) => row.name === "compiled_check");
105
- } catch {
106
- return false;
107
- }
108
- }
109
- var PENDING_SESSION_NOTE_PREDICATE = "type = 'session' AND status = 'pending' AND surface_condition IS NOT NULL";
110
- function healPendingSessionNotes(db) {
111
- let predicate = `${PENDING_SESSION_NOTE_PREDICATE} AND NOT ${managedAuthorityNoteRow("notes")}`;
112
- let healable;
113
- try {
114
- healable = db.prepare(`SELECT 1 FROM notes WHERE ${predicate} LIMIT 1`).get();
115
- } catch (error) {
116
- if (!(error instanceof Error) || !error.message.includes("no such table"))
117
- throw error;
118
- predicate = PENDING_SESSION_NOTE_PREDICATE;
119
- healable = db.prepare(`SELECT 1 FROM notes WHERE ${predicate} LIMIT 1`).get();
120
- }
121
- if (healable == null)
122
- return;
123
- try {
124
- db.prepare(`UPDATE notes SET status = 'active', surface_condition = NULL WHERE ${predicate}`).run();
125
- } catch (error) {
126
- if (!isTransientSqliteError2(error))
127
- throw error;
128
- }
129
- }
130
- var SESSION_NOTE_CONDITION_ERROR = "Only a note created with a condition can have one. Write a new note with surface_condition, and dismiss this one.";
131
- function getNoteById(db, noteId) {
132
- healPendingSessionNotes(db);
133
- const row = db.prepare("SELECT * FROM notes WHERE id = ?").get(noteId);
134
- return isNoteRow(row) ? toNote(row) : null;
135
- }
136
- function getNoteByIdInScope(db, noteId, scope) {
137
- const note = getNoteById(db, noteId);
138
- return note && noteBelongsToScope(note, scope) ? note : null;
139
- }
140
- function noteBelongsToScope(note, scope) {
141
- if (note.type === "session") {
142
- return note.sessionId === scope.sessionId;
143
- }
144
- return note.projectPath === scope.projectPath;
145
- }
146
- function buildStatusClause(status) {
147
- if (status === undefined) {
148
- return null;
149
- }
150
- const statuses = Array.isArray(status) ? status : [status];
151
- if (statuses.length === 0) {
152
- return null;
153
- }
154
- const placeholders = statuses.map(() => "?").join(", ");
155
- return {
156
- sql: `status IN (${placeholders})`,
157
- params: statuses
158
- };
159
- }
160
- function getNotes(db, options = {}) {
161
- healPendingSessionNotes(db);
162
- const clauses = [];
163
- const params = [];
164
- if (options.sessionId !== undefined) {
165
- clauses.push("session_id = ?");
166
- params.push(options.sessionId);
167
- }
168
- if (options.projectPath !== undefined) {
169
- clauses.push("project_path = ?");
170
- params.push(options.projectPath);
171
- }
172
- if (options.type !== undefined) {
173
- clauses.push("type = ?");
174
- params.push(options.type);
175
- }
176
- const statusClause = buildStatusClause(options.status);
177
- if (statusClause) {
178
- clauses.push(statusClause.sql);
179
- params.push(...statusClause.params);
180
- }
181
- const where = clauses.length > 0 ? ` WHERE ${clauses.join(" AND ")}` : "";
182
- return db.prepare(`SELECT * FROM notes${where} ORDER BY created_at ASC, id ASC`).all(...params).filter(isNoteRow).map(toNote);
183
- }
184
- function addNote(db, type, options) {
185
- const now = Date.now();
186
- const result = type === "session" ? db.prepare("INSERT INTO notes (type, status, content, session_id, created_at, updated_at, harness, anchor_ordinal) VALUES ('session', 'active', ?, ?, ?, ?, ?, ?) RETURNING *").get(options.content, options.sessionId, now, now, getHarness2(), options.anchorOrdinal ?? null) : db.prepare("INSERT INTO notes (type, status, content, session_id, project_path, surface_condition, compiled_provider, compiled_config, compiled_at, compile_status, created_at, updated_at, harness, anchor_ordinal) VALUES ('smart', 'pending', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) RETURNING *").get(options.content, options.sessionId ?? null, options.projectPath, options.surfaceCondition, options.compiledProvider ?? null, options.compiledConfig ?? null, options.compiledAt ?? null, options.compileStatus ?? null, now, now, getHarness2(), options.anchorOrdinal ?? null);
187
- if (!isNoteRow(result)) {
188
- throw new Error("[notes] failed to insert note");
189
- }
190
- return toNote(result);
191
- }
192
- function getSessionNotes(db, sessionId) {
193
- return getNotes(db, { sessionId, type: "session", status: "active" });
194
- }
195
- function getSmartNotes(db, projectPath, status) {
196
- return getNotes(db, {
197
- projectPath,
198
- type: "smart",
199
- status: status ?? DEFAULT_SMART_STATUSES
200
- });
201
- }
202
- function getPendingSmartNotes(db, projectPath) {
203
- return getSmartNotes(db, projectPath, "pending");
204
- }
205
- function getReadySmartNotes(db, projectPath) {
206
- return getSmartNotes(db, projectPath, "ready");
207
- }
208
- function updateNote(db, noteId, updates, scope) {
209
- const existing = getNoteByIdInScope(db, noteId, scope);
210
- if (!existing) {
211
- return null;
212
- }
213
- if (updates.surfaceCondition !== undefined && existing.type !== "smart") {
214
- return null;
215
- }
216
- const now = Date.now();
217
- const sets = ["updated_at = ?"];
218
- const params = [now];
219
- if (updates.content !== undefined) {
220
- sets.push("content = ?");
221
- params.push(updates.content);
222
- }
223
- if (updates.sessionId !== undefined) {
224
- sets.push("session_id = ?");
225
- params.push(updates.sessionId);
226
- }
227
- const smartConditionChanged = existing.type === "smart" && updates.surfaceCondition !== undefined && updates.surfaceCondition !== existing.surfaceCondition;
228
- if (updates.status !== undefined && !smartConditionChanged) {
229
- sets.push("status = ?");
230
- params.push(updates.status);
231
- }
232
- if (existing.type === "smart") {
233
- if (updates.projectPath !== undefined) {
234
- sets.push("project_path = ?");
235
- params.push(updates.projectPath);
236
- }
237
- if (updates.surfaceCondition !== undefined) {
238
- sets.push("surface_condition = ?");
239
- params.push(updates.surfaceCondition);
240
- }
241
- if (smartConditionChanged) {
242
- sets.push("status = 'pending'", "last_checked_at = NULL", "ready_at = NULL", "ready_reason = NULL");
243
- sets.push("compiled_provider = ?", "compiled_config = ?", "compiled_at = ?", "compile_status = ?");
244
- params.push(updates.compiledProvider ?? null, updates.compiledConfig ?? null, updates.compiledAt ?? null, updates.compileStatus ?? null);
245
- if (noteCheckColumnsExist(db)) {
246
- sets.push("compiled_check = NULL", "manifest_json = NULL", "check_hash = NULL", "check_cron = NULL", "check_version = 0", "check_status = 'uncompiled'", "check_failure_count = 0", "check_network_failure_count = 0", "check_quarantined_until = NULL", "check_next_due_at = NULL", "check_compiled_at = NULL", "check_false_since_at = NULL", "check_last_liveness_at = NULL");
247
- }
248
- } else {
249
- if (updates.lastCheckedAt !== undefined) {
250
- sets.push("last_checked_at = ?");
251
- params.push(updates.lastCheckedAt);
252
- }
253
- if (updates.readyAt !== undefined) {
254
- sets.push("ready_at = ?");
255
- params.push(updates.readyAt);
256
- }
257
- if (updates.readyReason !== undefined) {
258
- sets.push("ready_reason = ?");
259
- params.push(updates.readyReason);
260
- }
261
- }
262
- }
263
- if (sets.length === 1) {
264
- return null;
265
- }
266
- params.push(noteId);
267
- const result = db.prepare(`UPDATE notes SET ${sets.join(", ")} WHERE id = ? RETURNING *`).get(...params);
268
- return isNoteRow(result) ? toNote(result) : null;
269
- }
270
- function dismissNotes(db, noteIds, scope) {
271
- const now = Date.now();
272
- return db.transaction(() => noteIds.map((noteId) => {
273
- const existing = getNoteById(db, noteId);
274
- if (!existing)
275
- return { noteId, outcome: "not_found" };
276
- if (!noteBelongsToScope(existing, scope)) {
277
- return { noteId, outcome: "not_owned" };
278
- }
279
- if (existing.status === "dismissed") {
280
- return { noteId, outcome: "already_dismissed" };
281
- }
282
- const result = db.prepare("UPDATE notes SET status = 'dismissed', updated_at = ? WHERE id = ? AND status != 'dismissed'").run(now, noteId);
283
- return {
284
- noteId,
285
- outcome: result.changes > 0 ? "dismissed" : "already_dismissed"
286
- };
287
- })).immediate();
288
- }
289
- function dismissNote(db, noteId, scope) {
290
- return dismissNotes(db, [noteId], scope)[0]?.outcome === "dismissed";
291
- }
292
- function markNoteReady(db, noteId, reason) {
293
- const now = Date.now();
294
- db.prepare("UPDATE notes SET status = 'ready', ready_at = ?, ready_reason = ?, updated_at = ?, last_checked_at = ? WHERE id = ? AND type = 'smart'").run(now, reason ?? null, now, now, noteId);
295
- }
296
- function markNoteChecked(db, noteId) {
297
- const now = Date.now();
298
- db.prepare("UPDATE notes SET last_checked_at = ?, updated_at = ? WHERE id = ? AND type = 'smart'").run(now, now, noteId);
299
- }
300
-
301
- // src/features/magic-context/storage-primers.ts
302
- var PRIMER_CANDIDATE_TTL_MS = 90 * 24 * 60 * 60 * 1000;
303
- var PRIMER_CANDIDATE_MAX_AGE_MS = 180 * 24 * 60 * 60 * 1000;
304
- function normalizePrimerQuestion(question) {
305
- return question.trim().toLowerCase().replace(/[“”]/g, '"').replace(/[’]/g, "'").replace(/\s+/g, " ").replace(/[?.!]+$/g, "").trim();
306
- }
307
- function primerOccurrenceKey(candidate) {
308
- return [
309
- candidate.projectPath,
310
- candidate.harness,
311
- candidate.sessionId,
312
- candidate.sourceStartMessageId,
313
- candidate.sourceEndMessageId
314
- ].join("\x1F");
315
- }
316
- function primerOccurrenceUtcDay(sourceMessageTime) {
317
- return new Date(sourceMessageTime).toISOString().slice(0, 10);
318
- }
319
- function vectorBlob(vector) {
320
- if (!vector)
321
- return null;
322
- return new Uint8Array(vector.buffer, vector.byteOffset, vector.byteLength);
323
- }
324
- function blobToFloat32Array(value) {
325
- if (!value)
326
- return null;
327
- const bytes = value instanceof ArrayBuffer ? new Uint8Array(value) : value;
328
- return new Float32Array(bytes.buffer.slice(bytes.byteOffset, bytes.byteOffset + bytes.byteLength));
329
- }
330
- function parseCandidateIds(raw) {
331
- if (!raw)
332
- return [];
333
- try {
334
- const parsed = JSON.parse(raw);
335
- return Array.isArray(parsed) ? parsed.filter((id) => typeof id === "number" && Number.isFinite(id)) : [];
336
- } catch {
337
- return [];
338
- }
339
- }
340
- function parsePrimerSourceProvenance(raw) {
341
- if (raw === null)
342
- return null;
343
- try {
344
- const parsed = JSON.parse(raw);
345
- if (!Array.isArray(parsed))
346
- return null;
347
- const provenance = [];
348
- for (const value of parsed) {
349
- if (!value || typeof value !== "object")
350
- return null;
351
- const source = value;
352
- if (typeof source.candidate_id !== "number" || !Number.isFinite(source.candidate_id) || typeof source.project_path !== "string" || typeof source.harness !== "string" || typeof source.session_id !== "string" || source.source_compartment_start !== null && typeof source.source_compartment_start !== "number" || source.source_compartment_end !== null && typeof source.source_compartment_end !== "number" || typeof source.source_start_message_id !== "string" || typeof source.source_end_message_id !== "string") {
353
- return null;
354
- }
355
- provenance.push({
356
- candidateId: source.candidate_id,
357
- projectPath: source.project_path,
358
- harness: source.harness,
359
- sessionId: source.session_id,
360
- sourceCompartmentStart: source.source_compartment_start,
361
- sourceCompartmentEnd: source.source_compartment_end,
362
- sourceStartMessageId: source.source_start_message_id,
363
- sourceEndMessageId: source.source_end_message_id
364
- });
365
- }
366
- return provenance;
367
- } catch {
368
- return null;
369
- }
370
- }
371
- function loadPrimerSourceProvenance(db, candidateIds) {
372
- const ids = [...new Set(candidateIds)].sort((a, b) => a - b);
373
- if (ids.length === 0)
374
- return [];
375
- const placeholders = ids.map(() => "?").join(",");
376
- const rows = db.prepare(`SELECT id, project_path, harness, session_id,
377
- source_compartment_start, source_compartment_end,
378
- source_start_message_id, source_end_message_id
379
- FROM primer_candidates
380
- WHERE id IN (${placeholders})
381
- ORDER BY id ASC`).all(...ids);
382
- return rows.map((row) => ({
383
- candidateId: row.id,
384
- projectPath: row.project_path,
385
- harness: row.harness,
386
- sessionId: row.session_id,
387
- sourceCompartmentStart: row.source_compartment_start,
388
- sourceCompartmentEnd: row.source_compartment_end,
389
- sourceStartMessageId: row.source_start_message_id,
390
- sourceEndMessageId: row.source_end_message_id
391
- }));
392
- }
393
- function serializePrimerSourceProvenance(provenance, sourceCandidateIds) {
394
- if (provenance.length === 0 && sourceCandidateIds.length > 0)
395
- return null;
396
- return JSON.stringify(provenance.map((source) => ({
397
- candidate_id: source.candidateId,
398
- project_path: source.projectPath,
399
- harness: source.harness,
400
- session_id: source.sessionId,
401
- source_compartment_start: source.sourceCompartmentStart,
402
- source_compartment_end: source.sourceCompartmentEnd,
403
- source_start_message_id: source.sourceStartMessageId,
404
- source_end_message_id: source.sourceEndMessageId
405
- })));
406
- }
407
- function normalizedCandidateIds(candidateIds) {
408
- return [...new Set(candidateIds)].sort((a, b) => a - b);
409
- }
410
- function toCandidate(row) {
411
- return {
412
- id: row.id,
413
- projectPath: row.project_path,
414
- harness: row.harness,
415
- sessionId: row.session_id,
416
- question: row.question,
417
- normalizedQuestion: row.normalized_question,
418
- sourceCompartmentStart: row.source_compartment_start,
419
- sourceCompartmentEnd: row.source_compartment_end,
420
- sourceStartMessageId: row.source_start_message_id,
421
- sourceEndMessageId: row.source_end_message_id,
422
- sourceMessageTime: row.source_message_time,
423
- questionEmbedding: blobToFloat32Array(row.question_embedding),
424
- questionEmbeddingModelId: row.question_embedding_model_id,
425
- createdAt: row.created_at
426
- };
427
- }
428
- function toPrimer(row) {
429
- const status = row.status === "archived" ? "archived" : "active";
430
- return {
431
- id: row.id,
432
- projectPath: row.project_path,
433
- question: row.question,
434
- questionEmbedding: blobToFloat32Array(row.question_embedding),
435
- questionEmbeddingModelId: row.question_embedding_model_id,
436
- answer: row.answer,
437
- status,
438
- totalSupport: row.total_support,
439
- lastObservedAt: row.last_observed_at,
440
- answerRefreshedAt: row.answer_refreshed_at,
441
- sourceCandidateIds: parseCandidateIds(row.source_candidate_ids),
442
- sourceProvenance: parsePrimerSourceProvenance(row.source_candidate_provenance),
443
- createdAt: row.created_at,
444
- updatedAt: row.updated_at
445
- };
446
- }
447
- function insertPrimerCandidates(db, candidates) {
448
- const ids = [];
449
- const stmt = db.prepare(`
450
- INSERT INTO primer_candidates (
451
- project_path, harness, session_id, question, normalized_question,
452
- source_compartment_start, source_compartment_end,
453
- source_start_message_id, source_end_message_id, source_message_time,
454
- question_embedding, question_embedding_model_id, created_at
455
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
456
- ON CONFLICT(project_path, harness, session_id, source_start_message_id, source_end_message_id)
457
- DO UPDATE SET
458
- question = excluded.question,
459
- normalized_question = excluded.normalized_question,
460
- source_compartment_start = excluded.source_compartment_start,
461
- source_compartment_end = excluded.source_compartment_end,
462
- source_message_time = excluded.source_message_time,
463
- question_embedding = COALESCE(excluded.question_embedding, primer_candidates.question_embedding),
464
- question_embedding_model_id = COALESCE(excluded.question_embedding_model_id, primer_candidates.question_embedding_model_id),
465
- created_at = MIN(primer_candidates.created_at, excluded.created_at)
466
- `);
467
- const select = db.prepare(`
468
- SELECT id FROM primer_candidates
469
- WHERE project_path = ? AND harness = ? AND session_id = ?
470
- AND source_start_message_id = ? AND source_end_message_id = ?
471
- `);
472
- db.transaction(() => {
473
- for (const candidate of candidates) {
474
- const question = candidate.question.trim();
475
- if (!question)
476
- continue;
477
- const normalized = candidate.normalizedQuestion ?? normalizePrimerQuestion(question);
478
- stmt.run(candidate.projectPath, candidate.harness || "opencode", candidate.sessionId, question, normalized, candidate.sourceCompartmentStart ?? null, candidate.sourceCompartmentEnd ?? null, candidate.sourceStartMessageId, candidate.sourceEndMessageId, candidate.sourceMessageTime, vectorBlob(candidate.questionEmbedding), candidate.questionEmbeddingModelId ?? null, candidate.createdAt ?? Date.now());
479
- const row = select.get(candidate.projectPath, candidate.harness || "opencode", candidate.sessionId, candidate.sourceStartMessageId, candidate.sourceEndMessageId);
480
- if (typeof row?.id === "number")
481
- ids.push(row.id);
482
- }
483
- }).immediate();
484
- return ids;
485
- }
486
- function updatePrimerCandidateEmbedding(db, candidateId, vector, modelId) {
487
- db.prepare("UPDATE primer_candidates SET question_embedding = ?, question_embedding_model_id = ? WHERE id = ?").run(vectorBlob(vector), modelId, candidateId);
488
- }
489
- function getPrimerCandidatesByIds(db, ids) {
490
- if (ids.length === 0)
491
- return [];
492
- const placeholders = ids.map(() => "?").join(",");
493
- const rows = db.prepare(`SELECT * FROM primer_candidates WHERE id IN (${placeholders})`).all(...ids);
494
- return rows.map(toCandidate);
495
- }
496
- function getPrimerCandidatesForPromotion(db, projectPath, now = Date.now(), ttlMs = PRIMER_CANDIDATE_TTL_MS) {
497
- const cutoff = now - ttlMs;
498
- const rows = db.prepare(`SELECT * FROM primer_candidates
499
- WHERE project_path = ? AND source_message_time >= ?
500
- ORDER BY project_path ASC, harness ASC, session_id ASC, source_start_message_id ASC, source_end_message_id ASC, id ASC`).all(projectPath, cutoff);
501
- return rows.map(toCandidate);
502
- }
503
- function countPrimerCandidatesForProject(db, projectPath) {
504
- const row = db.prepare("SELECT COUNT(*) AS count FROM primer_candidates WHERE project_path = ?").get(projectPath);
505
- return row?.count ?? 0;
506
- }
507
- function getActivePrimers(db, projectPath) {
508
- const rows = db.prepare(`SELECT * FROM primers
509
- WHERE project_path = ? AND status = 'active'
510
- ORDER BY COALESCE(last_observed_at, created_at) DESC, id ASC`).all(projectPath);
511
- return rows.map(toPrimer);
512
- }
513
- function createPrimer(db, input) {
514
- return db.transaction(() => {
515
- const now = input.now ?? Date.now();
516
- const sourceCandidateIds = normalizedCandidateIds(input.sourceCandidateIds);
517
- const sourceProvenance = loadPrimerSourceProvenance(db, sourceCandidateIds);
518
- const info = db.prepare(`INSERT INTO primers (
519
- project_path, question, question_embedding, question_embedding_model_id, answer,
520
- status, total_support, last_observed_at, answer_refreshed_at,
521
- source_candidate_ids, source_candidate_provenance, created_at, updated_at
522
- ) VALUES (?, ?, ?, ?, ?, 'active', ?, ?, NULL, ?, ?, ?, ?)`).run(input.projectPath, input.question, vectorBlob(input.questionEmbedding), input.questionEmbeddingModelId ?? null, input.answer ?? "", input.totalSupport, input.lastObservedAt, JSON.stringify(sourceCandidateIds), serializePrimerSourceProvenance(sourceProvenance, sourceCandidateIds), now, now);
523
- return Number(info.lastInsertRowid);
524
- }).immediate();
525
- }
526
- function updatePrimerSupport(db, input) {
527
- db.transaction(() => {
528
- const sourceCandidateIds = normalizedCandidateIds(input.sourceCandidateIds);
529
- const allowedIds = new Set(sourceCandidateIds);
530
- const existingRow = db.prepare("SELECT source_candidate_provenance FROM primers WHERE id = ?").get(input.primerId);
531
- const provenanceByCandidateId = new Map;
532
- for (const source of parsePrimerSourceProvenance(existingRow?.source_candidate_provenance ?? null) ?? []) {
533
- if (allowedIds.has(source.candidateId)) {
534
- provenanceByCandidateId.set(source.candidateId, source);
535
- }
536
- }
537
- for (const source of loadPrimerSourceProvenance(db, sourceCandidateIds)) {
538
- provenanceByCandidateId.set(source.candidateId, source);
539
- }
540
- const sourceProvenance = [...provenanceByCandidateId.values()].sort((a, b) => a.candidateId - b.candidateId);
541
- db.prepare(`UPDATE primers
542
- SET question_embedding = COALESCE(?, question_embedding),
543
- question_embedding_model_id = COALESCE(?, question_embedding_model_id),
544
- total_support = ?,
545
- last_observed_at = ?,
546
- source_candidate_ids = ?,
547
- source_candidate_provenance = ?,
548
- updated_at = ?
549
- WHERE id = ?`).run(vectorBlob(input.questionEmbedding), input.questionEmbeddingModelId ?? null, input.totalSupport, input.lastObservedAt, JSON.stringify(sourceCandidateIds), serializePrimerSourceProvenance(sourceProvenance, sourceCandidateIds), input.now ?? Date.now(), input.primerId);
550
- }).immediate();
551
- }
552
- function updatePrimerAnswer(db, primerId, answer, refreshedAt = Date.now()) {
553
- db.prepare("UPDATE primers SET answer = ?, answer_refreshed_at = ?, updated_at = ? WHERE id = ?").run(answer, refreshedAt, refreshedAt, primerId);
554
- }
555
-
556
31
  // src/shared/user-facing-codes.ts
557
32
  var USER_FACING_FAILURES = {
558
33
  historian_unavailable: {
@@ -1308,4 +783,4 @@ async function normalizeVerificationFiles(args) {
1308
783
  gitRoot
1309
784
  };
1310
785
  }
1311
- export { SESSION_NOTE_CONDITION_ERROR, getNoteByIdInScope, getNotes, addNote, getSessionNotes, getPendingSmartNotes, getReadySmartNotes, updateNote, dismissNotes, dismissNote, markNoteReady, markNoteChecked, PRIMER_CANDIDATE_TTL_MS, PRIMER_CANDIDATE_MAX_AGE_MS, primerOccurrenceKey, primerOccurrenceUtcDay, insertPrimerCandidates, updatePrimerCandidateEmbedding, getPrimerCandidatesByIds, getPrimerCandidatesForPromotion, countPrimerCandidatesForProject, getActivePrimers, createPrimer, updatePrimerSupport, updatePrimerAnswer, USER_FACING_FAILURES, renderUserFacingFailure, userFacingFailureCode, renderCapabilityRefusal, renderDreamFailure, dreamFailureCode, renderEmbeddingFailure, promoteSessionFactsDurable, embedPromotedFacts, relaxedFtsQuery, sanitizeFtsQuery, searchMemoriesFTS, searchMemoriesFTSUnion, recordMemoryMapping, recordMemoryVerifications, getUnmappedMemoryIds, clearMemoryVerifications, getMemoryVerifications, resolveGitTopLevel, readGitHead, readGitChangedFilesSince, readGitFileChangeTimesSince, verificationFileExists, normalizeVerificationFiles };
786
+ export { USER_FACING_FAILURES, renderUserFacingFailure, userFacingFailureCode, renderCapabilityRefusal, renderDreamFailure, dreamFailureCode, renderEmbeddingFailure, promoteSessionFactsDurable, embedPromotedFacts, relaxedFtsQuery, sanitizeFtsQuery, searchMemoriesFTS, searchMemoriesFTSUnion, recordMemoryMapping, recordMemoryVerifications, getUnmappedMemoryIds, clearMemoryVerifications, getMemoryVerifications, resolveGitTopLevel, readGitHead, readGitChangedFilesSince, readGitFileChangeTimesSince, verificationFileExists, normalizeVerificationFiles };