@cortexkit/opencode-magic-context 0.48.0 → 0.49.0

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 (203) hide show
  1. package/dist/auto-search-worker.js +3 -3
  2. package/dist/{conflict-warning-hook-w8cykrnf.js → conflict-warning-hook-kzx4dmk1.js} +7 -7
  3. package/dist/{context-m0cy262m.js → context-nj5f293n.js} +96 -43
  4. package/dist/{derive-budgets-sg0xsq7s.js → derive-budgets-qz5rrr08.js} +2 -2
  5. package/dist/embedding-backfill-aetxv1vt.js +21 -0
  6. package/dist/embedding-worker.js +4 -4
  7. package/dist/features/magic-context/git-commits/search-git-commits.d.ts +2 -0
  8. package/dist/features/magic-context/git-commits/search-git-commits.d.ts.map +1 -1
  9. package/dist/features/magic-context/message-index.d.ts.map +1 -1
  10. package/dist/features/magic-context/pi-content-decisions.d.ts +1 -1
  11. package/dist/features/magic-context/pi-content-decisions.d.ts.map +1 -1
  12. package/dist/features/magic-context/search-rerank.d.ts +35 -0
  13. package/dist/features/magic-context/search-rerank.d.ts.map +1 -0
  14. package/dist/features/magic-context/search.d.ts +11 -0
  15. package/dist/features/magic-context/search.d.ts.map +1 -1
  16. package/dist/features/magic-context/storage-meta-persisted.d.ts +13 -2
  17. package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
  18. package/dist/features/magic-context/storage-meta-session.d.ts +1 -1
  19. package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
  20. package/dist/features/magic-context/storage-meta.d.ts +1 -1
  21. package/dist/features/magic-context/storage-meta.d.ts.map +1 -1
  22. package/dist/features/magic-context/storage-session-tables.d.ts +2 -0
  23. package/dist/features/magic-context/storage-session-tables.d.ts.map +1 -1
  24. package/dist/features/magic-context/storage-tag-identity-revision.d.ts +29 -9
  25. package/dist/features/magic-context/storage-tag-identity-revision.d.ts.map +1 -1
  26. package/dist/features/magic-context/storage-tags.d.ts +9 -0
  27. package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
  28. package/dist/features/magic-context/storage.d.ts +1 -1
  29. package/dist/features/magic-context/storage.d.ts.map +1 -1
  30. package/dist/features/magic-context/tagger.d.ts +2 -0
  31. package/dist/features/magic-context/tagger.d.ts.map +1 -1
  32. package/dist/features/magic-context/transform-decision-log.d.ts +3 -0
  33. package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
  34. package/dist/hooks/magic-context/auto-search-deadline.d.ts.map +1 -1
  35. package/dist/hooks/magic-context/auto-search-replay.fixture.d.ts +24 -0
  36. package/dist/hooks/magic-context/auto-search-replay.fixture.d.ts.map +1 -0
  37. package/dist/hooks/magic-context/auto-search-runner.d.ts +1 -1
  38. package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
  39. package/dist/hooks/magic-context/auto-search-worker-client.d.ts +2 -0
  40. package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
  41. package/dist/hooks/magic-context/command-handler.d.ts +2 -0
  42. package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
  43. package/dist/hooks/magic-context/emergency-fail-closed.d.ts +28 -0
  44. package/dist/hooks/magic-context/emergency-fail-closed.d.ts.map +1 -1
  45. package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
  46. package/dist/hooks/magic-context/historian-host-runner.d.ts +8 -0
  47. package/dist/hooks/magic-context/historian-host-runner.d.ts.map +1 -1
  48. package/dist/hooks/magic-context/hook.d.ts +2 -1
  49. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  50. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
  51. package/dist/hooks/magic-context/latest-thinking-recovery.d.ts +7 -0
  52. package/dist/hooks/magic-context/latest-thinking-recovery.d.ts.map +1 -1
  53. package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
  54. package/dist/hooks/magic-context/pass-outcome.d.ts +1 -0
  55. package/dist/hooks/magic-context/pass-outcome.d.ts.map +1 -1
  56. package/dist/hooks/magic-context/read-session-chunk.d.ts +7 -1
  57. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  58. package/dist/hooks/magic-context/read-session-raw.d.ts +35 -0
  59. package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -1
  60. package/dist/hooks/magic-context/rust-mode-transform.d.ts +36 -0
  61. package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
  62. package/dist/hooks/magic-context/shared-compartment-boundaries.d.ts +8 -1
  63. package/dist/hooks/magic-context/shared-compartment-boundaries.d.ts.map +1 -1
  64. package/dist/hooks/magic-context/strict-thinking-prefix.d.ts +8 -0
  65. package/dist/hooks/magic-context/strict-thinking-prefix.d.ts.map +1 -0
  66. package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
  67. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +13 -0
  68. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  69. package/dist/hooks/magic-context/transform.d.ts +1 -0
  70. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  71. package/dist/{index-db7zwa3v.js → index-1bt88epp.js} +93 -9
  72. package/dist/{index-f0h6xwqm.js → index-1g30axtz.js} +229 -67
  73. package/dist/{index-k1xb52kd.js → index-1r0k9js3.js} +5 -5
  74. package/dist/{index-692jzy0p.js → index-2jcbj7r1.js} +122 -371
  75. package/dist/{index-bdckkfw6.js → index-2jgwttpt.js} +16 -8
  76. package/dist/{index-2y0s2hep.js → index-4mjhqadz.js} +1 -1
  77. package/dist/{index-pdecwzrd.js → index-57mrqed8.js} +1 -1
  78. package/dist/{index-ty64eqcn.js → index-9qjqq45k.js} +3 -3
  79. package/dist/{index-yq8n9qcb.js → index-9rt53q79.js} +4 -4
  80. package/dist/{index-pg50n748.js → index-b7mv1jx3.js} +4 -4
  81. package/dist/{index-mmyh6d8f.js → index-ezmszwbd.js} +6 -4
  82. package/dist/{index-fbv1dn35.js → index-gzcmtmar.js} +1 -1
  83. package/dist/{index-0an7742d.js → index-h2py7207.js} +549 -973
  84. package/dist/{index-0qhce371.js → index-h2wc01qk.js} +2 -2
  85. package/dist/{index-dhwzyd54.js → index-h5zfkjyk.js} +160 -25
  86. package/dist/{index-q2tqeqde.js → index-ha87j7a8.js} +1229 -78
  87. package/dist/{index-14cjxt20.js → index-hj2q50k0.js} +45 -8
  88. package/dist/{index-cb7emxgj.js → index-kmpvemph.js} +336 -6
  89. package/dist/{index-c43kr12f.js → index-kp5qe690.js} +7 -7
  90. package/dist/{index-bhvjj0ys.js → index-kq57tdf0.js} +2 -2
  91. package/dist/{index-7mx8v0pw.js → index-nm6a8xpd.js} +4 -4
  92. package/dist/{index-8j7gqj40.js → index-nsjyysj0.js} +6 -2
  93. package/dist/{index-k9nnwad5.js → index-nydv6g8r.js} +44 -7
  94. package/dist/{index-5zygecde.js → index-peshmj6h.js} +4 -4
  95. package/dist/{index-knh4y330.js → index-pxwp2hjk.js} +7 -2
  96. package/dist/{index-1qb0z7wa.js → index-qx53vezw.js} +1 -1
  97. package/dist/{index-q7h7csab.js → index-s4j7t92z.js} +9 -9
  98. package/dist/{index-z8e0psj8.js → index-stbr4ce6.js} +3 -3
  99. package/dist/{index-jcbd3znx.js → index-tqf7yg27.js} +1 -1
  100. package/dist/{index-72nhv486.js → index-vkbqdnkj.js} +2 -2
  101. package/dist/{index-eeezr5zz.js → index-z1tjp257.js} +1 -1
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js +61 -44
  104. package/dist/{logger-d3wex3dz.js → logger-ewak5q1s.js} +1 -1
  105. package/dist/{message-index-bounded-7ezbgddp.js → message-index-bounded-h0mrd4pr.js} +13 -13
  106. package/dist/{message-time-backfill-brbd63hv.js → message-time-backfill-8x06r9kx.js} +2 -2
  107. package/dist/migration-worker.js +9 -9
  108. package/dist/plugin/hooks/create-session-hooks.d.ts +2 -0
  109. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  110. package/dist/plugin/tool-registry.d.ts.map +1 -1
  111. package/dist/{project-embedding-registry-7qzptcw7.js → project-embedding-registry-rtt0djyb.js} +9 -9
  112. package/dist/raw-ordinal-warmup-worker.js +4 -4
  113. package/dist/{read-session-chunk-6k83m4fj.js → read-session-chunk-ty89v75e.js} +10 -8
  114. package/dist/{read-session-raw-3g9qy1xa.js → read-session-raw-8sjbc9h0.js} +5 -3
  115. package/dist/{recomp-orchestrator-d3fp1cy0.js → recomp-orchestrator-4f1yyd1q.js} +25 -25
  116. package/dist/{safe-notification-target-5ffqq32m.js → safe-notification-target-q0cyrx3x.js} +2 -2
  117. package/dist/{search-epax1ecv.js → search-pz4f4wge.js} +20 -20
  118. package/dist/{send-session-notification-erecz4y4.js → send-session-notification-38cd5dqt.js} +5 -5
  119. package/dist/shared/auto-search-lifecycle.d.ts +14 -0
  120. package/dist/shared/auto-search-lifecycle.d.ts.map +1 -1
  121. package/dist/shared/logger.d.ts.map +1 -1
  122. package/dist/shared/models-dev-temperature.d.ts +18 -0
  123. package/dist/shared/models-dev-temperature.d.ts.map +1 -0
  124. package/dist/shared/project-directory-key.d.ts +16 -0
  125. package/dist/shared/project-directory-key.d.ts.map +1 -1
  126. package/dist/shared/subagent-temperature.d.ts +46 -0
  127. package/dist/shared/subagent-temperature.d.ts.map +1 -0
  128. package/dist/{storage-tags-d3b0v2ss.js → storage-tags-k0pda32s.js} +6 -4
  129. package/dist/tools/ctx-reduce/tools.d.ts.map +1 -1
  130. package/dist/tools/ctx-search/tools.d.ts.map +1 -1
  131. package/dist/tools/ctx-search/types.d.ts +1 -0
  132. package/dist/tools/ctx-search/types.d.ts.map +1 -1
  133. package/dist/{transform-postprocess-phase-spcy2qre.js → transform-postprocess-phase-tck4g20s.js} +25 -25
  134. package/dist/v2/auto-search-worker.js +3 -3
  135. package/dist/v2/{context-sf98kstd.js → context-crbt6p1y.js} +809 -1052
  136. package/dist/v2/{derive-budgets-3vc0y84t.js → derive-budgets-fgej9j46.js} +3 -3
  137. package/dist/v2/embedding-backfill-ph1qfyn3.js +21 -0
  138. package/dist/v2/embedding-worker.js +4 -4
  139. package/dist/v2/hidden-child-native.d.ts.map +1 -1
  140. package/dist/v2/hidden-completion.d.ts +7 -0
  141. package/dist/v2/hidden-completion.d.ts.map +1 -1
  142. package/dist/v2/hooks/context.d.ts.map +1 -1
  143. package/dist/v2/hooks/dream-trigger.d.ts +4 -1
  144. package/dist/v2/hooks/dream-trigger.d.ts.map +1 -1
  145. package/dist/v2/hooks/generate.d.ts +9 -2
  146. package/dist/v2/hooks/generate.d.ts.map +1 -1
  147. package/dist/v2/{logger-mxd0ym09.js → logger-pj02s7sr.js} +1 -1
  148. package/dist/v2/{message-index-bounded-dy3s2k1e.js → message-index-bounded-xwqdywxg.js} +13 -13
  149. package/dist/v2/{message-time-backfill-gtx1pwk1.js → message-time-backfill-cje68egj.js} +2 -2
  150. package/dist/v2/migration-worker.js +9 -9
  151. package/dist/v2/{project-embedding-registry-1tgba5dv.js → project-embedding-registry-d6m7tyxr.js} +9 -9
  152. package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
  153. package/dist/v2/{read-session-chunk-rh4khdkv.js → read-session-chunk-8p5mdryx.js} +10 -8
  154. package/dist/v2/{read-session-raw-bsbmf0vj.js → read-session-raw-j8dvp7f4.js} +5 -3
  155. package/dist/v2/{recomp-orchestrator-az61rfcg.js → recomp-orchestrator-ckfgt6wq.js} +26 -26
  156. package/dist/v2/{safe-notification-target-73ax1p5v.js → safe-notification-target-y3p1hce9.js} +2 -2
  157. package/dist/v2/{search-nzkwrc6n.js → search-ym8rehhz.js} +20 -20
  158. package/dist/v2/{send-session-notification-6km439kn.js → send-session-notification-5m0yapqx.js} +5 -5
  159. package/dist/v2/{server-x2g40a71.js → server-19zjmn02.js} +2 -2
  160. package/dist/v2/{server-sggvvzhb.js → server-1tk82krw.js} +45 -8
  161. package/dist/v2/{server-vqpf3167.js → server-2s6ayq3t.js} +2 -2
  162. package/dist/v2/{server-z2037m6z.js → server-2s9qz6n7.js} +2 -2
  163. package/dist/v2/{server-k228xhjg.js → server-3j4d00kf.js} +1 -1
  164. package/dist/v2/{server-aan4q8mx.js → server-3t0q2cqx.js} +1 -1
  165. package/dist/v2/{server-2fbhp79z.js → server-4ez8mntn.js} +16 -8
  166. package/dist/v2/{server-zxhgvsf9.js → server-676xw7at.js} +1 -1
  167. package/dist/v2/{server-52awr2mw.js → server-6byqfbqf.js} +93 -9
  168. package/dist/v2/{server-qye6ykf7.js → server-7ekna9zs.js} +2 -2
  169. package/dist/v2/{server-g5r0n3b6.js → server-7h861yms.js} +160 -25
  170. package/dist/v2/{server-v06jcv0w.js → server-8k2agx29.js} +1 -1
  171. package/dist/v2/{server-686jg6eb.js → server-c5rrgrcd.js} +44 -7
  172. package/dist/v2/{server-4k748ke6.js → server-hb6xhh9q.js} +2 -2
  173. package/dist/v2/{server-7wwc2nga.js → server-jvxzm1jy.js} +7 -7
  174. package/dist/v2/{server-1r6pmz4f.js → server-kzns2hbz.js} +1 -1
  175. package/dist/v2/{server-xdfwt6kh.js → server-pj4pjv02.js} +2 -2
  176. package/dist/v2/{server-psqc7e9n.js → server-q4ph9bwn.js} +1227 -78
  177. package/dist/v2/{server-8pyt7hev.js → server-sa8jvrfc.js} +9 -9
  178. package/dist/v2/{server-ezhze64f.js → server-ss95ky04.js} +4 -4
  179. package/dist/v2/{server-5m3dt5r1.js → server-t4k4qexw.js} +6 -2
  180. package/dist/v2/{server-e0vdaae2.js → server-v4mewb78.js} +4 -4
  181. package/dist/v2/{server-gjcr4w98.js → server-w32kmdez.js} +4 -4
  182. package/dist/v2/{server-k8x2rbxc.js → server-x4hscabv.js} +119 -365
  183. package/dist/v2/{server-yczc713m.js → server-xwz4dqh9.js} +7 -2
  184. package/dist/v2/{server-xxm59eww.js → server-ycw9qqcy.js} +4 -4
  185. package/dist/v2/{server-8tqanswc.js → server-zp53y8js.js} +331 -4
  186. package/dist/v2/server.js +4 -4
  187. package/dist/v2/{storage-tags-w4tv77sn.js → storage-tags-8vw924zn.js} +6 -4
  188. package/dist/v2/store-reader.d.ts +8 -2
  189. package/dist/v2/store-reader.d.ts.map +1 -1
  190. package/dist/v2/{wrapup-orchestrator-mz7efs7w.js → wrapup-orchestrator-a7efxaax.js} +26 -26
  191. package/dist/wrapup-orchestrator-barbc6h9.js +44 -0
  192. package/package.json +1 -1
  193. package/src/shared/auto-search-lifecycle.ts +43 -0
  194. package/src/shared/logger.test.ts +38 -0
  195. package/src/shared/logger.ts +10 -2
  196. package/src/shared/models-dev-temperature.ts +107 -0
  197. package/src/shared/project-directory-key.test.ts +59 -0
  198. package/src/shared/project-directory-key.ts +20 -0
  199. package/src/shared/subagent-temperature.test.ts +270 -0
  200. package/src/shared/subagent-temperature.ts +110 -0
  201. package/dist/embedding-backfill-9rcm1mfy.js +0 -21
  202. package/dist/v2/embedding-backfill-vn8g1nh1.js +0 -21
  203. package/dist/wrapup-orchestrator-amzta1t4.js +0 -44
