@wolfx/opencode-magic-context 0.21.8-patch.1

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 (544) hide show
  1. package/dist/agents/dreamer.d.ts +2 -0
  2. package/dist/agents/dreamer.d.ts.map +1 -0
  3. package/dist/agents/historian.d.ts +3 -0
  4. package/dist/agents/historian.d.ts.map +1 -0
  5. package/dist/agents/magic-context-prompt.d.ts +3 -0
  6. package/dist/agents/magic-context-prompt.d.ts.map +1 -0
  7. package/dist/agents/permissions.d.ts +142 -0
  8. package/dist/agents/permissions.d.ts.map +1 -0
  9. package/dist/agents/sidekick.d.ts +2 -0
  10. package/dist/agents/sidekick.d.ts.map +1 -0
  11. package/dist/config/agent-disable.d.ts +26 -0
  12. package/dist/config/agent-disable.d.ts.map +1 -0
  13. package/dist/config/index.d.ts +33 -0
  14. package/dist/config/index.d.ts.map +1 -0
  15. package/dist/config/schema/agent-overrides.d.ts +55 -0
  16. package/dist/config/schema/agent-overrides.d.ts.map +1 -0
  17. package/dist/config/schema/magic-context.d.ts +841 -0
  18. package/dist/config/schema/magic-context.d.ts.map +1 -0
  19. package/dist/config/schema.d.ts +3 -0
  20. package/dist/config/schema.d.ts.map +1 -0
  21. package/dist/config/variable.d.ts +48 -0
  22. package/dist/config/variable.d.ts.map +1 -0
  23. package/dist/features/builtin-commands/commands.d.ts +3 -0
  24. package/dist/features/builtin-commands/commands.d.ts.map +1 -0
  25. package/dist/features/builtin-commands/types.d.ts +5 -0
  26. package/dist/features/builtin-commands/types.d.ts.map +1 -0
  27. package/dist/features/magic-context/compaction-marker.d.ts +91 -0
  28. package/dist/features/magic-context/compaction-marker.d.ts.map +1 -0
  29. package/dist/features/magic-context/compaction.d.ts +7 -0
  30. package/dist/features/magic-context/compaction.d.ts.map +1 -0
  31. package/dist/features/magic-context/compartment-lease.d.ts +14 -0
  32. package/dist/features/magic-context/compartment-lease.d.ts.map +1 -0
  33. package/dist/features/magic-context/compartment-storage.d.ts +130 -0
  34. package/dist/features/magic-context/compartment-storage.d.ts.map +1 -0
  35. package/dist/features/magic-context/compression-depth-storage.d.ts +14 -0
  36. package/dist/features/magic-context/compression-depth-storage.d.ts.map +1 -0
  37. package/dist/features/magic-context/defaults.d.ts +2 -0
  38. package/dist/features/magic-context/defaults.d.ts.map +1 -0
  39. package/dist/features/magic-context/dreamer/index.d.ts +8 -0
  40. package/dist/features/magic-context/dreamer/index.d.ts.map +1 -0
  41. package/dist/features/magic-context/dreamer/lease.d.ts +8 -0
  42. package/dist/features/magic-context/dreamer/lease.d.ts.map +1 -0
  43. package/dist/features/magic-context/dreamer/queue.d.ts +44 -0
  44. package/dist/features/magic-context/dreamer/queue.d.ts.map +1 -0
  45. package/dist/features/magic-context/dreamer/runner.d.ts +81 -0
  46. package/dist/features/magic-context/dreamer/runner.d.ts.map +1 -0
  47. package/dist/features/magic-context/dreamer/scheduler.d.ts +33 -0
  48. package/dist/features/magic-context/dreamer/scheduler.d.ts.map +1 -0
  49. package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts +41 -0
  50. package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts.map +1 -0
  51. package/dist/features/magic-context/dreamer/storage-dream-state.d.ts +5 -0
  52. package/dist/features/magic-context/dreamer/storage-dream-state.d.ts.map +1 -0
  53. package/dist/features/magic-context/dreamer/task-prompts.d.ts +26 -0
  54. package/dist/features/magic-context/dreamer/task-prompts.d.ts.map +1 -0
  55. package/dist/features/magic-context/git-commits/git-log-reader.d.ts +57 -0
  56. package/dist/features/magic-context/git-commits/git-log-reader.d.ts.map +1 -0
  57. package/dist/features/magic-context/git-commits/index.d.ts +7 -0
  58. package/dist/features/magic-context/git-commits/index.d.ts.map +1 -0
  59. package/dist/features/magic-context/git-commits/indexer.d.ts +43 -0
  60. package/dist/features/magic-context/git-commits/indexer.d.ts.map +1 -0
  61. package/dist/features/magic-context/git-commits/search-git-commits.d.ts +32 -0
  62. package/dist/features/magic-context/git-commits/search-git-commits.d.ts.map +1 -0
  63. package/dist/features/magic-context/git-commits/storage-git-commit-embeddings.d.ts +19 -0
  64. package/dist/features/magic-context/git-commits/storage-git-commit-embeddings.d.ts.map +1 -0
  65. package/dist/features/magic-context/git-commits/storage-git-commits.d.ts +47 -0
  66. package/dist/features/magic-context/git-commits/storage-git-commits.d.ts.map +1 -0
  67. package/dist/features/magic-context/index.d.ts +12 -0
  68. package/dist/features/magic-context/index.d.ts.map +1 -0
  69. package/dist/features/magic-context/key-files/aft-availability.d.ts +11 -0
  70. package/dist/features/magic-context/key-files/aft-availability.d.ts.map +1 -0
  71. package/dist/features/magic-context/key-files/identify-key-files.d.ts +84 -0
  72. package/dist/features/magic-context/key-files/identify-key-files.d.ts.map +1 -0
  73. package/dist/features/magic-context/key-files/project-key-files.d.ts +42 -0
  74. package/dist/features/magic-context/key-files/project-key-files.d.ts.map +1 -0
  75. package/dist/features/magic-context/key-files/read-history.d.ts +26 -0
  76. package/dist/features/magic-context/key-files/read-history.d.ts.map +1 -0
  77. package/dist/features/magic-context/key-files/read-stats.d.ts +20 -0
  78. package/dist/features/magic-context/key-files/read-stats.d.ts.map +1 -0
  79. package/dist/features/magic-context/key-files/storage-key-files.d.ts +25 -0
  80. package/dist/features/magic-context/key-files/storage-key-files.d.ts.map +1 -0
  81. package/dist/features/magic-context/memory/constants.d.ts +5 -0
  82. package/dist/features/magic-context/memory/constants.d.ts.map +1 -0
  83. package/dist/features/magic-context/memory/cosine-similarity.d.ts +2 -0
  84. package/dist/features/magic-context/memory/cosine-similarity.d.ts.map +1 -0
  85. package/dist/features/magic-context/memory/embedding-backfill.d.ts +9 -0
  86. package/dist/features/magic-context/memory/embedding-backfill.d.ts.map +1 -0
  87. package/dist/features/magic-context/memory/embedding-cache.d.ts +8 -0
  88. package/dist/features/magic-context/memory/embedding-cache.d.ts.map +1 -0
  89. package/dist/features/magic-context/memory/embedding-identity.d.ts +11 -0
  90. package/dist/features/magic-context/memory/embedding-identity.d.ts.map +1 -0
  91. package/dist/features/magic-context/memory/embedding-local.d.ts +20 -0
  92. package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -0
  93. package/dist/features/magic-context/memory/embedding-openai.d.ts +44 -0
  94. package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -0
  95. package/dist/features/magic-context/memory/embedding-probe.d.ts +69 -0
  96. package/dist/features/magic-context/memory/embedding-probe.d.ts.map +1 -0
  97. package/dist/features/magic-context/memory/embedding-provider.d.ts +15 -0
  98. package/dist/features/magic-context/memory/embedding-provider.d.ts.map +1 -0
  99. package/dist/features/magic-context/memory/embedding.d.ts +39 -0
  100. package/dist/features/magic-context/memory/embedding.d.ts.map +1 -0
  101. package/dist/features/magic-context/memory/index.d.ts +12 -0
  102. package/dist/features/magic-context/memory/index.d.ts.map +1 -0
  103. package/dist/features/magic-context/memory/normalize-hash.d.ts +3 -0
  104. package/dist/features/magic-context/memory/normalize-hash.d.ts.map +1 -0
  105. package/dist/features/magic-context/memory/project-identity.d.ts +23 -0
  106. package/dist/features/magic-context/memory/project-identity.d.ts.map +1 -0
  107. package/dist/features/magic-context/memory/promotion.d.ts +13 -0
  108. package/dist/features/magic-context/memory/promotion.d.ts.map +1 -0
  109. package/dist/features/magic-context/memory/storage-memory-embeddings.d.ts +8 -0
  110. package/dist/features/magic-context/memory/storage-memory-embeddings.d.ts.map +1 -0
  111. package/dist/features/magic-context/memory/storage-memory-fts.d.ts +12 -0
  112. package/dist/features/magic-context/memory/storage-memory-fts.d.ts.map +1 -0
  113. package/dist/features/magic-context/memory/storage-memory.d.ts +31 -0
  114. package/dist/features/magic-context/memory/storage-memory.d.ts.map +1 -0
  115. package/dist/features/magic-context/memory/types.d.ts +37 -0
  116. package/dist/features/magic-context/memory/types.d.ts.map +1 -0
  117. package/dist/features/magic-context/message-index-async.d.ts +12 -0
  118. package/dist/features/magic-context/message-index-async.d.ts.map +1 -0
  119. package/dist/features/magic-context/message-index.d.ts +10 -0
  120. package/dist/features/magic-context/message-index.d.ts.map +1 -0
  121. package/dist/features/magic-context/migrations.d.ts +33 -0
  122. package/dist/features/magic-context/migrations.d.ts.map +1 -0
  123. package/dist/features/magic-context/mock-database.d.ts +3 -0
  124. package/dist/features/magic-context/mock-database.d.ts.map +1 -0
  125. package/dist/features/magic-context/overflow-detection.d.ts +51 -0
  126. package/dist/features/magic-context/overflow-detection.d.ts.map +1 -0
  127. package/dist/features/magic-context/plugin-messages.d.ts +75 -0
  128. package/dist/features/magic-context/plugin-messages.d.ts.map +1 -0
  129. package/dist/features/magic-context/project-embedding-registry.d.ts +44 -0
  130. package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -0
  131. package/dist/features/magic-context/range-parser.d.ts +13 -0
  132. package/dist/features/magic-context/range-parser.d.ts.map +1 -0
  133. package/dist/features/magic-context/resolve-subagent-fallback.d.ts +40 -0
  134. package/dist/features/magic-context/resolve-subagent-fallback.d.ts.map +1 -0
  135. package/dist/features/magic-context/scheduler.d.ts +18 -0
  136. package/dist/features/magic-context/scheduler.d.ts.map +1 -0
  137. package/dist/features/magic-context/search.d.ts +69 -0
  138. package/dist/features/magic-context/search.d.ts.map +1 -0
  139. package/dist/features/magic-context/sidekick/agent.d.ts +13 -0
  140. package/dist/features/magic-context/sidekick/agent.d.ts.map +1 -0
  141. package/dist/features/magic-context/sidekick/core.d.ts +38 -0
  142. package/dist/features/magic-context/sidekick/core.d.ts.map +1 -0
  143. package/dist/features/magic-context/sidekick/index.d.ts +3 -0
  144. package/dist/features/magic-context/sidekick/index.d.ts.map +1 -0
  145. package/dist/features/magic-context/storage-db.d.ts +48 -0
  146. package/dist/features/magic-context/storage-db.d.ts.map +1 -0
  147. package/dist/features/magic-context/storage-meta-persisted.d.ts +246 -0
  148. package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -0
  149. package/dist/features/magic-context/storage-meta-session.d.ts +6 -0
  150. package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -0
  151. package/dist/features/magic-context/storage-meta-shared.d.ts +31 -0
  152. package/dist/features/magic-context/storage-meta-shared.d.ts.map +1 -0
  153. package/dist/features/magic-context/storage-meta.d.ts +3 -0
  154. package/dist/features/magic-context/storage-meta.d.ts.map +1 -0
  155. package/dist/features/magic-context/storage-notes.d.ts +62 -0
  156. package/dist/features/magic-context/storage-notes.d.ts.map +1 -0
  157. package/dist/features/magic-context/storage-ops.d.ts +7 -0
  158. package/dist/features/magic-context/storage-ops.d.ts.map +1 -0
  159. package/dist/features/magic-context/storage-source.d.ts +5 -0
  160. package/dist/features/magic-context/storage-source.d.ts.map +1 -0
  161. package/dist/features/magic-context/storage-subagent-invocations.d.ts +52 -0
  162. package/dist/features/magic-context/storage-subagent-invocations.d.ts.map +1 -0
  163. package/dist/features/magic-context/storage-tags.d.ts +206 -0
  164. package/dist/features/magic-context/storage-tags.d.ts.map +1 -0
  165. package/dist/features/magic-context/storage.d.ts +11 -0
  166. package/dist/features/magic-context/storage.d.ts.map +1 -0
  167. package/dist/features/magic-context/subagent-token-capture.d.ts +33 -0
  168. package/dist/features/magic-context/subagent-token-capture.d.ts.map +1 -0
  169. package/dist/features/magic-context/tagger.d.ts +64 -0
  170. package/dist/features/magic-context/tagger.d.ts.map +1 -0
  171. package/dist/features/magic-context/tool-definition-tokens.d.ts +79 -0
  172. package/dist/features/magic-context/tool-definition-tokens.d.ts.map +1 -0
  173. package/dist/features/magic-context/tool-owner-backfill.d.ts +90 -0
  174. package/dist/features/magic-context/tool-owner-backfill.d.ts.map +1 -0
  175. package/dist/features/magic-context/types.d.ts +72 -0
  176. package/dist/features/magic-context/types.d.ts.map +1 -0
  177. package/dist/features/magic-context/user-memory/review-user-memories.d.ts +22 -0
  178. package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -0
  179. package/dist/features/magic-context/user-memory/storage-user-memory.d.ts +33 -0
  180. package/dist/features/magic-context/user-memory/storage-user-memory.d.ts.map +1 -0
  181. package/dist/features/magic-context/work-metrics.d.ts +13 -0
  182. package/dist/features/magic-context/work-metrics.d.ts.map +1 -0
  183. package/dist/hooks/auto-update-checker/cache.d.ts +23 -0
  184. package/dist/hooks/auto-update-checker/cache.d.ts.map +1 -0
  185. package/dist/hooks/auto-update-checker/checker.d.ts +13 -0
  186. package/dist/hooks/auto-update-checker/checker.d.ts.map +1 -0
  187. package/dist/hooks/auto-update-checker/constants.d.ts +10 -0
  188. package/dist/hooks/auto-update-checker/constants.d.ts.map +1 -0
  189. package/dist/hooks/auto-update-checker/index.d.ts +40 -0
  190. package/dist/hooks/auto-update-checker/index.d.ts.map +1 -0
  191. package/dist/hooks/auto-update-checker/types.d.ts +50 -0
  192. package/dist/hooks/auto-update-checker/types.d.ts.map +1 -0
  193. package/dist/hooks/is-anthropic-provider.d.ts +2 -0
  194. package/dist/hooks/is-anthropic-provider.d.ts.map +1 -0
  195. package/dist/hooks/magic-context/apply-context-nudge.d.ts +5 -0
  196. package/dist/hooks/magic-context/apply-context-nudge.d.ts.map +1 -0
  197. package/dist/hooks/magic-context/apply-operations.d.ts +7 -0
  198. package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -0
  199. package/dist/hooks/magic-context/auto-search-hint.d.ts +34 -0
  200. package/dist/hooks/magic-context/auto-search-hint.d.ts.map +1 -0
  201. package/dist/hooks/magic-context/auto-search-runner.d.ts +53 -0
  202. package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -0
  203. package/dist/hooks/magic-context/boundary-execution.d.ts +24 -0
  204. package/dist/hooks/magic-context/boundary-execution.d.ts.map +1 -0
  205. package/dist/hooks/magic-context/cache-busting-signals.d.ts +10 -0
  206. package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -0
  207. package/dist/hooks/magic-context/caveman-cleanup.d.ts +86 -0
  208. package/dist/hooks/magic-context/caveman-cleanup.d.ts.map +1 -0
  209. package/dist/hooks/magic-context/caveman.d.ts +35 -0
  210. package/dist/hooks/magic-context/caveman.d.ts.map +1 -0
  211. package/dist/hooks/magic-context/command-handler.d.ts +89 -0
  212. package/dist/hooks/magic-context/command-handler.d.ts.map +1 -0
  213. package/dist/hooks/magic-context/compaction-marker-manager.d.ts +106 -0
  214. package/dist/hooks/magic-context/compaction-marker-manager.d.ts.map +1 -0
  215. package/dist/hooks/magic-context/compartment-parser.d.ts +18 -0
  216. package/dist/hooks/magic-context/compartment-parser.d.ts.map +1 -0
  217. package/dist/hooks/magic-context/compartment-prompt.d.ts +19 -0
  218. package/dist/hooks/magic-context/compartment-prompt.d.ts.map +1 -0
  219. package/dist/hooks/magic-context/compartment-runner-compressor.d.ts +87 -0
  220. package/dist/hooks/magic-context/compartment-runner-compressor.d.ts.map +1 -0
  221. package/dist/hooks/magic-context/compartment-runner-drop-queue.d.ts +26 -0
  222. package/dist/hooks/magic-context/compartment-runner-drop-queue.d.ts.map +1 -0
  223. package/dist/hooks/magic-context/compartment-runner-historian.d.ts +42 -0
  224. package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -0
  225. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts +6 -0
  226. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -0
  227. package/dist/hooks/magic-context/compartment-runner-mapping.d.ts +33 -0
  228. package/dist/hooks/magic-context/compartment-runner-mapping.d.ts.map +1 -0
  229. package/dist/hooks/magic-context/compartment-runner-partial-recomp.d.ts +29 -0
  230. package/dist/hooks/magic-context/compartment-runner-partial-recomp.d.ts.map +1 -0
  231. package/dist/hooks/magic-context/compartment-runner-recomp.d.ts +3 -0
  232. package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -0
  233. package/dist/hooks/magic-context/compartment-runner-state-xml.d.ts +21 -0
  234. package/dist/hooks/magic-context/compartment-runner-state-xml.d.ts.map +1 -0
  235. package/dist/hooks/magic-context/compartment-runner-types.d.ts +102 -0
  236. package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -0
  237. package/dist/hooks/magic-context/compartment-runner-validation.d.ts +28 -0
  238. package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -0
  239. package/dist/hooks/magic-context/compartment-runner.d.ts +54 -0
  240. package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -0
  241. package/dist/hooks/magic-context/compartment-trigger.d.ts +17 -0
  242. package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -0
  243. package/dist/hooks/magic-context/derive-budgets.d.ts +57 -0
  244. package/dist/hooks/magic-context/derive-budgets.d.ts.map +1 -0
  245. package/dist/hooks/magic-context/drop-stale-reduce-calls.d.ts +4 -0
  246. package/dist/hooks/magic-context/drop-stale-reduce-calls.d.ts.map +1 -0
  247. package/dist/hooks/magic-context/event-handler.d.ts +49 -0
  248. package/dist/hooks/magic-context/event-handler.d.ts.map +1 -0
  249. package/dist/hooks/magic-context/event-payloads.d.ts +62 -0
  250. package/dist/hooks/magic-context/event-payloads.d.ts.map +1 -0
  251. package/dist/hooks/magic-context/event-resolvers.d.ts +72 -0
  252. package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -0
  253. package/dist/hooks/magic-context/execute-flush.d.ts +3 -0
  254. package/dist/hooks/magic-context/execute-flush.d.ts.map +1 -0
  255. package/dist/hooks/magic-context/execute-status.d.ts +12 -0
  256. package/dist/hooks/magic-context/execute-status.d.ts.map +1 -0
  257. package/dist/hooks/magic-context/format-bytes.d.ts +2 -0
  258. package/dist/hooks/magic-context/format-bytes.d.ts.map +1 -0
  259. package/dist/hooks/magic-context/heuristic-cleanup.d.ts +22 -0
  260. package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -0
  261. package/dist/hooks/magic-context/historian-state-file.d.ts +43 -0
  262. package/dist/hooks/magic-context/historian-state-file.d.ts.map +1 -0
  263. package/dist/hooks/magic-context/hook-handlers.d.ts +165 -0
  264. package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -0
  265. package/dist/hooks/magic-context/hook.d.ts +118 -0
  266. package/dist/hooks/magic-context/hook.d.ts.map +1 -0
  267. package/dist/hooks/magic-context/image-token-estimate.d.ts +6 -0
  268. package/dist/hooks/magic-context/image-token-estimate.d.ts.map +1 -0
  269. package/dist/hooks/magic-context/index.d.ts +3 -0
  270. package/dist/hooks/magic-context/index.d.ts.map +1 -0
  271. package/dist/hooks/magic-context/inject-compartments.d.ts +52 -0
  272. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -0
  273. package/dist/hooks/magic-context/key-files-block.d.ts +27 -0
  274. package/dist/hooks/magic-context/key-files-block.d.ts.map +1 -0
  275. package/dist/hooks/magic-context/live-session-state.d.ts +42 -0
  276. package/dist/hooks/magic-context/live-session-state.d.ts.map +1 -0
  277. package/dist/hooks/magic-context/note-nudger.d.ts +71 -0
  278. package/dist/hooks/magic-context/note-nudger.d.ts.map +1 -0
  279. package/dist/hooks/magic-context/note-visibility.d.ts +43 -0
  280. package/dist/hooks/magic-context/note-visibility.d.ts.map +1 -0
  281. package/dist/hooks/magic-context/nudge-bands.d.ts +6 -0
  282. package/dist/hooks/magic-context/nudge-bands.d.ts.map +1 -0
  283. package/dist/hooks/magic-context/nudge-injection.d.ts +7 -0
  284. package/dist/hooks/magic-context/nudge-injection.d.ts.map +1 -0
  285. package/dist/hooks/magic-context/nudge-placement-store.d.ts +15 -0
  286. package/dist/hooks/magic-context/nudge-placement-store.d.ts.map +1 -0
  287. package/dist/hooks/magic-context/nudger.d.ts +21 -0
  288. package/dist/hooks/magic-context/nudger.d.ts.map +1 -0
  289. package/dist/hooks/magic-context/read-session-chunk.d.ts +99 -0
  290. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -0
  291. package/dist/hooks/magic-context/read-session-db.d.ts +21 -0
  292. package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -0
  293. package/dist/hooks/magic-context/read-session-formatting.d.ts +35 -0
  294. package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -0
  295. package/dist/hooks/magic-context/read-session-raw.d.ts +10 -0
  296. package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -0
  297. package/dist/hooks/magic-context/send-session-notification.d.ts +13 -0
  298. package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -0
  299. package/dist/hooks/magic-context/sentinel.d.ts +102 -0
  300. package/dist/hooks/magic-context/sentinel.d.ts.map +1 -0
  301. package/dist/hooks/magic-context/strip-content.d.ts +140 -0
  302. package/dist/hooks/magic-context/strip-content.d.ts.map +1 -0
  303. package/dist/hooks/magic-context/strip-structural-noise.d.ts +17 -0
  304. package/dist/hooks/magic-context/strip-structural-noise.d.ts.map +1 -0
  305. package/dist/hooks/magic-context/system-injection-stripper.d.ts +2 -0
  306. package/dist/hooks/magic-context/system-injection-stripper.d.ts.map +1 -0
  307. package/dist/hooks/magic-context/system-prompt-hash.d.ts +85 -0
  308. package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -0
  309. package/dist/hooks/magic-context/tag-content-primitives.d.ts +6 -0
  310. package/dist/hooks/magic-context/tag-content-primitives.d.ts.map +1 -0
  311. package/dist/hooks/magic-context/tag-id-fallback.d.ts +9 -0
  312. package/dist/hooks/magic-context/tag-id-fallback.d.ts.map +1 -0
  313. package/dist/hooks/magic-context/tag-messages.d.ts +48 -0
  314. package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -0
  315. package/dist/hooks/magic-context/tag-part-guards.d.ts +23 -0
  316. package/dist/hooks/magic-context/tag-part-guards.d.ts.map +1 -0
  317. package/dist/hooks/magic-context/temporal-awareness.d.ts +73 -0
  318. package/dist/hooks/magic-context/temporal-awareness.d.ts.map +1 -0
  319. package/dist/hooks/magic-context/text-complete.d.ts +8 -0
  320. package/dist/hooks/magic-context/text-complete.d.ts.map +1 -0
  321. package/dist/hooks/magic-context/todo-view.d.ts +102 -0
  322. package/dist/hooks/magic-context/todo-view.d.ts.map +1 -0
  323. package/dist/hooks/magic-context/tokenizer-calibration.d.ts +85 -0
  324. package/dist/hooks/magic-context/tokenizer-calibration.d.ts.map +1 -0
  325. package/dist/hooks/magic-context/tool-drop-target.d.ts +48 -0
  326. package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -0
  327. package/dist/hooks/magic-context/transform-compartment-phase.d.ts +66 -0
  328. package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -0
  329. package/dist/hooks/magic-context/transform-context-state.d.ts +12 -0
  330. package/dist/hooks/magic-context/transform-context-state.d.ts.map +1 -0
  331. package/dist/hooks/magic-context/transform-message-helpers.d.ts +29 -0
  332. package/dist/hooks/magic-context/transform-message-helpers.d.ts.map +1 -0
  333. package/dist/hooks/magic-context/transform-operations.d.ts +5 -0
  334. package/dist/hooks/magic-context/transform-operations.d.ts.map +1 -0
  335. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +100 -0
  336. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -0
  337. package/dist/hooks/magic-context/transform-stage-logger.d.ts +2 -0
  338. package/dist/hooks/magic-context/transform-stage-logger.d.ts.map +1 -0
  339. package/dist/hooks/magic-context/transform.d.ts +145 -0
  340. package/dist/hooks/magic-context/transform.d.ts.map +1 -0
  341. package/dist/index.d.ts +4 -0
  342. package/dist/index.d.ts.map +1 -0
  343. package/dist/index.js +179800 -0
  344. package/dist/plugin/conflict-warning-hook.d.ts +34 -0
  345. package/dist/plugin/conflict-warning-hook.d.ts.map +1 -0
  346. package/dist/plugin/dream-timer.d.ts +44 -0
  347. package/dist/plugin/dream-timer.d.ts.map +1 -0
  348. package/dist/plugin/embedding-bootstrap-helpers.d.ts +35 -0
  349. package/dist/plugin/embedding-bootstrap-helpers.d.ts.map +1 -0
  350. package/dist/plugin/embedding-bootstrap.d.ts +3 -0
  351. package/dist/plugin/embedding-bootstrap.d.ts.map +1 -0
  352. package/dist/plugin/event.d.ts +13 -0
  353. package/dist/plugin/event.d.ts.map +1 -0
  354. package/dist/plugin/hooks/create-session-hooks.d.ts +44 -0
  355. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -0
  356. package/dist/plugin/messages-transform.d.ts +46 -0
  357. package/dist/plugin/messages-transform.d.ts.map +1 -0
  358. package/dist/plugin/normalize-tool-arg-schemas.d.ts +7 -0
  359. package/dist/plugin/normalize-tool-arg-schemas.d.ts.map +1 -0
  360. package/dist/plugin/rpc-handlers.d.ts +21 -0
  361. package/dist/plugin/rpc-handlers.d.ts.map +1 -0
  362. package/dist/plugin/sidebar-snapshot-cache.d.ts +19 -0
  363. package/dist/plugin/sidebar-snapshot-cache.d.ts.map +1 -0
  364. package/dist/plugin/tool-registry.d.ts +8 -0
  365. package/dist/plugin/tool-registry.d.ts.map +1 -0
  366. package/dist/plugin/types.d.ts +3 -0
  367. package/dist/plugin/types.d.ts.map +1 -0
  368. package/dist/shared/announcement.d.ts +55 -0
  369. package/dist/shared/announcement.d.ts.map +1 -0
  370. package/dist/shared/assistant-message-extractor.d.ts +2 -0
  371. package/dist/shared/assistant-message-extractor.d.ts.map +1 -0
  372. package/dist/shared/bounded-session-map.d.ts +45 -0
  373. package/dist/shared/bounded-session-map.d.ts.map +1 -0
  374. package/dist/shared/conflict-detector.d.ts +74 -0
  375. package/dist/shared/conflict-detector.d.ts.map +1 -0
  376. package/dist/shared/conflict-fixer.d.ts +3 -0
  377. package/dist/shared/conflict-fixer.d.ts.map +1 -0
  378. package/dist/shared/data-path.d.ts +121 -0
  379. package/dist/shared/data-path.d.ts.map +1 -0
  380. package/dist/shared/error-message.d.ts +32 -0
  381. package/dist/shared/error-message.d.ts.map +1 -0
  382. package/dist/shared/format-bytes.d.ts +2 -0
  383. package/dist/shared/format-bytes.d.ts.map +1 -0
  384. package/dist/shared/format-threshold.d.ts +24 -0
  385. package/dist/shared/format-threshold.d.ts.map +1 -0
  386. package/dist/shared/harness.d.ts +43 -0
  387. package/dist/shared/harness.d.ts.map +1 -0
  388. package/dist/shared/index.d.ts +6 -0
  389. package/dist/shared/index.d.ts.map +1 -0
  390. package/dist/shared/internal-initiator-marker.d.ts +2 -0
  391. package/dist/shared/internal-initiator-marker.d.ts.map +1 -0
  392. package/dist/shared/jsonc-parser.d.ts +8 -0
  393. package/dist/shared/jsonc-parser.d.ts.map +1 -0
  394. package/dist/shared/logger.d.ts +10 -0
  395. package/dist/shared/logger.d.ts.map +1 -0
  396. package/dist/shared/model-requirements.d.ts +26 -0
  397. package/dist/shared/model-requirements.d.ts.map +1 -0
  398. package/dist/shared/model-suggestion-retry.d.ts +68 -0
  399. package/dist/shared/model-suggestion-retry.d.ts.map +1 -0
  400. package/dist/shared/models-dev-cache.d.ts +65 -0
  401. package/dist/shared/models-dev-cache.d.ts.map +1 -0
  402. package/dist/shared/native-binding.d.ts +87 -0
  403. package/dist/shared/native-binding.d.ts.map +1 -0
  404. package/dist/shared/normalize-sdk-response.d.ts +5 -0
  405. package/dist/shared/normalize-sdk-response.d.ts.map +1 -0
  406. package/dist/shared/opencode-compaction-detector.d.ts +2 -0
  407. package/dist/shared/opencode-compaction-detector.d.ts.map +1 -0
  408. package/dist/shared/opencode-config-dir-types.d.ts +14 -0
  409. package/dist/shared/opencode-config-dir-types.d.ts.map +1 -0
  410. package/dist/shared/opencode-config-dir.d.ts +5 -0
  411. package/dist/shared/opencode-config-dir.d.ts.map +1 -0
  412. package/dist/shared/record-type-guard.d.ts +2 -0
  413. package/dist/shared/record-type-guard.d.ts.map +1 -0
  414. package/dist/shared/resolve-fallbacks.d.ts +32 -0
  415. package/dist/shared/resolve-fallbacks.d.ts.map +1 -0
  416. package/dist/shared/rpc-client.d.ts +17 -0
  417. package/dist/shared/rpc-client.d.ts.map +1 -0
  418. package/dist/shared/rpc-notifications.d.ts +24 -0
  419. package/dist/shared/rpc-notifications.d.ts.map +1 -0
  420. package/dist/shared/rpc-server.d.ts +20 -0
  421. package/dist/shared/rpc-server.d.ts.map +1 -0
  422. package/dist/shared/rpc-types.d.ts +105 -0
  423. package/dist/shared/rpc-types.d.ts.map +1 -0
  424. package/dist/shared/rpc-utils.d.ts +19 -0
  425. package/dist/shared/rpc-utils.d.ts.map +1 -0
  426. package/dist/shared/sqlite-helpers.d.ts +16 -0
  427. package/dist/shared/sqlite-helpers.d.ts.map +1 -0
  428. package/dist/shared/sqlite.d.ts +43 -0
  429. package/dist/shared/sqlite.d.ts.map +1 -0
  430. package/dist/shared/stable-json.d.ts +21 -0
  431. package/dist/shared/stable-json.d.ts.map +1 -0
  432. package/dist/shared/subagent-runner.d.ts +208 -0
  433. package/dist/shared/subagent-runner.d.ts.map +1 -0
  434. package/dist/shared/system-directive.d.ts +3 -0
  435. package/dist/shared/system-directive.d.ts.map +1 -0
  436. package/dist/shared/tag-transcript.d.ts +66 -0
  437. package/dist/shared/tag-transcript.d.ts.map +1 -0
  438. package/dist/shared/transcript-opencode.d.ts +71 -0
  439. package/dist/shared/transcript-opencode.d.ts.map +1 -0
  440. package/dist/shared/transcript.d.ts +212 -0
  441. package/dist/shared/transcript.d.ts.map +1 -0
  442. package/dist/shared/tui-config.d.ts +10 -0
  443. package/dist/shared/tui-config.d.ts.map +1 -0
  444. package/dist/tools/ctx-expand/constants.d.ts +3 -0
  445. package/dist/tools/ctx-expand/constants.d.ts.map +1 -0
  446. package/dist/tools/ctx-expand/index.d.ts +2 -0
  447. package/dist/tools/ctx-expand/index.d.ts.map +1 -0
  448. package/dist/tools/ctx-expand/tools.d.ts +3 -0
  449. package/dist/tools/ctx-expand/tools.d.ts.map +1 -0
  450. package/dist/tools/ctx-expand/types.d.ts +5 -0
  451. package/dist/tools/ctx-expand/types.d.ts.map +1 -0
  452. package/dist/tools/ctx-memory/constants.d.ts +4 -0
  453. package/dist/tools/ctx-memory/constants.d.ts.map +1 -0
  454. package/dist/tools/ctx-memory/index.d.ts +4 -0
  455. package/dist/tools/ctx-memory/index.d.ts.map +1 -0
  456. package/dist/tools/ctx-memory/tools.d.ts +4 -0
  457. package/dist/tools/ctx-memory/tools.d.ts.map +1 -0
  458. package/dist/tools/ctx-memory/types.d.ts +35 -0
  459. package/dist/tools/ctx-memory/types.d.ts.map +1 -0
  460. package/dist/tools/ctx-note/constants.d.ts +2 -0
  461. package/dist/tools/ctx-note/constants.d.ts.map +1 -0
  462. package/dist/tools/ctx-note/index.d.ts +4 -0
  463. package/dist/tools/ctx-note/index.d.ts.map +1 -0
  464. package/dist/tools/ctx-note/tools.d.ts +15 -0
  465. package/dist/tools/ctx-note/tools.d.ts.map +1 -0
  466. package/dist/tools/ctx-note/types.d.ts +9 -0
  467. package/dist/tools/ctx-note/types.d.ts.map +1 -0
  468. package/dist/tools/ctx-reduce/constants.d.ts +2 -0
  469. package/dist/tools/ctx-reduce/constants.d.ts.map +1 -0
  470. package/dist/tools/ctx-reduce/index.d.ts +4 -0
  471. package/dist/tools/ctx-reduce/index.d.ts.map +1 -0
  472. package/dist/tools/ctx-reduce/tools.d.ts +9 -0
  473. package/dist/tools/ctx-reduce/tools.d.ts.map +1 -0
  474. package/dist/tools/ctx-reduce/types.d.ts +4 -0
  475. package/dist/tools/ctx-reduce/types.d.ts.map +1 -0
  476. package/dist/tools/ctx-search/constants.d.ts +4 -0
  477. package/dist/tools/ctx-search/constants.d.ts.map +1 -0
  478. package/dist/tools/ctx-search/index.d.ts +4 -0
  479. package/dist/tools/ctx-search/index.d.ts.map +1 -0
  480. package/dist/tools/ctx-search/tools.d.ts +4 -0
  481. package/dist/tools/ctx-search/tools.d.ts.map +1 -0
  482. package/dist/tools/ctx-search/types.d.ts +34 -0
  483. package/dist/tools/ctx-search/types.d.ts.map +1 -0
  484. package/dist/tools/index.d.ts +6 -0
  485. package/dist/tools/index.d.ts.map +1 -0
  486. package/dist/tui/data/context-db.d.ts +36 -0
  487. package/dist/tui/data/context-db.d.ts.map +1 -0
  488. package/package.json +80 -0
  489. package/src/shared/announcement.test.ts +143 -0
  490. package/src/shared/announcement.ts +97 -0
  491. package/src/shared/assistant-message-extractor.ts +74 -0
  492. package/src/shared/bounded-session-map.test.ts +97 -0
  493. package/src/shared/bounded-session-map.ts +84 -0
  494. package/src/shared/conflict-detector.test.ts +232 -0
  495. package/src/shared/conflict-detector.ts +371 -0
  496. package/src/shared/conflict-fixer.test.ts +124 -0
  497. package/src/shared/conflict-fixer.ts +222 -0
  498. package/src/shared/data-path.test.ts +159 -0
  499. package/src/shared/data-path.ts +155 -0
  500. package/src/shared/error-message.test.ts +94 -0
  501. package/src/shared/error-message.ts +115 -0
  502. package/src/shared/format-bytes.ts +5 -0
  503. package/src/shared/format-threshold.ts +28 -0
  504. package/src/shared/harness.ts +61 -0
  505. package/src/shared/index.ts +5 -0
  506. package/src/shared/internal-initiator-marker.ts +1 -0
  507. package/src/shared/jsonc-parser.ts +138 -0
  508. package/src/shared/logger.ts +94 -0
  509. package/src/shared/model-requirements.ts +86 -0
  510. package/src/shared/model-suggestion-retry.test.ts +251 -0
  511. package/src/shared/model-suggestion-retry.ts +348 -0
  512. package/src/shared/models-dev-cache.test.ts +394 -0
  513. package/src/shared/models-dev-cache.ts +337 -0
  514. package/src/shared/native-binding.ts +311 -0
  515. package/src/shared/normalize-sdk-response.ts +40 -0
  516. package/src/shared/opencode-compaction-detector.test.ts +222 -0
  517. package/src/shared/opencode-compaction-detector.ts +81 -0
  518. package/src/shared/opencode-config-dir-types.ts +15 -0
  519. package/src/shared/opencode-config-dir.ts +38 -0
  520. package/src/shared/record-type-guard.ts +3 -0
  521. package/src/shared/resolve-fallbacks.test.ts +136 -0
  522. package/src/shared/resolve-fallbacks.ts +76 -0
  523. package/src/shared/rpc-client.test.ts +161 -0
  524. package/src/shared/rpc-client.ts +183 -0
  525. package/src/shared/rpc-notifications.test.ts +20 -0
  526. package/src/shared/rpc-notifications.ts +53 -0
  527. package/src/shared/rpc-server.ts +174 -0
  528. package/src/shared/rpc-types.ts +104 -0
  529. package/src/shared/rpc-utils.ts +72 -0
  530. package/src/shared/session-messages-bounded.test.ts +112 -0
  531. package/src/shared/sqlite-helpers.ts +27 -0
  532. package/src/shared/sqlite.ts +134 -0
  533. package/src/shared/stable-json.test.ts +87 -0
  534. package/src/shared/stable-json.ts +37 -0
  535. package/src/shared/subagent-runner.ts +222 -0
  536. package/src/shared/system-directive.ts +9 -0
  537. package/src/shared/tag-transcript.ts +553 -0
  538. package/src/shared/transcript-opencode.ts +259 -0
  539. package/src/shared/transcript.ts +226 -0
  540. package/src/shared/tui-config.ts +99 -0
  541. package/src/tui/data/context-db.ts +303 -0
  542. package/src/tui/index.tsx +692 -0
  543. package/src/tui/slots/sidebar-content.tsx +482 -0
  544. package/src/tui/types/opencode-plugin-tui.d.ts +232 -0
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Detect whether the agent currently has a visible `ctx_note(action="read")`
3
+ * tool call in their conversation context.
4
+ *
5
+ * Scope and timing
6
+ * ----------------
7
+ * Run this AFTER all message-array drops have been materialized in the
8
+ * transform pipeline (i.e. inside `runPostTransformPhase`, not inside
9
+ * `tagMessages`). By that point:
10
+ * - queued user `ctx_reduce` ops have been applied
11
+ * - heuristic cleanup (auto_drop_tool_age, clear_reasoning_age) ran
12
+ * - sentinel/replay logic neutralized previously-stripped parts
13
+ * So if a `ctx_note` read is still a real, non-sentinel part in the
14
+ * messages array we're about to send, the agent will actually see it.
15
+ *
16
+ * Why this matters
17
+ * ----------------
18
+ * Note nudges are normally suppressed when the agent already ran
19
+ * `ctx_note(read)` since the latest note activity (see `note-nudger.ts`).
20
+ * That suppression is correct ONLY while the read result is still in
21
+ * context. Once the read tool call is dropped (compartmentalized, aged
22
+ * out, or removed by `ctx_reduce`) the agent no longer has visibility
23
+ * into the notes — re-surfacing them at the next work-boundary trigger
24
+ * is the right thing to do.
25
+ *
26
+ * Implementation
27
+ * --------------
28
+ * Single backward pass over the messages array. Scans newest-first because
29
+ * the most recent reads are the ones most likely to still be visible; we
30
+ * can return as soon as one survives.
31
+ *
32
+ * `isSentinel` skips parts that have been neutralized to an empty-text
33
+ * placeholder by the strip/replay pipeline — those parts are present in
34
+ * the array (for cache-key stability) but invisible to the LLM.
35
+ */
36
+ import type { MessageLike } from "./tag-messages";
37
+ /**
38
+ * Returns true if the messages array contains at least one non-stripped
39
+ * `ctx_note(action="read")` tool call/result pair. Order doesn't matter for
40
+ * correctness — any visible read counts.
41
+ */
42
+ export declare function hasVisibleNoteReadCall(messages: MessageLike[]): boolean;
43
+ //# sourceMappingURL=note-visibility.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"note-visibility.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/note-visibility.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAKlD;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,OAAO,CAUvE"}
@@ -0,0 +1,6 @@
1
+ export type RollingNudgeBand = "far" | "near" | "urgent" | "critical";
2
+ export declare function getRollingNudgeBand(percentage: number, executeThresholdPercentage: number): RollingNudgeBand;
3
+ export declare function getRollingNudgeBandPriority(band: RollingNudgeBand | null): number;
4
+ export declare function formatRollingNudgeBand(band: RollingNudgeBand | null): string;
5
+ export declare function getRollingNudgeIntervalTokens(baseIntervalTokens: number, band: RollingNudgeBand): number;
6
+ //# sourceMappingURL=nudge-bands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nudge-bands.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/nudge-bands.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEtE,wBAAgB,mBAAmB,CAC/B,UAAU,EAAE,MAAM,EAClB,0BAA0B,EAAE,MAAM,GACnC,gBAAgB,CAWlB;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,GAAG,MAAM,CAajF;AAED,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,gBAAgB,GAAG,IAAI,GAAG,MAAM,CAE5E;AAED,wBAAgB,6BAA6B,CACzC,kBAAkB,EAAE,MAAM,EAC1B,IAAI,EAAE,gBAAgB,GACvB,MAAM,CAWR"}
@@ -0,0 +1,7 @@
1
+ import type { NudgePlacementStore } from "./nudge-placement-store";
2
+ import type { MessageLike } from "./tag-messages";
3
+ export declare function reinjectNudgeAtAnchor(messages: MessageLike[], nudgeText: string, nudgePlacements: NudgePlacementStore, sessionId: string): boolean;
4
+ export declare function appendNudgeToAssistant(messages: MessageLike[], nudge: string, nudgePlacements: NudgePlacementStore, sessionId: string): void;
5
+ export declare function appendSupplementalNudgeToAssistant(messages: MessageLike[], nudge: string, nudgePlacements: NudgePlacementStore, sessionId: string): boolean;
6
+ export declare function canAppendSupplementalNudgeToAssistant(messages: MessageLike[], nudgePlacements: NudgePlacementStore, sessionId: string): boolean;
7
+ //# sourceMappingURL=nudge-injection.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nudge-injection.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/nudge-injection.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AA6ElD,wBAAgB,qBAAqB,CACjC,QAAQ,EAAE,WAAW,EAAE,EACvB,SAAS,EAAE,MAAM,EACjB,eAAe,EAAE,mBAAmB,EACpC,SAAS,EAAE,MAAM,GAClB,OAAO,CA+CT;AAED,wBAAgB,sBAAsB,CAClC,QAAQ,EAAE,WAAW,EAAE,EACvB,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,mBAAmB,EACpC,SAAS,EAAE,MAAM,GAClB,IAAI,CAmDN;AAED,wBAAgB,kCAAkC,CAC9C,QAAQ,EAAE,WAAW,EAAE,EACvB,KAAK,EAAE,MAAM,EACb,eAAe,EAAE,mBAAmB,EACpC,SAAS,EAAE,MAAM,GAClB,OAAO,CA4BT;AAED,wBAAgB,qCAAqC,CACjD,QAAQ,EAAE,WAAW,EAAE,EACvB,eAAe,EAAE,mBAAmB,EACpC,SAAS,EAAE,MAAM,GAClB,OAAO,CAMT"}
@@ -0,0 +1,15 @@
1
+ import type { Database } from "../../shared/sqlite";
2
+ interface NudgePlacement {
3
+ messageId: string;
4
+ nudgeText: string;
5
+ }
6
+ export interface NudgePlacementStore {
7
+ set(sessionId: string, messageId: string, nudgeText: string): void;
8
+ get(sessionId: string): NudgePlacement | null;
9
+ clear(sessionId: string, options?: {
10
+ persist?: boolean;
11
+ }): void;
12
+ }
13
+ export declare function createNudgePlacementStore(db?: Database): NudgePlacementStore;
14
+ export {};
15
+ //# sourceMappingURL=nudge-placement-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nudge-placement-store.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/nudge-placement-store.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,UAAU,cAAc;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAChC,GAAG,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACnE,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAAC;IAC9C,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,IAAI,CAAC;CACnE;AAED,wBAAgB,yBAAyB,CAAC,EAAE,CAAC,EAAE,QAAQ,GAAG,mBAAmB,CAgC5E"}
@@ -0,0 +1,21 @@
1
+ import { getOrCreateSessionMeta, type getTopNBySize } from "../../features/magic-context/storage";
2
+ import type { ContextUsage, SessionMeta, TagEntry } from "../../features/magic-context/types";
3
+ type ContextDatabase = Parameters<typeof getOrCreateSessionMeta>[0];
4
+ export type ContextNudge = {
5
+ type: "assistant";
6
+ text: string;
7
+ };
8
+ export declare const RECENT_CTX_REDUCE_WINDOW_MS: number;
9
+ export declare function createNudger(config: {
10
+ protected_tags: number;
11
+ nudge_interval_tokens: number;
12
+ iteration_nudge_threshold: number;
13
+ execute_threshold_percentage: number | {
14
+ default: number;
15
+ [modelKey: string]: number;
16
+ };
17
+ now?: () => number;
18
+ recentReduceBySession?: Map<string, number>;
19
+ }): (sessionId: string, contextUsage: ContextUsage, db: ContextDatabase, topNFn: typeof getTopNBySize, preloadedTags?: TagEntry[], messagesSinceLastUser?: number, preloadedSessionMeta?: SessionMeta) => ContextNudge | null;
20
+ export {};
21
+ //# sourceMappingURL=nudger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nudger.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/nudger.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,sBAAsB,EAEtB,KAAK,aAAa,EAErB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AAY9F,KAAK,eAAe,GAAG,UAAU,CAAC,OAAO,sBAAsB,CAAC,CAAC,CAAC,CAAC,CAAC;AACpE,MAAM,MAAM,YAAY,GAAG;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAC/D,eAAO,MAAM,2BAA2B,QAAgB,CAAC;AA+BzD,wBAAgB,YAAY,CAAC,MAAM,EAAE;IACjC,cAAc,EAAE,MAAM,CAAC;IACvB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,yBAAyB,EAAE,MAAM,CAAC;IAClC,4BAA4B,EAAE,MAAM,GAAG;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IACvF,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,qBAAqB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC/C,IAIO,WAAW,MAAM,EACjB,cAAc,YAAY,EAC1B,IAAI,eAAe,EACnB,QAAQ,OAAO,aAAa,EAC5B,gBAAgB,QAAQ,EAAE,EAC1B,wBAAwB,MAAM,EAC9B,uBAAuB,WAAW,KACnC,YAAY,GAAG,IAAI,CA2IzB"}
@@ -0,0 +1,99 @@
1
+ import { type SessionChunkLine } from "./read-session-formatting";
2
+ import { type RawMessage } from "./read-session-raw";
3
+ export { extractTexts, hasMeaningfulUserText } from "./read-session-formatting";
4
+ /**
5
+ * Per-session source override for raw message reading.
6
+ *
7
+ * The default implementation of `readRawSessionMessages(sessionId)` reads
8
+ * from OpenCode's session DB via `withReadOnlySessionDb`. Other harnesses
9
+ * (e.g. Pi) provide their session data through a different surface
10
+ * (`pi.sessionManager.getBranch()`), so they register a per-session
11
+ * provider here BEFORE invoking any code path that calls the shared
12
+ * `readRawSessionMessages` / `getRawSessionMessageCount` /
13
+ * `getProtectedTailStartOrdinal` / `readSessionChunk` helpers.
14
+ *
15
+ * The registry is lookup-by-sessionId: a registered provider takes
16
+ * precedence over the OpenCode-DB default. Sessions never registered
17
+ * here continue to read from OpenCode's DB (existing behavior).
18
+ *
19
+ * Lifecycle: providers should be registered for the duration of one
20
+ * historian/trigger evaluation and unregistered afterward to avoid
21
+ * leaking session state across unrelated plugin instances. The
22
+ * `withSessionMessageProvider` helper enforces this by wrapping a
23
+ * scope.
24
+ */
25
+ export interface RawMessageProvider {
26
+ readMessages(): RawMessage[];
27
+ readMessageById?: (messageId: string) => RawMessage | null;
28
+ /** Optional fast count path; falls back to readMessages().length. */
29
+ getMessageCount?: () => number;
30
+ }
31
+ /**
32
+ * Register a per-session source for raw message reading. Returns an
33
+ * unregister function. Pass-through harnesses (OpenCode) never call
34
+ * this; only Pi/future harnesses install themselves before triggering
35
+ * historian.
36
+ */
37
+ export declare function setRawMessageProvider(sessionId: string, provider: RawMessageProvider): () => void;
38
+ /**
39
+ * Run `fn` with a temporary per-session provider override. Cleans up
40
+ * on return regardless of throw — preferred over manual
41
+ * `setRawMessageProvider` / `cleanup()` pairs.
42
+ */
43
+ export declare function withRawMessageProvider<T>(sessionId: string, provider: RawMessageProvider, fn: () => T): T;
44
+ /** Strip system-reminder blocks and OMO markers from user text for chunk compaction. */
45
+ export declare function cleanUserText(text: string): string;
46
+ export interface SessionChunk {
47
+ startIndex: number;
48
+ endIndex: number;
49
+ startMessageId: string;
50
+ endMessageId: string;
51
+ messageCount: number;
52
+ tokenEstimate: number;
53
+ hasMore: boolean;
54
+ text: string;
55
+ lines: SessionChunkLine[];
56
+ /** Number of distinct commit clusters — assistant blocks with commits separated by meaningful user turns */
57
+ commitClusterCount: number;
58
+ /**
59
+ * Contiguous ranges of raw message ordinals whose visible chunk content was
60
+ * tool-only (TC: lines, no narrative text). Historian frequently skips such
61
+ * ranges entirely — that's safe, so validation absorbs gaps that fall fully
62
+ * within these ranges regardless of size. Gaps outside these ranges still
63
+ * fail validation and trigger a repair retry.
64
+ */
65
+ toolOnlyRanges: Array<{
66
+ start: number;
67
+ end: number;
68
+ }>;
69
+ }
70
+ export declare function withRawSessionMessageCache<T>(fn: () => T): T;
71
+ export declare function readRawSessionMessages(sessionId: string): RawMessage[];
72
+ export declare function readRawSessionMessageById(sessionId: string, messageId: string): RawMessage | null;
73
+ export declare function getRawSessionMessageCount(sessionId: string): number;
74
+ /**
75
+ * Set of raw-session keys observed in the visible window. Pre-v3.3.1
76
+ * this collapsed everything (text, file, tool) into one bare-string Set.
77
+ * That was the bug Finding D in the plan: tool tags share `messageId =
78
+ * callId`, so a callId reused outside the compartment would match a
79
+ * tag inside the compartment by string equality alone, queuing drops
80
+ * for tags that should have stayed live.
81
+ *
82
+ * Layer C splits the shape into:
83
+ * - `messageFileKeys`: bare contentIds (`<msgId>:p<n>` / `<msgId>:fileN`).
84
+ * These are globally unique within a session, so bare-string match
85
+ * is correct.
86
+ * - `toolObservations`: per-callId set of `ownerMsgId` values derived
87
+ * by FIFO pairing, mirroring `tag-messages.ts`. A tool tag is "in
88
+ * the visible window" iff its callId AND `tool_owner_message_id`
89
+ * both appear here.
90
+ */
91
+ export interface RawSessionTagKeys {
92
+ messageFileKeys: Set<string>;
93
+ toolObservations: Map<string, Set<string>>;
94
+ }
95
+ export declare function getRawSessionTagKeysThrough(sessionId: string, upToMessageIndex: number): RawSessionTagKeys;
96
+ export declare function getProtectedTailStartOrdinal(sessionId: string): number;
97
+ export declare function readSessionChunk(sessionId: string, tokenBudget: number, offset?: number, eligibleEndOrdinal?: number): SessionChunk;
98
+ export declare function getRawSessionMessageIdsThrough(sessionId: string, endOrdinal: number): string[];
99
+ //# sourceMappingURL=read-session-chunk.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-session-chunk.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/read-session-chunk.ts"],"names":[],"mappings":"AAGA,OAAO,EAWH,KAAK,gBAAgB,EACxB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACH,KAAK,UAAU,EAGlB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AAIhF;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,kBAAkB;IAC/B,YAAY,IAAI,UAAU,EAAE,CAAC;IAC7B,eAAe,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,UAAU,GAAG,IAAI,CAAC;IAC3D,qEAAqE;IACrE,eAAe,CAAC,EAAE,MAAM,MAAM,CAAC;CAClC;AAID;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,kBAAkB,GAAG,MAAM,IAAI,CAMjG;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,EACpC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,kBAAkB,EAC5B,EAAE,EAAE,MAAM,CAAC,GACZ,CAAC,CAOH;AAED,wFAAwF;AACxF,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,MAAM,WAAW,YAAY;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,YAAY,EAAE,MAAM,CAAC;IACrB,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,gBAAgB,EAAE,CAAC;IAC1B,4GAA4G;IAC5G,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;;;;OAMG;IACH,cAAc,EAAE,KAAK,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACzD;AAED,wBAAgB,0BAA0B,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAa5D;AAED,wBAAgB,sBAAsB,CAAC,SAAS,EAAE,MAAM,GAAG,UAAU,EAAE,CAatE;AAED,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CASjG;AAQD,wBAAgB,yBAAyB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAOnE;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,iBAAiB;IAC9B,eAAe,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7B,gBAAgB,EAAE,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;CAC9C;AAED,wBAAgB,2BAA2B,CACvC,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,MAAM,GACzB,iBAAiB,CA2DnB;AAID,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAWtE;AAED,wBAAgB,gBAAgB,CAC5B,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,EACnB,MAAM,GAAE,MAAU,EAClB,kBAAkB,CAAC,EAAE,MAAM,GAC5B,YAAY,CA+Ld;AAED,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,EAAE,CAK9F"}
@@ -0,0 +1,21 @@
1
+ import { Database } from "../../shared/sqlite";
2
+ export declare function withReadOnlySessionDb<T>(fn: (db: Database) => T): T;
3
+ export declare function closeReadOnlySessionDb(): void;
4
+ export declare function getRawSessionMessageCountFromDb(db: Database, sessionId: string): number;
5
+ export declare function isMidTurn(_deps: unknown, sessionId: string): boolean;
6
+ export declare function isMidTurnFromOpenCodeDb(db: Database, sessionId: string): boolean;
7
+ /**
8
+ * Resolve `time_created` (ms since epoch) for a set of OpenCode message IDs.
9
+ * Returns a Map keyed by message ID. Missing IDs are simply omitted.
10
+ *
11
+ * Used by temporal-awareness to map compartment start/end message IDs to
12
+ * wall-clock dates for the `start="YYYY-MM-DD"` / `end="YYYY-MM-DD"` attrs
13
+ * on the `<compartment>` elements in `<session-history>`.
14
+ */
15
+ export declare function getMessageTimesFromOpenCodeDb(sessionId: string, messageIds: readonly string[]): Map<string, number>;
16
+ export declare function findLastAssistantModelFromOpenCodeDb(sessionId: string): {
17
+ providerID: string;
18
+ modelID: string;
19
+ agent?: string;
20
+ } | null;
21
+ //# sourceMappingURL=read-session-db.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-session-db.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/read-session-db.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAgD/C,wBAAgB,qBAAqB,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,QAAQ,KAAK,CAAC,GAAG,CAAC,CAEnE;AAGD,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C;AAED,wBAAgB,+BAA+B,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAYvF;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CAOpE;AAED,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,OAAO,CA6BhF;AAoBD;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CACzC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,SAAS,MAAM,EAAE,GAC9B,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAyBrB;AAED,wBAAgB,oCAAoC,CAChD,SAAS,EAAE,MAAM,GAClB;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAgChE"}
@@ -0,0 +1,35 @@
1
+ export interface SessionChunkLine {
2
+ ordinal: number;
3
+ messageId: string;
4
+ }
5
+ export interface ChunkBlock {
6
+ role: string;
7
+ startOrdinal: number;
8
+ endOrdinal: number;
9
+ parts: string[];
10
+ meta: SessionChunkLine[];
11
+ commitHashes: string[];
12
+ /**
13
+ * True when every part in this block came from tool-call summaries only
14
+ * (no textual narrative from the user or assistant). Historian often skips
15
+ * such blocks — that's safe as long as we know the skipped range is
16
+ * tool-only, so we mark the block here and let validation absorb the gap.
17
+ */
18
+ isToolOnly: boolean;
19
+ }
20
+ export declare function hasMeaningfulUserText(parts: unknown[]): boolean;
21
+ export declare function extractTexts(parts: unknown[]): string[];
22
+ /** Extract compact tool-call summaries from message parts.
23
+ * Returns lines like "TC: Fix lint errors" or "TC: read(src/index.ts)". */
24
+ export declare function extractToolCallSummaries(parts: unknown[]): string[];
25
+ export declare function estimateTokens(text: string): number;
26
+ export declare function normalizeText(text: string): string;
27
+ export declare function compactRole(role: string): string;
28
+ export declare function formatBlock(block: ChunkBlock): string;
29
+ export declare function extractCommitHashes(text: string): string[];
30
+ export declare function compactTextForSummary(text: string, role: string): {
31
+ text: string;
32
+ commitHashes: string[];
33
+ };
34
+ export declare function mergeCommitHashes(existing: string[], next: string[]): string[];
35
+ //# sourceMappingURL=read-session-formatting.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-session-formatting.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/read-session-formatting.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,IAAI,EAAE,gBAAgB,EAAE,CAAC;IACzB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB;;;;;OAKG;IACH,UAAU,EAAE,OAAO,CAAC;CACvB;AAMD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,OAAO,CAiB/D;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,CAUvD;AAED;4EAC4E;AAC5E,wBAAgB,wBAAwB,CAAC,KAAK,EAAE,OAAO,EAAE,GAAG,MAAM,EAAE,CA2BnE;AAoCD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAGnD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIhD;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAQrD;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAW1D;AAED,wBAAgB,qBAAqB,CACjC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,GACb;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,EAAE,CAAA;CAAE,CAmB1C;AAED,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAS9E"}
@@ -0,0 +1,10 @@
1
+ import type { Database } from "../../shared/sqlite";
2
+ export interface RawMessage {
3
+ ordinal: number;
4
+ id: string;
5
+ role: string;
6
+ parts: unknown[];
7
+ }
8
+ export declare function readRawSessionMessagesFromDb(db: Database, sessionId: string): RawMessage[];
9
+ export declare function readRawSessionMessageByIdFromDb(db: Database, sessionId: string, messageId: string): RawMessage | null;
10
+ //# sourceMappingURL=read-session-raw.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-session-raw.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/read-session-raw.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,WAAW,UAAU;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,OAAO,EAAE,CAAC;CACpB;AAiDD,wBAAgB,4BAA4B,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,UAAU,EAAE,CAyC1F;AAED,wBAAgB,+BAA+B,CAC3C,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAClB,UAAU,GAAG,IAAI,CAyCnB"}
@@ -0,0 +1,13 @@
1
+ export interface NotificationParams {
2
+ agent?: string;
3
+ variant?: string;
4
+ providerId?: string;
5
+ modelId?: string;
6
+ }
7
+ export declare function sendIgnoredMessage(client: unknown, sessionId: string, text: string, params: NotificationParams): Promise<void>;
8
+ /**
9
+ * Send a real user prompt that will be processed by the model (not ignored).
10
+ * Used by /ctx-aug to inject the augmented prompt after sidekick completes.
11
+ */
12
+ export declare function sendUserPrompt(client: unknown, sessionId: string, text: string): Promise<void>;
13
+ //# sourceMappingURL=send-session-notification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send-session-notification.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/send-session-notification.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,kBAAkB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAoDD,wBAAsB,kBAAkB,CACpC,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,kBAAkB,GAC3B,OAAO,CAAC,IAAI,CAAC,CAwEf;AAED;;;GAGG;AACH,wBAAsB,cAAc,CAChC,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,GACb,OAAO,CAAC,IAAI,CAAC,CA0Bf"}
@@ -0,0 +1,102 @@
1
+ /**
2
+ * Whole-message sentinel placeholder for providers that DO NOT filter
3
+ * empty assistant content out of their wire payload.
4
+ *
5
+ * Background: when `stripDroppedPlaceholderMessages` /
6
+ * `stripSystemInjectedMessages` / `replaySentinelByMessageIds` reduce a
7
+ * whole assistant message to one sentinel part, the resulting AI-SDK
8
+ * `ModelMessage` becomes `{ role: "assistant", content: "" }`. Anthropic
9
+ * and Bedrock filter such empty messages out via their `normalizeMessages`
10
+ * step (see OpenCode's `provider/transform.ts:55-73`), so the wire never
11
+ * sees them. Most other providers (openai-compatible, openrouter, google,
12
+ * ...) do not, and the empty-content message reaches the wire — and is
13
+ * rejected by stricter backends (e.g. Moonshot/Kimi: "must not be empty").
14
+ *
15
+ * Using a non-empty placeholder text whose value won't be filtered keeps
16
+ * the wire valid while still telling the model honestly that something
17
+ * was dropped. For Anthropic/Bedrock we still emit `""` so their existing
18
+ * filter continues removing the message — no wire-shape change for them.
19
+ */
20
+ export declare const WHOLE_MESSAGE_PLACEHOLDER_TEXT = "[dropped]";
21
+ /**
22
+ * Create an empty-text sentinel to replace a stripped message PART (not a
23
+ * whole message) while preserving the array's length and index positions
24
+ * across passes.
25
+ *
26
+ * For per-part sentinelization, empty text is always safe — the message
27
+ * still has other content (text/tool/reasoning) so it never reaches the
28
+ * wire as an empty assistant message.
29
+ *
30
+ * Why sentinels exist: some providers (Antigravity/Gemini-routed-Claude,
31
+ * some OpenRouter configs) hash the full serialized messages[] array as
32
+ * their prompt-cache key. Any array-length change between turns busts the
33
+ * cache. Replacing removed parts with inert `{type:"text", text:""}`
34
+ * placeholders keeps the array shape stable so subsequent turns can hit
35
+ * cache on the unchanged prefix.
36
+ *
37
+ * For Anthropic/Bedrock/Google-SDK providers, `provider/transform.ts:55-73`
38
+ * (or the SDK itself) filters out parts where `text === ""`, so the
39
+ * sentinel never reaches the wire. Wire behavior stays identical to the
40
+ * previous `.filter()`/`.splice()` behavior.
41
+ *
42
+ * `cache_control` inheritance: if the original part carried provider-side
43
+ * cache-breakpoint metadata (`cache_control` / `cacheControl`), the
44
+ * sentinel inherits it. OpenCode currently only sets cache markers on the
45
+ * last two system+non-system messages (never on mid-history parts we
46
+ * strip), so this is defensive, but cheap.
47
+ */
48
+ export declare function makeSentinel(originalPart: unknown): {
49
+ type: "text";
50
+ text: string;
51
+ } & Record<string, unknown>;
52
+ /**
53
+ * Create a sentinel for replacing a WHOLE assistant message's parts list.
54
+ *
55
+ * Picks `""` when the live provider is the canonical Anthropic provider
56
+ * (whose AI-SDK normalization filters empty content from the wire),
57
+ * `[dropped]` otherwise. See `modelAcceptsEmptyContent` for the rule.
58
+ *
59
+ * The chosen placeholder text is kept in `WHOLE_MESSAGE_PLACEHOLDER_TEXT`
60
+ * so `isSentinel` recognizes both shapes (idempotency on replay).
61
+ */
62
+ export declare function makeWholeMessageSentinel(providerID?: string): {
63
+ type: "text";
64
+ text: string;
65
+ } & Record<string, unknown>;
66
+ /**
67
+ * Detect whether a part is already a sentinel produced by `makeSentinel`
68
+ * or `makeWholeMessageSentinel`. Used by strip functions to stay
69
+ * idempotent — don't re-count or re-mutate a sentinel we already
70
+ * installed.
71
+ *
72
+ * Recognizes both empty (`""`) and whole-message-placeholder
73
+ * (`[dropped]`) sentinel text values.
74
+ */
75
+ export declare function isSentinel(part: unknown): boolean;
76
+ /**
77
+ * Replay a previously-persisted set of message IDs by replacing each
78
+ * matching message's parts with a single whole-message sentinel. Used to
79
+ * keep the wire shape stable across defer passes when OpenCode rebuilds
80
+ * messages from its DB — any message whose ID is in `ids` was
81
+ * neutralized on a prior bust pass and should be neutralized again now.
82
+ *
83
+ * `providerID` controls which sentinel shape is installed (see
84
+ * `makeWholeMessageSentinel`). Pass the live session's provider so the
85
+ * replayed wire shape matches the fresh sentinelization on the current
86
+ * pass — providers that don't filter empties get `[dropped]`, Anthropic
87
+ * gets `""`.
88
+ *
89
+ * Returns the number of messages replayed + the set of IDs that were NOT
90
+ * found in the current message array (caller can prune them from the
91
+ * persisted set so we stop carrying stale IDs forever).
92
+ */
93
+ export declare function replaySentinelByMessageIds(messages: Array<{
94
+ info: {
95
+ id?: string;
96
+ };
97
+ parts: unknown[];
98
+ }>, ids: Set<string>, providerID?: string): {
99
+ replayed: number;
100
+ missingIds: string[];
101
+ };
102
+ //# sourceMappingURL=sentinel.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sentinel.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/sentinel.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,8BAA8B,cAAc,CAAC;AAyB1D;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,YAAY,CAAC,YAAY,EAAE,OAAO,GAAG;IACjD,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAc1B;AAED;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACpC,UAAU,CAAC,EAAE,MAAM,GACpB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAK1D;AAED;;;;;;;;GAQG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,OAAO,GAAG,OAAO,CAKjD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,0BAA0B,CACtC,QAAQ,EAAE,KAAK,CAAC;IAAE,IAAI,EAAE;QAAE,EAAE,CAAC,EAAE,MAAM,CAAA;KAAE,CAAC;IAAC,KAAK,EAAE,OAAO,EAAE,CAAA;CAAE,CAAC,EAC5D,GAAG,EAAE,GAAG,CAAC,MAAM,CAAC,EAChB,UAAU,CAAC,EAAE,MAAM,GACpB;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,EAAE,CAAA;CAAE,CAiB5C"}
@@ -0,0 +1,140 @@
1
+ import type { MessageLike, ThinkingLikePart } from "./tag-messages";
2
+ /**
3
+ * Neutralize system-injected messages (notifications, reminders, internal markers).
4
+ * These are internal plumbing messages that should never reach the LLM.
5
+ * Only neutralizes messages BEFORE `protectedTailStart` — recent messages in the
6
+ * protected tail may contain actionable info (e.g., background task completion
7
+ * notifications with task IDs the agent needs for background_output).
8
+ *
9
+ * Returns both the count of neutralized messages and the set of their IDs so
10
+ * callers can persist-and-replay the decision across defer passes (cache-safe
11
+ * — OpenCode rebuilds messages from its DB every turn, so the sentinel needs
12
+ * to be re-applied each transform).
13
+ *
14
+ * Cache safety: replaces each matched message's parts with a single empty-text
15
+ * sentinel instead of splicing the message out of the array. Preserves array
16
+ * length so proxy providers that hash message-array structure see a stable
17
+ * prefix. For Anthropic/Bedrock, the provider's upstream filter drops
18
+ * empty-content messages on the wire anyway — same effective behavior, no
19
+ * mid-pipeline array mutation.
20
+ */
21
+ export declare function stripSystemInjectedMessages(messages: MessageLike[], protectedTailStart: number, providerID?: string): {
22
+ stripped: number;
23
+ sentineledIds: string[];
24
+ };
25
+ /**
26
+ * Neutralize messages that consist entirely of [dropped §N§] placeholders.
27
+ * These are leftover shells after ctx_reduce drops their content — keeping
28
+ * their original text wastes tokens without providing any value since there
29
+ * is no recall mechanism.
30
+ *
31
+ * User-role messages are NEVER neutralized, even if their only text is a
32
+ * dropped placeholder. Removing (or emptying) a user message between two
33
+ * assistants collapses the turn boundary, which causes the AI SDK's Anthropic
34
+ * adapter to merge consecutive assistants into a single "latest assistant"
35
+ * block containing signed thinking. The merged block's signature no longer
36
+ * matches the original, triggering:
37
+ * "thinking or redacted_thinking blocks in the latest assistant message
38
+ * cannot be modified"
39
+ *
40
+ * For user messages whose content the agent wanted to drop, apply-operations
41
+ * emits a `[truncated §N§]` preview instead of a full `[dropped §N§]`, which
42
+ * keeps the shell visible and preserves the turn boundary.
43
+ *
44
+ * Cache safety: replaces matched messages' parts with a single empty-text
45
+ * sentinel instead of splicing the messages out of the array. Preserves array
46
+ * length so proxy providers that hash message-array structure see a stable
47
+ * prefix. For Anthropic/Bedrock, OpenCode's upstream filter drops empty
48
+ * content messages on the wire — same effective behavior, no mid-pipeline
49
+ * array mutation.
50
+ *
51
+ * Returns both count and sentineled IDs so callers can persist-and-replay.
52
+ */
53
+ export declare function stripDroppedPlaceholderMessages(messages: MessageLike[], providerID?: string): {
54
+ stripped: number;
55
+ sentineledIds: string[];
56
+ };
57
+ /**
58
+ * Replay persisted reasoning clearing on every pass (including defer).
59
+ * Clears reasoning for all messages with tag <= persistedWatermark.
60
+ * This ensures clearing is sticky across passes even when OpenCode
61
+ * rebuilds messages fresh from its own DB.
62
+ */
63
+ export declare function replayClearedReasoning(messages: MessageLike[], reasoningByMessage: Map<MessageLike, ThinkingLikePart[]>, messageTagNumbers: Map<MessageLike, number>, persistedWatermark: number): number;
64
+ /**
65
+ * Replay persisted inline thinking stripping on every pass (including defer).
66
+ * Strips inline <thinking> tags for all messages with tag <= persistedWatermark.
67
+ */
68
+ export declare function replayStrippedInlineThinking(messages: MessageLike[], messageTagNumbers: Map<MessageLike, number>, persistedWatermark: number): number;
69
+ export declare function clearOldReasoning(messages: MessageLike[], reasoningByMessage: Map<MessageLike, ThinkingLikePart[]>, messageTagNumbers: Map<MessageLike, number>, clearReasoningAge: number): number;
70
+ /**
71
+ * Neutralize cleared reasoning parts (those with thinking or text set to
72
+ * "[cleared]" by clearOldReasoning). Replaces them in place with empty-text
73
+ * sentinels so message.parts length stays constant between passes.
74
+ *
75
+ * See strip-structural-noise.ts for the cache-safety rationale. For
76
+ * Anthropic/Bedrock, OpenCode's provider/transform.ts:65 drops empty text
77
+ * parts before the wire, so the sentinel never reaches the provider — same
78
+ * effective wire shape as the previous filter-based behavior but no
79
+ * mid-pipeline array mutation.
80
+ *
81
+ * Providers with `capabilities.interleaved.field` (e.g. Moonshot/Kimi
82
+ * `reasoning_content`) used to need a special gate to keep typed reasoning
83
+ * intact. OpenCode PR #24146 (preserve empty reasoning_content for DeepSeek
84
+ * V4 thinking mode) made the provider/transform layer always emit the
85
+ * interleaved field — empty when no reasoning parts remain — so the gate
86
+ * is no longer needed here.
87
+ */
88
+ export declare function stripClearedReasoning(messages: MessageLike[]): number;
89
+ export declare function stripInlineThinking(messages: MessageLike[], messageTagNumbers: Map<MessageLike, number>, clearReasoningAge: number): number;
90
+ export declare function truncateErroredTools(messages: MessageLike[], watermark: number, messageTagNumbers: Map<MessageLike, number>): number;
91
+ /**
92
+ * Work around @ai-sdk/anthropic's groupIntoBlocks behavior plus opus-4.7's
93
+ * strict thinking-block position validation.
94
+ *
95
+ * Two structural sources of invalid payloads exist, both triggering:
96
+ * "thinking or redacted_thinking blocks in the latest assistant message
97
+ * cannot be modified. These blocks must remain as they were in the
98
+ * original response."
99
+ *
100
+ * (1) ACROSS assistants: @ai-sdk/anthropic's groupIntoBlocks merges
101
+ * consecutive OpenCode assistant messages into one Anthropic assistant
102
+ * block. Each source assistant's signed reasoning gets emitted as its
103
+ * own thinking block — the merged block ends up with thinking
104
+ * INTERLEAVED between text/tool_use.
105
+ *
106
+ * (2) WITHIN ONE assistant: opus-4.7 with interleaved thinking produces
107
+ * multiple reasoning parts in a single OpenCode assistant message
108
+ * (observed: up to 12 reasoning parts per message). AI SDK passes each
109
+ * through verbatim, again producing interleaved thinking.
110
+ *
111
+ * Both cases can coexist. The only layout opus-4.7 reliably accepts is:
112
+ * [thinking at index 0 (optional)] followed by text/tool_use only,
113
+ * i.e. AT MOST ONE thinking block per consecutive assistant run, and that
114
+ * thinking block must be the very first non-metadata part.
115
+ *
116
+ * Rule enforced here:
117
+ * - For each consecutive assistant run, keep AT MOST ONE reasoning part.
118
+ * - That reasoning part must be the first non-metadata content part of
119
+ * the first assistant in the run. Otherwise strip all reasoning from
120
+ * the run.
121
+ *
122
+ * Trade-off: the model loses visibility into its own intermediate-step
123
+ * reasoning for multi-step turns. The first step's reasoning is preserved
124
+ * when possible, which carries enough cache continuity for Anthropic.
125
+ *
126
+ * Upstream bug (track with smart note #38, remove this workaround when
127
+ * fixed): @ai-sdk/anthropic's groupIntoBlocks +
128
+ * convert-to-anthropic-messages-prompt.ts (case 'assistant'). Same class
129
+ * fixed for Bedrock in vercel/ai#13583/#13972.
130
+ */
131
+ export declare function stripReasoningFromMergedAssistants(messages: MessageLike[], providerID?: string): number;
132
+ /**
133
+ * Neutralize large image-data-URL file parts on already-processed user
134
+ * messages. Replaces them in place with empty-text sentinels so message
135
+ * parts length stays constant between passes — cache-prefix stability on
136
+ * proxy providers, unchanged wire shape on Anthropic/Bedrock where
137
+ * OpenCode's upstream filter drops empty text parts.
138
+ */
139
+ export declare function stripProcessedImages(messages: MessageLike[], watermark: number, messageTagNumbers: Map<MessageLike, number>): number;
140
+ //# sourceMappingURL=strip-content.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strip-content.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/strip-content.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAwBpE;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,2BAA2B,CACvC,QAAQ,EAAE,WAAW,EAAE,EACvB,kBAAkB,EAAE,MAAM,EAC1B,UAAU,CAAC,EAAE,MAAM,GACpB;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,EAAE,CAAA;CAAE,CA2D/C;AAuBD;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,+BAA+B,CAC3C,QAAQ,EAAE,WAAW,EAAE,EACvB,UAAU,CAAC,EAAE,MAAM,GACpB;IACC,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,EAAE,CAAC;CAC3B,CA2EA;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAClC,QAAQ,EAAE,WAAW,EAAE,EACvB,kBAAkB,EAAE,GAAG,CAAC,WAAW,EAAE,gBAAgB,EAAE,CAAC,EACxD,iBAAiB,EAAE,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,EAC3C,kBAAkB,EAAE,MAAM,GAC3B,MAAM,CAuBR;AAED;;;GAGG;AACH,wBAAgB,4BAA4B,CACxC,QAAQ,EAAE,WAAW,EAAE,EACvB,iBAAiB,EAAE,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,EAC3C,kBAAkB,EAAE,MAAM,GAC3B,MAAM,CAmBR;AAED,wBAAgB,iBAAiB,CAC7B,QAAQ,EAAE,WAAW,EAAE,EACvB,kBAAkB,EAAE,GAAG,CAAC,WAAW,EAAE,gBAAgB,EAAE,CAAC,EACxD,iBAAiB,EAAE,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,EAC3C,iBAAiB,EAAE,MAAM,GAC1B,MAAM,CA2BR;AAYD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,qBAAqB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,MAAM,CA6BrE;AAID,wBAAgB,mBAAmB,CAC/B,QAAQ,EAAE,WAAW,EAAE,EACvB,iBAAiB,EAAE,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,EAC3C,iBAAiB,EAAE,MAAM,GAC1B,MAAM,CAsBR;AAED,wBAAgB,oBAAoB,CAChC,QAAQ,EAAE,WAAW,EAAE,EACvB,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,GAC5C,MAAM,CAsBR;AAwBD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAuCG;AACH,wBAAgB,kCAAkC,CAC9C,QAAQ,EAAE,WAAW,EAAE,EACvB,UAAU,CAAC,EAAE,MAAM,GACpB,MAAM,CAiFR;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAChC,QAAQ,EAAE,WAAW,EAAE,EACvB,SAAS,EAAE,MAAM,EACjB,iBAAiB,EAAE,GAAG,CAAC,WAAW,EAAE,MAAM,CAAC,GAC5C,MAAM,CAuCR"}
@@ -0,0 +1,17 @@
1
+ import type { MessageLike } from "./tag-messages";
2
+ /**
3
+ * Replace structural/cleared parts with empty-text sentinels instead of removing
4
+ * them. Preserves message.parts length between passes so providers that hash
5
+ * the serialized message array (proxy providers like Antigravity, some
6
+ * OpenRouter configs) see a stable cache prefix across turns.
7
+ *
8
+ * For Anthropic/Bedrock/Google, OpenCode's provider/transform.ts drops empty
9
+ * text/reasoning parts before the wire, so the sentinel disappears anyway —
10
+ * producing the same wire shape as the previous behavior but avoiding
11
+ * mid-pipeline array mutation.
12
+ *
13
+ * Idempotent: sentinels are themselves recognized on subsequent passes and
14
+ * skipped (not re-mutated, not re-counted).
15
+ */
16
+ export declare function stripStructuralNoise(messages: MessageLike[]): number;
17
+ //# sourceMappingURL=strip-structural-noise.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"strip-structural-noise.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/strip-structural-noise.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAoBlD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,WAAW,EAAE,GAAG,MAAM,CAkBpE"}
@@ -0,0 +1,2 @@
1
+ export declare function stripSystemInjection(text: string): string | null;
2
+ //# sourceMappingURL=system-injection-stripper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system-injection-stripper.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/system-injection-stripper.ts"],"names":[],"mappings":"AAeA,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAiChE"}