@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,90 @@
1
+ /**
2
+ * Tool-owner backfill (plan v3.3.1, Layer B).
3
+ *
4
+ * Migration v10 added `tool_owner_message_id` to the tags table. The
5
+ * runtime carries every new tool tag with a non-NULL owner, but the
6
+ * 185k+ existing rows in user DBs need their owner column populated to
7
+ * make the v10 fix fully effective. The backfill pass iterates each
8
+ * session that has tool tags with NULL owner, queries the OpenCode DB
9
+ * for the temporally-earliest assistant message that invoked each
10
+ * callID, and writes the owner via a NULL-guarded UPDATE so the
11
+ * runtime can lazily adopt rows the backfill couldn't see (e.g. Pi
12
+ * sessions, deleted OC sessions, transient OC-DB-unavailable cases).
13
+ *
14
+ * Concurrency model:
15
+ * - Per-session advisory lease via `tool_owner_backfill_state`.
16
+ * - 5-minute lease, renewed every 60s during chunked execution.
17
+ * - Sibling instances skip sessions whose lease is held and active.
18
+ * - Process-death cleanup falls out for free: better-sqlite3 + WAL
19
+ * drops all locks at process exit, and the `lease_expires_at`
20
+ * column is the only durable state. A crashed process's session
21
+ * becomes claimable as soon as the lease wall-clock expires.
22
+ * - NULL-guarded UPDATE: backfill never clobbers a row already
23
+ * adopted at runtime.
24
+ *
25
+ * Skip vs fail semantics:
26
+ * - When OpenCode DB is missing (e.g. Pi-only install), every
27
+ * session gets marked 'skipped' in the state table. Lazy adoption
28
+ * handles the orphans at runtime.
29
+ * - When OpenCode DB exists but a specific session is missing or
30
+ * yields zero matches, that session is marked 'skipped' too.
31
+ * Same lazy-adoption fallback covers it.
32
+ * - A session error during backfill (SQLITE_BUSY, malformed JSON,
33
+ * anything) is logged and the session is left in 'pending'/
34
+ * 'running' for a retry on next plugin start. Backfill never
35
+ * fail-closes the plugin — it's defense-in-depth on top of
36
+ * Layer C lazy adoption.
37
+ *
38
+ * Idempotency:
39
+ * - The NULL guard makes UPDATE idempotent: re-running against an
40
+ * already-backfilled row matches zero rows and moves on.
41
+ * - The state table makes session bookkeeping idempotent: a
42
+ * completed session is never re-processed.
43
+ */
44
+ import type { Database } from "../../shared/sqlite";
45
+ interface BackfillStateRow {
46
+ session_id: string;
47
+ status: string;
48
+ started_at: number | null;
49
+ lease_expires_at: number | null;
50
+ completed_at: number | null;
51
+ last_error: string | null;
52
+ }
53
+ interface BackfillResult {
54
+ sessionsProcessed: number;
55
+ sessionsSkippedNoOcDb: number;
56
+ sessionsSkippedNoMatches: number;
57
+ sessionsCompleted: number;
58
+ sessionsBlockedByLease: number;
59
+ sessionsErrored: number;
60
+ rowsUpdated: number;
61
+ rowsLeftNull: number;
62
+ durationMs: number;
63
+ }
64
+ /**
65
+ * Top-level entry point. Called from `openDatabase()` after
66
+ * `runMigrations()` returns. Synchronous; runs to completion before
67
+ * returning so the first transform pass on a fresh upgrade sees a
68
+ * mostly-backfilled DB.
69
+ *
70
+ * Worst-case runtime on the user's playground DB (3,276 sessions,
71
+ * 185,716 tool tags): ~25 seconds. Well under the 60-second budget.
72
+ */
73
+ export declare function runToolOwnerBackfill(db: Database): BackfillResult;
74
+ /**
75
+ * Returns true when at least one tool tag exists with NULL owner that
76
+ * isn't already marked completed/skipped in the state table.
77
+ *
78
+ * Treating "no NULL-owner tags" as "no work" lets us short-circuit on
79
+ * fresh DBs (every row is born with a non-NULL owner) and on already-
80
+ * backfilled DBs (re-running is a no-op).
81
+ */
82
+ export declare function isToolOwnerBackfillNeeded(db: Database): boolean;
83
+ /**
84
+ * Test-only: read the backfill state for a session. Exposed via the
85
+ * normal export but namespaced by underscore so it doesn't show up in
86
+ * the public surface area outside tests.
87
+ */
88
+ export declare function _getBackfillState(db: Database, sessionId: string): BackfillStateRow | null;
89
+ export {};
90
+ //# sourceMappingURL=tool-owner-backfill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tool-owner-backfill.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/tool-owner-backfill.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAMH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAiBpD,UAAU,gBAAgB;IACtB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,UAAU,cAAc;IACpB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,wBAAwB,EAAE,MAAM,CAAC;IACjC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,sBAAsB,EAAE,MAAM,CAAC;IAC/B,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;CACtB;AA2BD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,EAAE,QAAQ,GAAG,cAAc,CAqDjE;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CAkB/D;AA6SD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,gBAAgB,GAAG,IAAI,CAO1F"}
@@ -0,0 +1,72 @@
1
+ export interface TagEntry {
2
+ tagNumber: number;
3
+ messageId: string;
4
+ type: "message" | "tool" | "file";
5
+ status: "active" | "dropped" | "compacted";
6
+ dropMode: "full" | "truncated";
7
+ toolName: string | null;
8
+ inputByteSize: number;
9
+ byteSize: number;
10
+ reasoningByteSize: number;
11
+ sessionId: string;
12
+ /**
13
+ * Caveman compression depth applied to this tag's text part. 0 = none,
14
+ * 1 = lite, 2 = full, 3 = ultra. Only meaningful for `type: "message"`;
15
+ * tool/file tags stay at 0. Used by experimental age-tier caveman
16
+ * heuristic to avoid re-compressing text that already matches the
17
+ * target depth for its age band.
18
+ */
19
+ cavemanDepth: number;
20
+ /**
21
+ * For `type: "tool"` tags: the assistant message id where the
22
+ * underlying tool call was invoked. Identity for a tool tag is the
23
+ * triple `(sessionId, messageId/callID, toolOwnerMessageId)` —
24
+ * including this field disambiguates collisions when OpenCode's
25
+ * per-turn callID counter produces the same id across turns.
26
+ *
27
+ * NULL on:
28
+ * - all `type: "message"` and `type: "file"` tags (not applicable)
29
+ * - legacy tool tags written before plugin v0.16.x (the
30
+ * tag-owner-fix migration v10). The runtime lazily adopts these
31
+ * orphan rows on first observation; backfill populates them at
32
+ * plugin startup against the OpenCode DB.
33
+ *
34
+ * See plan v3.3.1 in `.alfonso/plans/tag-owner-fix-plan.md`.
35
+ */
36
+ toolOwnerMessageId: string | null;
37
+ }
38
+ export interface PendingOp {
39
+ id: number;
40
+ sessionId: string;
41
+ tagId: number;
42
+ operation: "drop";
43
+ queuedAt: number;
44
+ }
45
+ export interface SessionMeta {
46
+ sessionId: string;
47
+ lastResponseTime: number;
48
+ cacheTtl: string;
49
+ counter: number;
50
+ lastNudgeTokens: number;
51
+ lastNudgeBand: "far" | "near" | "urgent" | "critical" | null;
52
+ lastTransformError: string | null;
53
+ isSubagent: boolean;
54
+ lastContextPercentage: number;
55
+ lastInputTokens: number;
56
+ observedSafeInputTokens: number;
57
+ cacheAlertSent: boolean;
58
+ timesExecuteThresholdReached: number;
59
+ compartmentInProgress: boolean;
60
+ systemPromptHash: string;
61
+ systemPromptTokens: number;
62
+ conversationTokens: number;
63
+ toolCallTokens: number;
64
+ clearedReasoningThroughTag: number;
65
+ lastTodoState: string;
66
+ }
67
+ export type SchedulerDecision = "execute" | "defer";
68
+ export interface ContextUsage {
69
+ percentage: number;
70
+ inputTokens: number;
71
+ }
72
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;IAClC,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,WAAW,CAAC;IAC3C,QAAQ,EAAE,MAAM,GAAG,WAAW,CAAC;IAC/B,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,SAAS,EAAE,MAAM,CAAC;IAClB;;;;;;OAMG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;;;;;;;;;;;OAeG;IACH,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;CACrC;AAED,MAAM,WAAW,SAAS;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,WAAW;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,CAAC;IACxB,aAAa,EAAE,KAAK,GAAG,MAAM,GAAG,QAAQ,GAAG,UAAU,GAAG,IAAI,CAAC;IAC7D,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;IAClC,UAAU,EAAE,OAAO,CAAC;IACpB,qBAAqB,EAAE,MAAM,CAAC;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,uBAAuB,EAAE,MAAM,CAAC;IAChC,cAAc,EAAE,OAAO,CAAC;IACxB,4BAA4B,EAAE,MAAM,CAAC;IACrC,qBAAqB,EAAE,OAAO,CAAC;IAC/B,gBAAgB,EAAE,MAAM,CAAC;IACzB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC;IAC3B,cAAc,EAAE,MAAM,CAAC;IACvB,0BAA0B,EAAE,MAAM,CAAC;IACnC,aAAa,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,MAAM,iBAAiB,GAAG,SAAS,GAAG,OAAO,CAAC;AAEpD,MAAM,WAAW,YAAY;IACzB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;CACvB"}
@@ -0,0 +1,22 @@
1
+ import type { PluginContext } from "../../../plugin/types";
2
+ import type { Database } from "../../../shared/sqlite";
3
+ interface ReviewUserMemoriesArgs {
4
+ db: Database;
5
+ client: PluginContext["client"];
6
+ parentSessionId: string | undefined;
7
+ sessionDirectory: string | undefined;
8
+ holderId: string;
9
+ deadline: number;
10
+ promotionThreshold: number;
11
+ /** Resolved dreamer fallback chain. */
12
+ fallbackModels?: readonly string[];
13
+ }
14
+ interface ReviewResult {
15
+ promoted: number;
16
+ merged: number;
17
+ dismissed: number;
18
+ candidatesConsumed: number;
19
+ }
20
+ export declare function reviewUserMemories(args: ReviewUserMemoriesArgs): Promise<ReviewResult>;
21
+ export {};
22
+ //# sourceMappingURL=review-user-memories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review-user-memories.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/user-memory/review-user-memories.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAK3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAavD,UAAU,sBAAsB;IAC5B,EAAE,EAAE,QAAQ,CAAC;IACb,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,uCAAuC;IACvC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAED,UAAU,YAAY;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,YAAY,CAAC,CAyP5F"}
@@ -0,0 +1,33 @@
1
+ import type { Database } from "../../../shared/sqlite";
2
+ export interface UserMemoryCandidate {
3
+ id: number;
4
+ content: string;
5
+ sessionId: string;
6
+ sourceCompartmentStart: number | null;
7
+ sourceCompartmentEnd: number | null;
8
+ createdAt: number;
9
+ }
10
+ export interface UserMemory {
11
+ id: number;
12
+ content: string;
13
+ status: "active" | "dismissed";
14
+ promotedAt: number;
15
+ sourceCandidateIds: number[];
16
+ createdAt: number;
17
+ updatedAt: number;
18
+ }
19
+ export declare function insertUserMemoryCandidates(db: Database, candidates: Array<{
20
+ content: string;
21
+ sessionId: string;
22
+ sourceCompartmentStart?: number;
23
+ sourceCompartmentEnd?: number;
24
+ }>): void;
25
+ export declare function getUserMemoryCandidates(db: Database): UserMemoryCandidate[];
26
+ export declare function deleteUserMemoryCandidates(db: Database, ids: number[]): void;
27
+ export declare function insertUserMemory(db: Database, content: string, sourceCandidateIds: number[]): number;
28
+ export declare function getActiveUserMemories(db: Database): UserMemory[];
29
+ export declare function getAllUserMemories(db: Database): UserMemory[];
30
+ export declare function updateUserMemoryContent(db: Database, id: number, content: string): void;
31
+ export declare function dismissUserMemory(db: Database, id: number): void;
32
+ export declare function deleteUserMemory(db: Database, id: number): void;
33
+ //# sourceMappingURL=storage-user-memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"storage-user-memory.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/user-memory/storage-user-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,WAAW,mBAAmB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,QAAQ,GAAG,WAAW,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB;AAID,wBAAgB,0BAA0B,CACtC,EAAE,EAAE,QAAQ,EACZ,UAAU,EAAE,KAAK,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC,GACH,IAAI,CAiBN;AAED,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,QAAQ,GAAG,mBAAmB,EAAE,CAqB3E;AAED,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,CAI5E;AAID,wBAAgB,gBAAgB,CAC5B,EAAE,EAAE,QAAQ,EACZ,OAAO,EAAE,MAAM,EACf,kBAAkB,EAAE,MAAM,EAAE,GAC7B,MAAM,CAQR;AAED,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,QAAQ,GAAG,UAAU,EAAE,CAehE;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,QAAQ,GAAG,UAAU,EAAE,CAe7D;AAED,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAMvF;AAED,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAKhE;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAE/D"}
@@ -0,0 +1,13 @@
1
+ import type { Database } from "../../shared/sqlite";
2
+ export interface WorkMetrics {
3
+ newWorkTokens: number;
4
+ totalInputTokens: number;
5
+ }
6
+ export interface PiSessionEntry {
7
+ role?: unknown;
8
+ usage?: unknown;
9
+ message?: unknown;
10
+ }
11
+ export declare function computeOpenCodeWorkMetrics(openCodeDb: Database, sessionId: string): WorkMetrics;
12
+ export declare function computePiWorkMetrics(sessionEntries: PiSessionEntry[] | unknown[]): WorkMetrics;
13
+ //# sourceMappingURL=work-metrics.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"work-metrics.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/work-metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,WAAW,WAAW;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAuFD,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,WAAW,CAQ/F;AAED,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,cAAc,EAAE,GAAG,OAAO,EAAE,GAAG,WAAW,CA8B9F"}
@@ -0,0 +1,23 @@
1
+ interface AutoUpdateInstallContext {
2
+ installDir: string;
3
+ packageJsonPath: string;
4
+ }
5
+ export declare function resolveInstallContext(runtimePackageJsonPath?: string | null): AutoUpdateInstallContext | null;
6
+ export declare function preparePackageUpdate(version: string, packageName?: string, runtimePackageJsonPath?: string | null): string | null;
7
+ /**
8
+ * Run `npm install` in the install dir to materialize the dependency version
9
+ * we just rewrote. Earlier versions used `bun install`, but OpenCode itself
10
+ * installs plugins via npm (the install dir always contains package-lock.json,
11
+ * never bun.lock), so calling npm matches the existing lockfile shape and
12
+ * avoids generating a parallel bun.lock that drifts from OpenCode's view.
13
+ *
14
+ * The default timeout is 60s — long enough for a typical reinstall over a
15
+ * mediocre network, short enough that a stuck install doesn't pin the plugin
16
+ * process. Caller can override.
17
+ */
18
+ export declare function runNpmInstallSafe(installDir: string, options?: {
19
+ timeoutMs?: number;
20
+ signal?: AbortSignal;
21
+ }): Promise<boolean>;
22
+ export {};
23
+ //# sourceMappingURL=cache.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/hooks/auto-update-checker/cache.ts"],"names":[],"mappings":"AAmBA,UAAU,wBAAwB;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;CAC3B;AAgGD,wBAAgB,qBAAqB,CACjC,sBAAsB,GAAE,MAAM,GAAG,IAAyC,GAC3E,wBAAwB,GAAG,IAAI,CA2CjC;AAED,wBAAgB,oBAAoB,CAChC,OAAO,EAAE,MAAM,EACf,WAAW,GAAE,MAAqB,EAClC,sBAAsB,GAAE,MAAM,GAAG,IAAyC,GAC3E,MAAM,GAAG,IAAI,CAyBf;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACnC,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAO,GAC3D,OAAO,CAAC,OAAO,CAAC,CA2ClB"}
@@ -0,0 +1,13 @@
1
+ import { type PluginEntryInfo } from "./types";
2
+ export declare function extractChannel(version: string | null): string;
3
+ export declare function getLocalDevVersion(directory: string): string | null;
4
+ export declare function getCurrentRuntimePackageJsonPath(currentModuleUrl?: string): string | null;
5
+ export declare function findPluginEntry(directory: string): PluginEntryInfo | null;
6
+ export declare function getCachedVersion(spec?: string | null): string | null;
7
+ export declare function updatePinnedVersion(configPath: string, oldEntry: string, newVersion: string): boolean;
8
+ export declare function getLatestVersion(channel?: string, options?: {
9
+ registryUrl?: string;
10
+ timeoutMs?: number;
11
+ signal?: AbortSignal;
12
+ }): Promise<string | null>;
13
+ //# sourceMappingURL=checker.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../../../src/hooks/auto-update-checker/checker.ts"],"names":[],"mappings":"AAeA,OAAO,EAIH,KAAK,eAAe,EACvB,MAAM,SAAS,CAAC;AAqCjB,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAY7D;AA4ED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYnE;AAED,wBAAgB,gCAAgC,CAC5C,gBAAgB,GAAE,MAAwB,GAC3C,MAAM,GAAG,IAAI,CAOf;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CA2BzE;AAQD,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CA0BpE;AAED,wBAAgB,mBAAmB,CAC/B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACnB,OAAO,CAwBT;AAMD,wBAAsB,gBAAgB,CAClC,OAAO,SAAW,EAClB,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAO,GACjF,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAuBxB"}
@@ -0,0 +1,10 @@
1
+ export declare const PACKAGE_NAME = "@wolfx/opencode-magic-context";
2
+ export declare const NPM_REGISTRY_URL = "https://registry.npmjs.org";
3
+ export declare const NPM_FETCH_TIMEOUT = 10000;
4
+ /** Root directory OpenCode uses for cached npm plugin wrapper installs. */
5
+ export declare const CACHE_DIR: string;
6
+ /** Primary OpenCode configuration file path (standard JSON). */
7
+ export declare const USER_OPENCODE_CONFIG: string;
8
+ /** Alternative OpenCode configuration file path (JSON with Comments). */
9
+ export declare const USER_OPENCODE_CONFIG_JSONC: string;
10
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/hooks/auto-update-checker/constants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,YAAY,kCAAkC,CAAC;AAC5D,eAAO,MAAM,gBAAgB,+BAA+B,CAAC;AAC7D,eAAO,MAAM,iBAAiB,QAAS,CAAC;AAgBxC,2EAA2E;AAC3E,eAAO,MAAM,SAAS,QAA2C,CAAC;AAElE,gEAAgE;AAChE,eAAO,MAAM,oBAAoB,QAAiD,CAAC;AAEnF,yEAAyE;AACzE,eAAO,MAAM,0BAA0B,QAAkD,CAAC"}
@@ -0,0 +1,40 @@
1
+ import type { PluginInput } from "@opencode-ai/plugin";
2
+ import type { AutoUpdateCheckerOptions } from "./types";
3
+ type OpenCodeEvent = {
4
+ type: string;
5
+ properties?: unknown;
6
+ };
7
+ /**
8
+ * Auto-update checker.
9
+ *
10
+ * Trigger model (rewritten in v0.17.1):
11
+ *
12
+ * The check fires from plugin initialization itself via a `setTimeout`
13
+ * scheduled when this hook is created. We do NOT gate on
14
+ * `session.created` events — that gate was unreliable because:
15
+ *
16
+ * - TUI restart with a resumed session never fires `session.created`
17
+ * (the event fires on session creation, not on plugin reload).
18
+ * - Multi-project plugin reloads each get their own plugin lifetime
19
+ * with `hasChecked = false`, so only whichever project happens to
20
+ * create a fresh session first ever runs the check.
21
+ * - Sidebar/status polling and idle TUI use also never fire
22
+ * `session.created`.
23
+ *
24
+ * Multi-project coordination is now handled by an on-disk timestamp at
25
+ * `<storageDir>/last-update-check.json`. Every plugin instance reads
26
+ * the timestamp before checking; if it's within `checkIntervalMs` of
27
+ * now, the check is skipped. The first instance to claim the slot
28
+ * writes the timestamp atomically (temp + rename) so concurrent
29
+ * instances don't all hit npm.
30
+ *
31
+ * The returned event hook is preserved as a no-op so existing tests
32
+ * that pass synthetic events keep working — the hook itself never
33
+ * triggers a check now.
34
+ */
35
+ export declare function createAutoUpdateCheckerHook(ctx: PluginInput, options?: AutoUpdateCheckerOptions): (_input: {
36
+ event: OpenCodeEvent;
37
+ }) => Promise<void>;
38
+ export declare function getAutoUpdateInstallDir(): string;
39
+ export type { AutoUpdateCheckerOptions } from "./types";
40
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/auto-update-checker/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAYvD,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC;AAExD,KAAK,aAAa,GAAG;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,CAAC,EAAE,OAAO,CAAC;CACxB,CAAC;AAgBF;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,wBAAgB,2BAA2B,CACvC,GAAG,EAAE,WAAW,EAChB,OAAO,GAAE,wBAA6B,YAiBZ;IAAE,KAAK,EAAE,aAAa,CAAA;CAAE,mBAyCrD;AA0MD,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD;AAYD,YAAY,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC"}
@@ -0,0 +1,50 @@
1
+ import { z } from "zod";
2
+ export declare const NpmPackageEnvelopeSchema: z.ZodObject<{
3
+ "dist-tags": z.ZodDefault<z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>>;
4
+ }, z.core.$strip>;
5
+ export declare const OpencodePluginTupleSchema: z.ZodTuple<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>], null>;
6
+ export declare const OpencodeConfigSchema: z.ZodObject<{
7
+ plugin: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodTuple<[z.ZodString, z.ZodRecord<z.ZodString, z.ZodUnknown>], null>]>>>;
8
+ }, z.core.$strip>;
9
+ export declare const PackageJsonSchema: z.ZodObject<{
10
+ name: z.ZodOptional<z.ZodString>;
11
+ version: z.ZodOptional<z.ZodString>;
12
+ dependencies: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
13
+ }, z.core.$loose>;
14
+ export interface AutoUpdateCheckerOptions {
15
+ enabled?: boolean;
16
+ showStartupToast?: boolean;
17
+ autoUpdate?: boolean;
18
+ npmRegistryUrl?: string;
19
+ fetchTimeoutMs?: number;
20
+ signal?: AbortSignal;
21
+ /**
22
+ * Storage directory used for cross-process check coordination. The
23
+ * checker writes `last-update-check.json` here so concurrent plugin
24
+ * instances (multi-project TUI launches) only hit npm once per
25
+ * `checkIntervalMs`. Pass `null`/omit for fail-open behavior — the
26
+ * check still runs, just without dedup. Recommended: pass the
27
+ * plugin's existing storage path (e.g. `getMagicContextStorageDir()`).
28
+ */
29
+ storageDir?: string | null;
30
+ /**
31
+ * Minimum interval between checks across all plugin instances on
32
+ * this machine. Default: 1 hour.
33
+ */
34
+ checkIntervalMs?: number;
35
+ /**
36
+ * Delay before the post-init check fires. Lets OpenCode finish boot
37
+ * before the npm round-trip starts. Default: 5000ms.
38
+ */
39
+ initDelayMs?: number;
40
+ }
41
+ export interface PluginEntryInfo {
42
+ entry: string;
43
+ isPinned: boolean;
44
+ pinnedVersion: string | null;
45
+ configPath: string;
46
+ }
47
+ export type NpmPackageEnvelope = z.infer<typeof NpmPackageEnvelopeSchema>;
48
+ export type OpencodeConfig = z.infer<typeof OpencodeConfigSchema>;
49
+ export type PackageJson = z.infer<typeof PackageJsonSchema>;
50
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/hooks/auto-update-checker/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,wBAAwB;;iBAEnC,CAAC;AAEH,eAAO,MAAM,yBAAyB,yEAA2D,CAAC;AAElG,eAAO,MAAM,oBAAoB;;iBAE/B,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;iBAMZ,CAAC;AAEnB,MAAM,WAAW,wBAAwB;IACrC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;;;;;OAOG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,eAAe;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;IAClB,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,MAAM,kBAAkB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC1E,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAClE,MAAM,MAAM,WAAW,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function isAnthropicProvider(providerID: string): boolean;
2
+ //# sourceMappingURL=is-anthropic-provider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-anthropic-provider.d.ts","sourceRoot":"","sources":["../../src/hooks/is-anthropic-provider.ts"],"names":[],"mappings":"AAAA,wBAAgB,mBAAmB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAE/D"}
@@ -0,0 +1,5 @@
1
+ import type { NudgePlacementStore } from "./nudge-placement-store";
2
+ import type { ContextNudge } from "./nudger";
3
+ import type { MessageLike } from "./tag-messages";
4
+ export declare function applyContextNudge(messages: MessageLike[], nudge: ContextNudge | null, nudgePlacements: NudgePlacementStore, sessionId: string): void;
5
+ //# sourceMappingURL=apply-context-nudge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-context-nudge.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/apply-context-nudge.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AACnE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,wBAAgB,iBAAiB,CAC7B,QAAQ,EAAE,WAAW,EAAE,EACvB,KAAK,EAAE,YAAY,GAAG,IAAI,EAC1B,eAAe,EAAE,mBAAmB,EACpC,SAAS,EAAE,MAAM,GAClB,IAAI,CAgCN"}
@@ -0,0 +1,7 @@
1
+ import type { ContextDatabase } from "../../features/magic-context/storage";
2
+ import { getPendingOps } from "../../features/magic-context/storage";
3
+ import type { TagEntry } from "../../features/magic-context/types";
4
+ import type { TagTarget } from "./tag-messages";
5
+ export declare function applyPendingOperations(sessionId: string, db: ContextDatabase, targets: Map<number, TagTarget>, protectedTags?: number, preloadedTags?: TagEntry[], preloadedPendingOps?: ReturnType<typeof getPendingOps>): boolean;
6
+ export declare function applyFlushedStatuses(sessionId: string, db: ContextDatabase, targets: Map<number, TagTarget>, preloadedTags?: TagEntry[]): boolean;
7
+ //# sourceMappingURL=apply-operations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply-operations.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/apply-operations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAC5E,OAAO,EACH,aAAa,EAKhB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAwDhD,wBAAgB,sBAAsB,CAClC,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,eAAe,EACnB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,EAC/B,aAAa,GAAE,MAAU,EACzB,aAAa,CAAC,EAAE,QAAQ,EAAE,EAC1B,mBAAmB,CAAC,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,GACvD,OAAO,CAoDT;AAED,wBAAgB,oBAAoB,CAChC,SAAS,EAAE,MAAM,EACjB,EAAE,EAAE,eAAe,EACnB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,EAC/B,aAAa,CAAC,EAAE,QAAQ,EAAE,GAC3B,OAAO,CA0BT"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Build a compact "you may recall something related" hint from unified search
3
+ * results, ready to append to a user message.
4
+ *
5
+ * The hint intentionally compresses fragments so they feel like vague recall
6
+ * rather than a drop-in answer — the goal is to nudge the agent to run
7
+ * ctx_search for full context, not to provide the answer itself.
8
+ *
9
+ * Compression strategy per source:
10
+ * - memory → caveman-ultra via `cavemanCompress()` (token-dense)
11
+ * - git_commit → raw commit subject (already terse); prefixed with SHA + age
12
+ * - message → caveman-ultra, role tag
13
+ *
14
+ * Guardrails:
15
+ * - Per-fragment token cap (~20 tokens, ~80 chars) with ellipsis truncation
16
+ * - Skip fragments whose source is already present in visible session-history
17
+ * (caller handles) — this module only knows about search results
18
+ * - Hard-caps total output at ~200 tokens so misconfigured thresholds can't
19
+ * balloon the user message
20
+ */
21
+ import type { UnifiedSearchResult } from "../../features/magic-context/search";
22
+ export interface AutoSearchHintOptions {
23
+ maxFragments?: number;
24
+ fragmentCharCap?: number;
25
+ }
26
+ /**
27
+ * Build the hint text. Returns null when `results` is empty, when no fragment
28
+ * has meaningful content after compression, or when limits zero out the budget.
29
+ *
30
+ * This function does NOT enforce score thresholds or message-length rules —
31
+ * callers (the transform-time auto-search wiring) apply those gates first.
32
+ */
33
+ export declare function buildAutoSearchHint(results: UnifiedSearchResult[], options?: AutoSearchHintOptions): string | null;
34
+ //# sourceMappingURL=auto-search-hint.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto-search-hint.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/auto-search-hint.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAC;AAQ/E,MAAM,WAAW,qBAAqB;IAClC,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AA2CD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAC/B,OAAO,EAAE,mBAAmB,EAAE,EAC9B,OAAO,GAAE,qBAA0B,GACpC,MAAM,GAAG,IAAI,CAgCf"}
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Transform-time auto-search hint runner.
3
+ *
4
+ * When a new user message arrives, optionally run ctx_search against the user's
5
+ * prompt and append a caveman-compressed "vague recall" fragment hint to that
6
+ * message. The hint nudges the agent to run ctx_search for full context rather
7
+ * than injecting the content directly.
8
+ *
9
+ * Cache safety:
10
+ * - Attaches to the latest user message (the message that triggered the turn),
11
+ * never to message[0] or to any assistant message. Appending to the current
12
+ * user message happens BEFORE it reaches Anthropic's cache because this
13
+ * transform runs on the prompt path — same property as note nudges.
14
+ * - Idempotent via in-memory turn cache + `.includes()` guard in
15
+ * appendReminderToUserMessageById. On defer passes we re-append the same
16
+ * text; `.includes()` makes that a no-op.
17
+ * - New user turn (different message id) → compute fresh hint, new append.
18
+ * - Process restart → cache cleared; next pass will recompute but the user
19
+ * message is a fresh turn anyway, no provider cache to preserve yet.
20
+ */
21
+ import type { Database } from "../../shared/sqlite";
22
+ import type { MessageLike } from "./transform-operations";
23
+ export interface AutoSearchRunnerOptions {
24
+ enabled: boolean;
25
+ scoreThreshold: number;
26
+ minPromptChars: number;
27
+ directory?: string;
28
+ projectPath: string;
29
+ ensureProjectRegistered?: (directory: string, db: Database) => Promise<void>;
30
+ memoryEnabled?: boolean;
31
+ embeddingEnabled?: boolean;
32
+ gitCommitsEnabled?: boolean;
33
+ /** Memory ids already rendered in the injected <session-history> block —
34
+ * skip fragments that just duplicate visible memories. */
35
+ visibleMemoryIds?: Set<number>;
36
+ }
37
+ /**
38
+ * Entry point. Called from transform post-processing. No-op when disabled,
39
+ * when there is no meaningful user message, when prompt is too short, when
40
+ * search returns nothing strong enough, or when the hint has already been
41
+ * appended for this turn.
42
+ */
43
+ export declare function runAutoSearchHint(args: {
44
+ sessionId: string;
45
+ db: Database;
46
+ messages: MessageLike[];
47
+ options: AutoSearchRunnerOptions;
48
+ }): Promise<void>;
49
+ /** Test hook — wipe the per-turn cache. */
50
+ export declare function _resetAutoSearchCache(): void;
51
+ /** Session cleanup hook — call on session.deleted. */
52
+ export declare function clearAutoSearchForSession(_sessionId: string): void;
53
+ //# sourceMappingURL=auto-search-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auto-search-runner.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/auto-search-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAiBH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAIpD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AA4C1D,MAAM,WAAW,uBAAuB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,uBAAuB,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7E,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;+DAC2D;IAC3D,gBAAgB,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;CAClC;AAyID;;;;;GAKG;AACH,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC1C,SAAS,EAAE,MAAM,CAAC;IAClB,EAAE,EAAE,QAAQ,CAAC;IACb,QAAQ,EAAE,WAAW,EAAE,CAAC;IACxB,OAAO,EAAE,uBAAuB,CAAC;CACpC,GAAG,OAAO,CAAC,IAAI,CAAC,CA2IhB;AAED,2CAA2C;AAC3C,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED,sDAAsD;AACtD,wBAAgB,yBAAyB,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,CAElE"}
@@ -0,0 +1,24 @@
1
+ export type BypassReason = "force-materialize" | "explicit-bust" | "subagent" | "none";
2
+ export interface BypassInput {
3
+ contextUsage: {
4
+ percentage: number;
5
+ };
6
+ sessionMeta: {
7
+ isSubagent: boolean;
8
+ };
9
+ historyRefreshSessions: Set<string>;
10
+ sessionId: string;
11
+ }
12
+ export declare const FORCE_MATERIALIZE_PERCENTAGE = 85;
13
+ export declare function detectMidTurnBypassReason(input: BypassInput): BypassReason;
14
+ export interface ApplyMidTurnDeferralInput {
15
+ base: "execute" | "defer";
16
+ bypassReason: BypassReason;
17
+ midTurn: boolean;
18
+ }
19
+ export interface ApplyMidTurnDeferralOutput {
20
+ midTurnAdjustedSchedulerDecision: "execute" | "defer";
21
+ sideEffect: "set-flag" | "none";
22
+ }
23
+ export declare function applyMidTurnDeferral(input: ApplyMidTurnDeferralInput): ApplyMidTurnDeferralOutput;
24
+ //# sourceMappingURL=boundary-execution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boundary-execution.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/boundary-execution.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG,mBAAmB,GAAG,eAAe,GAAG,UAAU,GAAG,MAAM,CAAC;AAEvF,MAAM,WAAW,WAAW;IACxB,YAAY,EAAE;QAAE,UAAU,EAAE,MAAM,CAAA;KAAE,CAAC;IACrC,WAAW,EAAE;QAAE,UAAU,EAAE,OAAO,CAAA;KAAE,CAAC;IACrC,sBAAsB,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,4BAA4B,KAAK,CAAC;AAE/C,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,WAAW,GAAG,YAAY,CAK1E;AAED,MAAM,WAAW,yBAAyB;IACtC,IAAI,EAAE,SAAS,GAAG,OAAO,CAAC;IAC1B,YAAY,EAAE,YAAY,CAAC;IAC3B,OAAO,EAAE,OAAO,CAAC;CACpB;AAED,MAAM,WAAW,0BAA0B;IACvC,gCAAgC,EAAE,SAAS,GAAG,OAAO,CAAC;IACtD,UAAU,EAAE,UAAU,GAAG,MAAM,CAAC;CACnC;AAED,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,0BAA0B,CAajG"}
@@ -0,0 +1,10 @@
1
+ export interface DeferredConsumptionArgs {
2
+ schedulerDecision: "execute" | "defer";
3
+ contextPercentage: number;
4
+ /** True when this pass awaited a run that actually published new compartment state. */
5
+ justAwaitedPublication: boolean;
6
+ /** True when an active run would block materialization below the emergency bypass. */
7
+ activeRunBlocksMaterialization: boolean;
8
+ }
9
+ export declare function canConsumeDeferredOnThisPass(args: DeferredConsumptionArgs): boolean;
10
+ //# sourceMappingURL=cache-busting-signals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cache-busting-signals.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/cache-busting-signals.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,uBAAuB;IACpC,iBAAiB,EAAE,SAAS,GAAG,OAAO,CAAC;IACvC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uFAAuF;IACvF,sBAAsB,EAAE,OAAO,CAAC;IAChC,sFAAsF;IACtF,8BAA8B,EAAE,OAAO,CAAC;CAC3C;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAQnF"}