@@ -4,13 +4,13 @@ import {
4
4
  } from "./server-1zx87sdm.js";
5
5
  import {
6
6
  estimateTokens
7
- } from "./server-1r6pmz4f.js";
7
+ } from "./server-kzns2hbz.js";
8
8
  import {
9
9
  getHarness2
10
10
  } from "./server-pavzsdc6.js";
11
11
  import {
12
12
  sessionLog2
13
- } from "./server-5m3dt5r1.js";
13
+ } from "./server-t4k4qexw.js";
14
14
  import {
15
15
  getTagIdentityWriteGeneration2,
16
16
  getSqliteDatabasePath2
@@ -19,7 +19,7 @@ import {
19
19
  stableStringify,
20
20
  tagOrderConstraintIndex,
21
21
  tagIdentityRevisionKey
22
- } from "./server-52awr2mw.js";
22
+ } from "./server-6byqfbqf.js";
23
23
  import {
24
24
  DEFAULT_PROTECTED_TOOLS,
25
25
  normalizeProtectedToolName,
@@ -2402,6 +2402,15 @@ function readTagIdentityRevision(db, sessionId) {
2402
2402
  const row = db.prepare("SELECT value FROM schema_migrations_meta WHERE key = ?").get(tagIdentityRevisionKey(sessionId));
2403
2403
  return typeof row?.value === "string" ? row.value : null;
2404
2404
  }
2405
+ function captureInitialTagOwnerRevision(db, sessionId, cached, appendedRows) {
2406
+ if (cached.identityRevision !== null || appendedRows === 0)
2407
+ return true;
2408
+ const revision = readTagIdentityRevision(db, sessionId);
2409
+ if (revision !== null && !/^[1-9]\d*:0$/.test(revision))
2410
+ return false;
2411
+ cached.identityRevision = revision;
2412
+ return true;
2413
+ }
2405
2414
  function appendedSinceForeignCommit(db, sessionId, cached) {
2406
2415
  tagOwnerShapeChecks += 1;
2407
2416
  const rows = db.prepare(TAG_OWNER_APPENDED_WITH_SHAPE_SQL).all(cached.globalLastRowId, sessionId, tagIdentityRevisionKey(sessionId), sessionId);
@@ -2442,6 +2451,11 @@ function readTagOwnerSummary(db, sessionId, proseRatio, extraRatios = []) {
2442
2451
  rows.push(...page);
2443
2452
  }
2444
2453
  }
2454
+ if (!captureInitialTagOwnerRevision(db, sessionId, cached, rows.length)) {
2455
+ if (offThreadOnly)
2456
+ throw new TagOwnerSummaryNotReady;
2457
+ rows = null;
2458
+ }
2445
2459
  } else {
2446
2460
  if (offThreadOnly)
2447
2461
  db.exec("BEGIN");
@@ -2571,7 +2585,7 @@ function getTagNumberByMessageIdStatement(db) {
2571
2585
  function getAssignableTagNumberByMessageIdStatement(db) {
2572
2586
  let stmt = getAssignableTagNumberByMessageIdStatements.get(db);
2573
2587
  if (!stmt) {
2574
- stmt = db.prepare(`SELECT tag_number FROM tags
2588
+ stmt = db.prepare(`SELECT tag_number FROM tags INDEXED BY idx_tags_session_message_id
2575
2589
  WHERE session_id = ?
2576
2590
  AND message_id = ?
2577
2591
  AND NOT (
@@ -2672,6 +2686,28 @@ function getInertWhitespaceAssistantTags2(db, sessionId, messageIds) {
2672
2686
  return contentId.length > 0 ? [{ tagNumber: row.tagNumber, contentId }] : [];
2673
2687
  });
2674
2688
  }
2689
+ var inertWhitespaceByNumberStatements = new WeakMap;
2690
+ function getInertWhitespaceAssistantTagsByNumbers2(db, sessionId, tagNumbers) {
2691
+ if (tagNumbers.length === 0)
2692
+ return [];
2693
+ let statement = inertWhitespaceByNumberStatements.get(db);
2694
+ if (!statement) {
2695
+ statement = db.prepare(`SELECT tags.tag_number AS tagNumber, tags.entry_fingerprint AS entryFingerprint
2696
+ FROM json_each(?) AS wanted CROSS JOIN tags
2697
+ WHERE tags.session_id = ?
2698
+ AND tags.tag_number = wanted.value
2699
+ AND tags.type = 'message'
2700
+ AND tags.status = 'compacted'
2701
+ AND tags.entry_fingerprint LIKE ?
2702
+ ORDER BY tags.tag_number, tags.id`);
2703
+ inertWhitespaceByNumberStatements.set(db, statement);
2704
+ }
2705
+ const rows = statement.all(JSON.stringify([...new Set(tagNumbers)]), sessionId, `${WHITESPACE_ASSISTANT_INERT_FINGERPRINT_PREFIX}%`);
2706
+ return rows.flatMap((row) => {
2707
+ const contentId = row.entryFingerprint.slice(WHITESPACE_ASSISTANT_INERT_FINGERPRINT_PREFIX.length);
2708
+ return contentId.length > 0 ? [{ tagNumber: row.tagNumber, contentId }] : [];
2709
+ });
2710
+ }
2675
2711
  function updateTagDropMode2(db, sessionId, tagNumber, dropMode) {
2676
2712
  getUpdateTagDropModeStatement(db).run(dropMode, sessionId, tagNumber);
2677
2713
  }
@@ -3100,7 +3136,8 @@ function markTagsCompactedByMessageIds2(db, sessionId, messageIds, eligibleTagNu
3100
3136
  SELECT value AS source_id, lower(value) AS folded_id FROM json_each(?)
3101
3137
  )
3102
3138
  SELECT id, tag_number, message_id, tool_owner_message_id FROM tags INDEXED BY ${tagOrderConstraintIndex(db)}
3103
- WHERE session_id = ? AND status IN ('active', 'dropped') AND (
3139
+ WHERE session_id = ? ${eligibleTagNumbers ? "AND tag_number IN (SELECT value FROM json_each(?))" : ""}
3140
+ AND status IN ('active', 'dropped') AND (
3104
3141
  message_id IN (SELECT source_id FROM ids)
3105
3142
  OR tool_owner_message_id IN (SELECT source_id FROM ids)
3106
3143
  OR (instr(lower(message_id), ':p') > 0 AND
@@ -3109,7 +3146,7 @@ function markTagsCompactedByMessageIds2(db, sessionId, messageIds, eligibleTagNu
3109
3146
  lower(substr(message_id, 1, instr(lower(message_id), ':file') - 1)) IN (SELECT folded_id FROM ids))
3110
3147
  OR (? AND instr(message_id, ':') > 0)
3111
3148
  OR ?
3112
- )`).all(JSON.stringify(Array.from(ids)), sessionId, Array.from(ids).some((id) => id.includes(":")) ? 1 : 0, nulPrefixes.size > 0 ? 1 : 0);
3149
+ )`).all(JSON.stringify(Array.from(ids)), sessionId, ...eligibleTagNumbers ? [JSON.stringify([...eligibleTagNumbers])] : [], Array.from(ids).some((id) => id.includes(":")) ? 1 : 0, nulPrefixes.size > 0 ? 1 : 0);
3113
3150
  const candidates = rows.filter((row) => (eligibleTagNumbers === undefined || eligibleTagNumbers.has(row.tag_number)) && matches(row.message_id, row.tool_owner_message_id));
3114
3151
  if (candidates.length === 0)
3115
3152
  return 0;
@@ -3505,4 +3542,4 @@ function deleteToolTagsByOwner(db, sessionId, ownerMsgId) {
3505
3542
  return getDeleteToolTagsByOwnerStatement(db).all(sessionId, ownerMsgId).length;
3506
3543
  }
3507
3544
 
3508
- export { protectedToolTagNumbers, protectedToolTokenCount, stripWellFormedLeadingTagPrefix, byteSize, stripTagPrefix, peelLeadingMcTagNotation, prependTag, isThinkingPart, isRecord, contentTagOwnerMessageId, estimateImageTokensFromDataUrl, estimateToolAttachmentImageTokens, providerVisiblePart, providerVisibleMessage, normalizeTodoStateJson, buildSyntheticTodoPart, computeSyntheticCallId, isSyntheticTodoPart, countRealUserMessages, tailHygieneStructuralSignature, sameTailHygieneStructuralSignature, formatTailHygienePrefixMismatch, refreshTailHygieneBaseline, effectiveTailHygiene, assertTailHygieneContentUnchangedIfEnabled, CHANNEL1_SENTINEL, CHANNEL1_FLOOR_TOKENS, isDroppedToolOutput, toolOutputTokens, decideChannel1, evaluateChannel2, formatChannel1Evaluation, formatChannel2Evaluation, reclaimableToolOutputCount, buildChannel2Reminder, buildChannel1Reminder, estimateEmergencyDropReclaimTokens, planEmergencyDrop, measureEmergencyTag, queuePendingOp, queuePendingDropForUnchangedTag, getPendingOps, hasPendingDropOps, getPendingOpsCount, clearPendingOps, removePendingOp, getRecentTagOwnerMessageIds2, getActiveTagTokenAggregate2, AGE_RECLAIM_MIN_TOKENS2, getOldestActiveUnprotectedToolTags2, getActiveToolTagsForAgeReclaim2, getTriggerTagTokenUpperBound2, getActiveTagTokenTotalsByMessage2, getPersistedToolTagAccounting2, getAllStatusTagTokenTotalsFlat2, getReasoningTokenEstimatesByMessage2, tryGetReasoningTokenEstimatesByMessage2, getMaxTagNumberByOwnerMessage2, scanTagOwnerSummary2, cachedTagOwnerRatios2, tagOwnerWarmupState2, scanTagOwnerDelta2, installTagOwnerDelta2, installTagOwnerSummary2, isTagOwnerSummaryReady2, tagTokenCountIsNull2, backfillTagTokenCounts2, insertTag2, updateTagStatus2, markWhitespaceAssistantTagInert2, getInertWhitespaceAssistantTags2, updateTagDropMode2, updateCavemanDepth2, updateTagMessageId2, hasPiFallbackMessageTags2, findAdoptableFallbackTags2, adoptFallbackTagMessageId2, foldShrunkPartTags2, hasPiFallbackToolOwnerTags2, findPiFallbackToolOwnerTags2, adoptPiFallbackToolOwnerTag2, adoptPiFallbackMessageTag2, markTagsCompactedByMessageIds2, deleteTagsByMessageId2, getMaxTagNumberBySession2, getTagNumberByMessageId2, getAssignableTagNumberByMessageId2, getMinMessageTagNumberForRawId2, deriveTagLoadFloor2, TAG_SELECT_COLUMNS2, getTagsBySession2, getActiveTagsBySession2, getTailHygieneTags2, getDroppedTagsBySession2, getTagsForPendingOperations2, getTagsByNumbers2, getNewestToolTagNumbers2, getDroppedTagsByNumbers2, getMaxDroppedTagNumber2, getTagById2, getTopNBySize2, getToolTagNumberByOwner2, getNullOwnerToolTag2, adoptNullOwnerToolTag2, getCandidateToolOwners2, pickNearestPriorOwner2 };
3545
+ export { protectedToolTagNumbers, protectedToolTokenCount, stripWellFormedLeadingTagPrefix, byteSize, stripTagPrefix, peelLeadingMcTagNotation, prependTag, isThinkingPart, isRecord, contentTagOwnerMessageId, estimateImageTokensFromDataUrl, estimateToolAttachmentImageTokens, providerVisiblePart, providerVisibleMessage, normalizeTodoStateJson, buildSyntheticTodoPart, computeSyntheticCallId, isSyntheticTodoPart, countRealUserMessages, tailHygieneStructuralSignature, sameTailHygieneStructuralSignature, formatTailHygienePrefixMismatch, refreshTailHygieneBaseline, effectiveTailHygiene, assertTailHygieneContentUnchangedIfEnabled, CHANNEL1_SENTINEL, CHANNEL1_FLOOR_TOKENS, isDroppedToolOutput, toolOutputTokens, decideChannel1, evaluateChannel2, formatChannel1Evaluation, formatChannel2Evaluation, reclaimableToolOutputCount, buildChannel2Reminder, buildChannel1Reminder, estimateEmergencyDropReclaimTokens, planEmergencyDrop, measureEmergencyTag, queuePendingOp, queuePendingDropForUnchangedTag, getPendingOps, hasPendingDropOps, getPendingOpsCount, clearPendingOps, removePendingOp, getRecentTagOwnerMessageIds2, getActiveTagTokenAggregate2, AGE_RECLAIM_MIN_TOKENS2, getOldestActiveUnprotectedToolTags2, getActiveToolTagsForAgeReclaim2, getTriggerTagTokenUpperBound2, getActiveTagTokenTotalsByMessage2, getPersistedToolTagAccounting2, getAllStatusTagTokenTotalsFlat2, getReasoningTokenEstimatesByMessage2, tryGetReasoningTokenEstimatesByMessage2, getMaxTagNumberByOwnerMessage2, scanTagOwnerSummary2, cachedTagOwnerRatios2, tagOwnerWarmupState2, scanTagOwnerDelta2, installTagOwnerDelta2, installTagOwnerSummary2, isTagOwnerSummaryReady2, tagTokenCountIsNull2, backfillTagTokenCounts2, insertTag2, updateTagStatus2, markWhitespaceAssistantTagInert2, getInertWhitespaceAssistantTags2, getInertWhitespaceAssistantTagsByNumbers2, updateTagDropMode2, updateCavemanDepth2, updateTagMessageId2, hasPiFallbackMessageTags2, findAdoptableFallbackTags2, adoptFallbackTagMessageId2, foldShrunkPartTags2, hasPiFallbackToolOwnerTags2, findPiFallbackToolOwnerTags2, adoptPiFallbackToolOwnerTag2, adoptPiFallbackMessageTag2, markTagsCompactedByMessageIds2, deleteTagsByMessageId2, getMaxTagNumberBySession2, getTagNumberByMessageId2, getAssignableTagNumberByMessageId2, getMinMessageTagNumberForRawId2, deriveTagLoadFloor2, TAG_SELECT_COLUMNS2, getTagsBySession2, getActiveTagsBySession2, getTailHygieneTags2, getDroppedTagsBySession2, getTagsForPendingOperations2, getTagsByNumbers2, getNewestToolTagNumbers2, getDroppedTagsByNumbers2, getMaxDroppedTagNumber2, getTagById2, getTopNBySize2, getToolTagNumberByOwner2, getNullOwnerToolTag2, adoptNullOwnerToolTag2, getCandidateToolOwners2, pickNearestPriorOwner2 };
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  estimateTokens
3
- } from "./server-1r6pmz4f.js";
3
+ } from "./server-kzns2hbz.js";
4
4
  import {
5
5
  getHarness2
6
6
  } from "./server-pavzsdc6.js";
7
7
  import {
8
8
  log2
9
- } from "./server-5m3dt5r1.js";
9
+ } from "./server-t4k4qexw.js";
10
10
 
11
11
  // src/features/magic-context/memory/embedding-synapse.ts
12
12
  import { createHash } from "node:crypto";
@@ -15,16 +15,16 @@ import {
15
15
  import {
16
16
  sanitizeDiagnosticText,
17
17
  log2
18
- } from "./server-5m3dt5r1.js";
18
+ } from "./server-t4k4qexw.js";
19
19
  import {
20
20
  estimateTokens
21
- } from "./server-1r6pmz4f.js";
21
+ } from "./server-kzns2hbz.js";
22
22
  import {
23
23
  SYNAPSE_DEFAULT_MODEL,
24
24
  isSynapseEmbeddingTruncated,
25
25
  getSynapseBatchRequestKey,
26
26
  SynapseEmbeddingProvider
27
- } from "./server-4k748ke6.js";
27
+ } from "./server-hb6xhh9q.js";
28
28
  import {
29
29
  CHUNK_WINDOW_SAFETY_RATIO,
30
30
  normalizeCompartmentChunkMaxInputTokens,
@@ -40,7 +40,7 @@ import {
40
40
  loadUnembeddedSessionChunkCandidatesPolite,
41
41
  countSessionCompartmentEmbedCoverage,
42
42
  countUnembeddedSessionCompartmentsPolite
43
- } from "./server-ezhze64f.js";
43
+ } from "./server-ss95ky04.js";
44
44
  import {
45
45
  saveEmbeddingIfHashMatches,
46
46
  getMemoryEmbedCoverage,
@@ -52,14 +52,14 @@ import {
52
52
  resolveEmbeddingTextPrefixes,
53
53
  getEmbeddingProviderIdentity,
54
54
  LocalEmbeddingProvider
55
- } from "./server-vqpf3167.js";
55
+ } from "./server-2s6ayq3t.js";
56
56
  import {
57
57
  isUserHomeDirectory,
58
58
  setBootQuietPeriodForTests
59
- } from "./server-yczc713m.js";
59
+ } from "./server-xwz4dqh9.js";
60
60
  import {
61
61
  logSlowWriteTransaction
62
- } from "./server-aan4q8mx.js";
62
+ } from "./server-3t0q2cqx.js";
63
63
 
64
64
  // src/features/magic-context/storage-embedding-measurements.ts
65
65
  import { createHash } from "node:crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  log2
3
- } from "./server-5m3dt5r1.js";
3
+ } from "./server-t4k4qexw.js";
4
4
 
5
5
  // src/hooks/magic-context/read-session-formatting.ts
6
6
  import { existsSync, readFileSync, realpathSync, statSync } from "node:fs";
@@ -3,7 +3,7 @@ import {
3
3
  } from "./server-pavzsdc6.js";
4
4
  import {
5
5
  log2
6
- } from "./server-5m3dt5r1.js";
6
+ } from "./server-t4k4qexw.js";
7
7
  import {
8
8
  resolveOpenCodeDbPath,
9
9
  assertOpenCodeStoreGeneration,
@@ -299,7 +299,7 @@ function getMessageTimesFromOpenCodeDb(sessionId, messageIds) {
299
299
  try {
300
300
  withReadOnlySessionDb((db) => {
301
301
  const placeholders = messageIds.map(() => "?").join(",");
302
- const rows = db.prepare(`SELECT id, time_created FROM message WHERE session_id = ? AND id IN (${placeholders})`).all(sessionId, ...messageIds);
302
+ const rows = db.prepare(`SELECT id, time_created FROM message WHERE +session_id = ? AND id IN (${placeholders})`).all(sessionId, ...messageIds);
303
303
  for (const row of rows) {
304
304
  if (typeof row.id === "string" && typeof row.time_created === "number") {
305
305
  result.set(row.id, row.time_created);