@cortexkit/opencode-magic-context 0.25.0 → 0.27.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (316) hide show
  1. package/README.md +14 -12
  2. package/dist/agents/dreamer.d.ts +19 -0
  3. package/dist/agents/dreamer.d.ts.map +1 -1
  4. package/dist/agents/hidden-agent-registrations.d.ts +67 -0
  5. package/dist/agents/hidden-agent-registrations.d.ts.map +1 -0
  6. package/dist/agents/historian.d.ts +1 -0
  7. package/dist/agents/historian.d.ts.map +1 -1
  8. package/dist/agents/permissions.d.ts +19 -42
  9. package/dist/agents/permissions.d.ts.map +1 -1
  10. package/dist/agents/smart-note-compiler.d.ts +2 -0
  11. package/dist/agents/smart-note-compiler.d.ts.map +1 -0
  12. package/dist/config/index.d.ts +1 -1
  13. package/dist/config/index.d.ts.map +1 -1
  14. package/dist/config/migrate-config-location.d.ts +89 -0
  15. package/dist/config/migrate-config-location.d.ts.map +1 -0
  16. package/dist/config/migrate-dreamer-v2.d.ts +37 -0
  17. package/dist/config/migrate-dreamer-v2.d.ts.map +1 -0
  18. package/dist/config/migrate-experimental.d.ts.map +1 -1
  19. package/dist/config/project-security.d.ts +3 -0
  20. package/dist/config/project-security.d.ts.map +1 -1
  21. package/dist/config/prune-config-leaf.d.ts.map +1 -1
  22. package/dist/config/schema/magic-context.d.ts +606 -60
  23. package/dist/config/schema/magic-context.d.ts.map +1 -1
  24. package/dist/features/magic-context/compaction-marker.d.ts +9 -3
  25. package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
  26. package/dist/features/magic-context/compartment-chunk-embedding.d.ts +18 -1
  27. package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
  28. package/dist/features/magic-context/compartment-embedding.d.ts.map +1 -1
  29. package/dist/features/magic-context/dreamer/classify-prompt.d.ts +50 -0
  30. package/dist/features/magic-context/dreamer/classify-prompt.d.ts.map +1 -0
  31. package/dist/features/magic-context/dreamer/classify.d.ts +22 -0
  32. package/dist/features/magic-context/dreamer/classify.d.ts.map +1 -0
  33. package/dist/features/magic-context/dreamer/cron.d.ts +72 -0
  34. package/dist/features/magic-context/dreamer/cron.d.ts.map +1 -0
  35. package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts +30 -0
  36. package/dist/features/magic-context/dreamer/evaluate-smart-notes.d.ts.map +1 -0
  37. package/dist/features/magic-context/dreamer/index.d.ts +1 -3
  38. package/dist/features/magic-context/dreamer/index.d.ts.map +1 -1
  39. package/dist/features/magic-context/dreamer/lease.d.ts +44 -6
  40. package/dist/features/magic-context/dreamer/lease.d.ts.map +1 -1
  41. package/dist/features/magic-context/dreamer/maintain-docs-protected-enforcement.d.ts +13 -0
  42. package/dist/features/magic-context/dreamer/maintain-docs-protected-enforcement.d.ts.map +1 -0
  43. package/dist/features/magic-context/dreamer/map-memories-prompt.d.ts +36 -0
  44. package/dist/features/magic-context/dreamer/map-memories-prompt.d.ts.map +1 -0
  45. package/dist/features/magic-context/dreamer/map-memories.d.ts +22 -0
  46. package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -0
  47. package/dist/features/magic-context/dreamer/open-opencode-db.d.ts +7 -0
  48. package/dist/features/magic-context/dreamer/open-opencode-db.d.ts.map +1 -0
  49. package/dist/features/magic-context/dreamer/primer-seed.d.ts +25 -0
  50. package/dist/features/magic-context/dreamer/primer-seed.d.ts.map +1 -0
  51. package/dist/features/magic-context/dreamer/promote-primers.d.ts +21 -0
  52. package/dist/features/magic-context/dreamer/promote-primers.d.ts.map +1 -0
  53. package/dist/features/magic-context/dreamer/protected-regions.d.ts +19 -0
  54. package/dist/features/magic-context/dreamer/protected-regions.d.ts.map +1 -0
  55. package/dist/features/magic-context/dreamer/refresh-primers.d.ts +30 -0
  56. package/dist/features/magic-context/dreamer/refresh-primers.d.ts.map +1 -0
  57. package/dist/features/magic-context/dreamer/retrospective-learnings.d.ts +47 -0
  58. package/dist/features/magic-context/dreamer/retrospective-learnings.d.ts.map +1 -0
  59. package/dist/features/magic-context/dreamer/retrospective-orphan-sweep.d.ts +48 -0
  60. package/dist/features/magic-context/dreamer/retrospective-orphan-sweep.d.ts.map +1 -0
  61. package/dist/features/magic-context/dreamer/retrospective-raw-provider.d.ts +81 -0
  62. package/dist/features/magic-context/dreamer/retrospective-raw-provider.d.ts.map +1 -0
  63. package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts +8 -0
  64. package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts.map +1 -1
  65. package/dist/features/magic-context/dreamer/storage-task-schedule.d.ts +82 -0
  66. package/dist/features/magic-context/dreamer/storage-task-schedule.d.ts.map +1 -0
  67. package/dist/features/magic-context/dreamer/task-config.d.ts +28 -0
  68. package/dist/features/magic-context/dreamer/task-config.d.ts.map +1 -0
  69. package/dist/features/magic-context/dreamer/task-executor.d.ts +49 -0
  70. package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -0
  71. package/dist/features/magic-context/dreamer/task-gates.d.ts +29 -0
  72. package/dist/features/magic-context/dreamer/task-gates.d.ts.map +1 -0
  73. package/dist/features/magic-context/dreamer/task-prompts.d.ts +37 -6
  74. package/dist/features/magic-context/dreamer/task-prompts.d.ts.map +1 -1
  75. package/dist/features/magic-context/dreamer/task-registry.d.ts +48 -0
  76. package/dist/features/magic-context/dreamer/task-registry.d.ts.map +1 -0
  77. package/dist/features/magic-context/dreamer/task-scheduler.d.ts +88 -0
  78. package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -0
  79. package/dist/features/magic-context/dreamer/verify-gate.d.ts +43 -0
  80. package/dist/features/magic-context/dreamer/verify-gate.d.ts.map +1 -0
  81. package/dist/features/magic-context/dreamer/verify-prompt.d.ts +41 -0
  82. package/dist/features/magic-context/dreamer/verify-prompt.d.ts.map +1 -0
  83. package/dist/features/magic-context/dreamer/verify.d.ts +43 -0
  84. package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -0
  85. package/dist/features/magic-context/git-commits/search-git-commits.d.ts +2 -0
  86. package/dist/features/magic-context/git-commits/search-git-commits.d.ts.map +1 -1
  87. package/dist/features/magic-context/git-commits/storage-git-commit-embeddings.d.ts +4 -4
  88. package/dist/features/magic-context/git-commits/storage-git-commit-embeddings.d.ts.map +1 -1
  89. package/dist/features/magic-context/index.d.ts +1 -0
  90. package/dist/features/magic-context/index.d.ts.map +1 -1
  91. package/dist/features/magic-context/memory/embedding-cache.d.ts +2 -2
  92. package/dist/features/magic-context/memory/embedding-cache.d.ts.map +1 -1
  93. package/dist/features/magic-context/memory/embedding-identity.d.ts.map +1 -1
  94. package/dist/features/magic-context/memory/embedding-local.d.ts +3 -3
  95. package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
  96. package/dist/features/magic-context/memory/embedding-openai.d.ts +20 -9
  97. package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -1
  98. package/dist/features/magic-context/memory/embedding-provider.d.ts +8 -4
  99. package/dist/features/magic-context/memory/embedding-provider.d.ts.map +1 -1
  100. package/dist/features/magic-context/memory/embedding.d.ts +2 -2
  101. package/dist/features/magic-context/memory/embedding.d.ts.map +1 -1
  102. package/dist/features/magic-context/memory/index.d.ts +4 -1
  103. package/dist/features/magic-context/memory/index.d.ts.map +1 -1
  104. package/dist/features/magic-context/memory/memory-migration.d.ts +1 -0
  105. package/dist/features/magic-context/memory/memory-migration.d.ts.map +1 -1
  106. package/dist/features/magic-context/memory/promotion.d.ts +16 -4
  107. package/dist/features/magic-context/memory/promotion.d.ts.map +1 -1
  108. package/dist/features/magic-context/memory/relocate-memory.d.ts +58 -0
  109. package/dist/features/magic-context/memory/relocate-memory.d.ts.map +1 -0
  110. package/dist/features/magic-context/memory/storage-memory-embeddings.d.ts +2 -2
  111. package/dist/features/magic-context/memory/storage-memory-embeddings.d.ts.map +1 -1
  112. package/dist/features/magic-context/memory/storage-memory-verifications.d.ts +31 -0
  113. package/dist/features/magic-context/memory/storage-memory-verifications.d.ts.map +1 -0
  114. package/dist/features/magic-context/memory/storage-memory.d.ts +12 -1
  115. package/dist/features/magic-context/memory/storage-memory.d.ts.map +1 -1
  116. package/dist/features/magic-context/memory/types.d.ts +4 -0
  117. package/dist/features/magic-context/memory/types.d.ts.map +1 -1
  118. package/dist/features/magic-context/memory/verification-paths.d.ts +32 -0
  119. package/dist/features/magic-context/memory/verification-paths.d.ts.map +1 -0
  120. package/dist/features/magic-context/message-index.d.ts.map +1 -1
  121. package/dist/features/magic-context/migrations.d.ts.map +1 -1
  122. package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
  123. package/dist/features/magic-context/primer-clustering.d.ts +29 -0
  124. package/dist/features/magic-context/primer-clustering.d.ts.map +1 -0
  125. package/dist/features/magic-context/project-embedding-registry.d.ts +28 -4
  126. package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
  127. package/dist/features/magic-context/search.d.ts +12 -2
  128. package/dist/features/magic-context/search.d.ts.map +1 -1
  129. package/dist/features/magic-context/sidekick/agent.d.ts.map +1 -1
  130. package/dist/features/magic-context/smart-notes/capabilities.d.ts +31 -0
  131. package/dist/features/magic-context/smart-notes/capabilities.d.ts.map +1 -0
  132. package/dist/features/magic-context/smart-notes/compiler-prompt.d.ts +2 -0
  133. package/dist/features/magic-context/smart-notes/compiler-prompt.d.ts.map +1 -0
  134. package/dist/features/magic-context/smart-notes/compiler.d.ts +52 -0
  135. package/dist/features/magic-context/smart-notes/compiler.d.ts.map +1 -0
  136. package/dist/features/magic-context/smart-notes/index.d.ts +10 -0
  137. package/dist/features/magic-context/smart-notes/index.d.ts.map +1 -0
  138. package/dist/features/magic-context/smart-notes/runner.d.ts +18 -0
  139. package/dist/features/magic-context/smart-notes/runner.d.ts.map +1 -0
  140. package/dist/features/magic-context/smart-notes/sandbox-runner.d.ts +22 -0
  141. package/dist/features/magic-context/smart-notes/sandbox-runner.d.ts.map +1 -0
  142. package/dist/features/magic-context/smart-notes/schedule.d.ts +9 -0
  143. package/dist/features/magic-context/smart-notes/schedule.d.ts.map +1 -0
  144. package/dist/features/magic-context/smart-notes/ssrf-guard.d.ts +49 -0
  145. package/dist/features/magic-context/smart-notes/ssrf-guard.d.ts.map +1 -0
  146. package/dist/features/magic-context/smart-notes/storage.d.ts +27 -0
  147. package/dist/features/magic-context/smart-notes/storage.d.ts.map +1 -0
  148. package/dist/features/magic-context/smart-notes/types.d.ts +63 -0
  149. package/dist/features/magic-context/smart-notes/types.d.ts.map +1 -0
  150. package/dist/features/magic-context/storage-db.d.ts +6 -1
  151. package/dist/features/magic-context/storage-db.d.ts.map +1 -1
  152. package/dist/features/magic-context/storage-meta-persisted.d.ts +45 -4
  153. package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
  154. package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
  155. package/dist/features/magic-context/storage-meta-shared.d.ts +5 -1
  156. package/dist/features/magic-context/storage-meta-shared.d.ts.map +1 -1
  157. package/dist/features/magic-context/storage-meta.d.ts +1 -1
  158. package/dist/features/magic-context/storage-meta.d.ts.map +1 -1
  159. package/dist/features/magic-context/storage-notes.d.ts +15 -0
  160. package/dist/features/magic-context/storage-notes.d.ts.map +1 -1
  161. package/dist/features/magic-context/storage-primers.d.ts +85 -0
  162. package/dist/features/magic-context/storage-primers.d.ts.map +1 -0
  163. package/dist/features/magic-context/storage-tags.d.ts +68 -2
  164. package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
  165. package/dist/features/magic-context/storage.d.ts +4 -3
  166. package/dist/features/magic-context/storage.d.ts.map +1 -1
  167. package/dist/features/magic-context/tagger.d.ts +7 -1
  168. package/dist/features/magic-context/tagger.d.ts.map +1 -1
  169. package/dist/features/magic-context/tool-owner-backfill.d.ts.map +1 -1
  170. package/dist/features/magic-context/transform-decision-log.d.ts +59 -0
  171. package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -0
  172. package/dist/features/magic-context/types.d.ts +2 -0
  173. package/dist/features/magic-context/types.d.ts.map +1 -1
  174. package/dist/features/magic-context/user-memory/review-user-memories.d.ts +5 -0
  175. package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
  176. package/dist/features/magic-context/user-memory/storage-user-memory.d.ts +18 -0
  177. package/dist/features/magic-context/user-memory/storage-user-memory.d.ts.map +1 -1
  178. package/dist/features/magic-context/v22-deferred-backfill.d.ts.map +1 -1
  179. package/dist/hooks/auto-update-checker/semver.d.ts +9 -0
  180. package/dist/hooks/auto-update-checker/semver.d.ts.map +1 -1
  181. package/dist/hooks/magic-context/auto-search-hint.d.ts.map +1 -1
  182. package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
  183. package/dist/hooks/magic-context/command-handler.d.ts +8 -15
  184. package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
  185. package/dist/hooks/magic-context/compaction-marker-manager.d.ts.map +1 -1
  186. package/dist/hooks/magic-context/compartment-parser.d.ts +9 -0
  187. package/dist/hooks/magic-context/compartment-parser.d.ts.map +1 -1
  188. package/dist/hooks/magic-context/compartment-prompt.d.ts +4 -1
  189. package/dist/hooks/magic-context/compartment-prompt.d.ts.map +1 -1
  190. package/dist/hooks/magic-context/compartment-runner-historian.d.ts +1 -0
  191. package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
  192. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
  193. package/dist/hooks/magic-context/compartment-runner-partial-recomp.d.ts.map +1 -1
  194. package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
  195. package/dist/hooks/magic-context/compartment-runner-types.d.ts +8 -0
  196. package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
  197. package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
  198. package/dist/hooks/magic-context/compartment-trigger.d.ts +1 -1
  199. package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
  200. package/dist/hooks/magic-context/ctx-reduce-nudge.d.ts.map +1 -1
  201. package/dist/hooks/magic-context/derive-budgets.d.ts +5 -9
  202. package/dist/hooks/magic-context/derive-budgets.d.ts.map +1 -1
  203. package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
  204. package/dist/hooks/magic-context/event-payloads.d.ts +1 -0
  205. package/dist/hooks/magic-context/event-payloads.d.ts.map +1 -1
  206. package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
  207. package/dist/hooks/magic-context/heuristic-cleanup.d.ts +1 -0
  208. package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
  209. package/dist/hooks/magic-context/historian-prompt.generated.d.ts +1 -1
  210. package/dist/hooks/magic-context/historian-prompt.generated.d.ts.map +1 -1
  211. package/dist/hooks/magic-context/historian-state-file.d.ts.map +1 -1
  212. package/dist/hooks/magic-context/hook-handlers.d.ts +2 -1
  213. package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
  214. package/dist/hooks/magic-context/hook.d.ts +1 -0
  215. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  216. package/dist/hooks/magic-context/inject-compartments.d.ts +0 -3
  217. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
  218. package/dist/hooks/magic-context/protected-tail-boundary.d.ts +10 -0
  219. package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
  220. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  221. package/dist/hooks/magic-context/send-session-notification.d.ts +2 -0
  222. package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -1
  223. package/dist/hooks/magic-context/system-prompt-hash.d.ts +17 -0
  224. package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
  225. package/dist/hooks/magic-context/tag-id-fallback.d.ts.map +1 -1
  226. package/dist/hooks/magic-context/tag-messages.d.ts +10 -0
  227. package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
  228. package/dist/hooks/magic-context/transform-compartment-phase.d.ts +32 -1
  229. package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
  230. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +14 -5
  231. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  232. package/dist/hooks/magic-context/transform.d.ts +0 -2
  233. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  234. package/dist/index.d.ts +2 -2
  235. package/dist/index.d.ts.map +1 -1
  236. package/dist/index.js +17664 -4236
  237. package/dist/plugin/dream-timer.d.ts +17 -9
  238. package/dist/plugin/dream-timer.d.ts.map +1 -1
  239. package/dist/plugin/embedding-bootstrap-helpers.d.ts +1 -1
  240. package/dist/plugin/embedding-bootstrap-helpers.d.ts.map +1 -1
  241. package/dist/plugin/embedding-bootstrap.d.ts.map +1 -1
  242. package/dist/plugin/hooks/create-session-hooks.d.ts +211 -0
  243. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  244. package/dist/plugin/instance-disposal.d.ts +2 -0
  245. package/dist/plugin/instance-disposal.d.ts.map +1 -0
  246. package/dist/plugin/rpc-handlers.d.ts.map +1 -1
  247. package/dist/shared/announcement.d.ts +1 -1
  248. package/dist/shared/announcement.d.ts.map +1 -1
  249. package/dist/shared/data-path.d.ts +26 -7
  250. package/dist/shared/data-path.d.ts.map +1 -1
  251. package/dist/shared/index.d.ts +0 -1
  252. package/dist/shared/index.d.ts.map +1 -1
  253. package/dist/shared/model-suggestion-retry.d.ts +48 -2
  254. package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
  255. package/dist/shared/redaction.d.ts +7 -0
  256. package/dist/shared/redaction.d.ts.map +1 -0
  257. package/dist/shared/resolve-fallbacks.d.ts +28 -16
  258. package/dist/shared/resolve-fallbacks.d.ts.map +1 -1
  259. package/dist/shared/rpc-server.d.ts.map +1 -1
  260. package/dist/shared/rpc-types.d.ts +2 -0
  261. package/dist/shared/rpc-types.d.ts.map +1 -1
  262. package/dist/shared/subagent-runner.d.ts +12 -3
  263. package/dist/shared/subagent-runner.d.ts.map +1 -1
  264. package/dist/shared/tui-config.d.ts.map +1 -1
  265. package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
  266. package/dist/tools/ctx-memory/types.d.ts.map +1 -1
  267. package/dist/tools/ctx-memory/verification-recording.d.ts +8 -0
  268. package/dist/tools/ctx-memory/verification-recording.d.ts.map +1 -0
  269. package/dist/tools/ctx-search/tools.d.ts.map +1 -1
  270. package/dist/tools/ctx-search/types.d.ts +1 -1
  271. package/dist/tools/ctx-search/types.d.ts.map +1 -1
  272. package/dist/tui/data/context-db.d.ts +2 -0
  273. package/dist/tui/data/context-db.d.ts.map +1 -1
  274. package/package.json +3 -1
  275. package/src/shared/announcement.test.ts +20 -0
  276. package/src/shared/announcement.ts +19 -7
  277. package/src/shared/data-path.test.ts +70 -6
  278. package/src/shared/data-path.ts +50 -8
  279. package/src/shared/index.ts +0 -1
  280. package/src/shared/model-suggestion-retry.test.ts +79 -2
  281. package/src/shared/model-suggestion-retry.ts +181 -3
  282. package/src/shared/redaction.test.ts +48 -0
  283. package/src/shared/redaction.ts +240 -0
  284. package/src/shared/resolve-fallbacks.test.ts +37 -71
  285. package/src/shared/resolve-fallbacks.ts +30 -26
  286. package/src/shared/rpc-server.ts +24 -0
  287. package/src/shared/rpc-types.ts +2 -0
  288. package/src/shared/subagent-runner.ts +12 -3
  289. package/src/shared/tui-config.test.ts +63 -0
  290. package/src/shared/tui-config.ts +67 -39
  291. package/src/tui/data/context-db.ts +12 -0
  292. package/src/tui/index.tsx +87 -17
  293. package/src/tui/slots/sidebar-content.tsx +15 -7
  294. package/dist/features/magic-context/dreamer/queue.d.ts +0 -55
  295. package/dist/features/magic-context/dreamer/queue.d.ts.map +0 -1
  296. package/dist/features/magic-context/dreamer/runner.d.ts +0 -92
  297. package/dist/features/magic-context/dreamer/runner.d.ts.map +0 -1
  298. package/dist/features/magic-context/dreamer/scheduler.d.ts +0 -29
  299. package/dist/features/magic-context/dreamer/scheduler.d.ts.map +0 -1
  300. package/dist/features/magic-context/key-files/aft-availability.d.ts +0 -11
  301. package/dist/features/magic-context/key-files/aft-availability.d.ts.map +0 -1
  302. package/dist/features/magic-context/key-files/identify-key-files.d.ts +0 -84
  303. package/dist/features/magic-context/key-files/identify-key-files.d.ts.map +0 -1
  304. package/dist/features/magic-context/key-files/project-key-files.d.ts +0 -42
  305. package/dist/features/magic-context/key-files/project-key-files.d.ts.map +0 -1
  306. package/dist/features/magic-context/key-files/read-history.d.ts +0 -26
  307. package/dist/features/magic-context/key-files/read-history.d.ts.map +0 -1
  308. package/dist/features/magic-context/key-files/read-stats.d.ts +0 -18
  309. package/dist/features/magic-context/key-files/read-stats.d.ts.map +0 -1
  310. package/dist/features/magic-context/key-files/storage-key-files.d.ts +0 -20
  311. package/dist/features/magic-context/key-files/storage-key-files.d.ts.map +0 -1
  312. package/dist/hooks/magic-context/key-files-block.d.ts +0 -27
  313. package/dist/hooks/magic-context/key-files-block.d.ts.map +0 -1
  314. package/dist/shared/model-requirements.d.ts +0 -26
  315. package/dist/shared/model-requirements.d.ts.map +0 -1
  316. package/src/shared/model-requirements.ts +0 -86
@@ -1,5 +1,5 @@
1
1
  /** @jsxImportSource @opentui/solid */
2
- import { createEffect, createMemo, createSignal, on, onCleanup } from "solid-js"
2
+ import { Show, createEffect, createMemo, createSignal, on, onCleanup } from "solid-js"
3
3
  import type { TuiSlotPlugin, TuiPluginApi, TuiThemeCurrent } from "@opencode-ai/plugin/tui"
4
4
  import packageJson from "../../../package.json"
5
5
  import { loadSidebarSnapshot, type SidebarSnapshot } from "../data/context-db"
@@ -503,6 +503,10 @@ const SidebarContent = (props: {
503
503
  const directory = props.api.state.path.directory ?? ""
504
504
  void loadSidebarSnapshot(sid, directory)
505
505
  .then((data) => {
506
+ // Guard against a session switch while this load was in flight:
507
+ // painting session A's snapshot into the now-active session B shows
508
+ // the wrong session's numbers until B's own refresh resolves.
509
+ if (props.sessionID() !== sid) return
506
510
  setSnapshot(data)
507
511
  try {
508
512
  props.api.renderer.requestRender()
@@ -755,9 +759,11 @@ const SidebarContent = (props: {
755
759
  C:{s()?.compartmentCount ?? 0} Q:{s()?.pendingOpsCount ?? 0} N:{s()?.sessionNoteCount ?? 0}
756
760
  </text>
757
761
  </box>
758
- {s()?.recompProgress && (
759
- <RecompProgressSection theme={props.theme} progress={s()!.recompProgress!} />
760
- )}
762
+ <Show when={s()?.recompProgress}>
763
+ {(progress) => (
764
+ <RecompProgressSection theme={props.theme} progress={progress()} />
765
+ )}
766
+ </Show>
761
767
  </box>
762
768
  )}
763
769
 
@@ -789,9 +795,11 @@ const SidebarContent = (props: {
789
795
  />
790
796
 
791
797
  {/* Recomp / session-upgrade live progress */}
792
- {s()?.recompProgress && (
793
- <RecompProgressSection theme={props.theme} progress={s()!.recompProgress!} />
794
- )}
798
+ <Show when={s()?.recompProgress}>
799
+ {(progress) => (
800
+ <RecompProgressSection theme={props.theme} progress={progress()} />
801
+ )}
802
+ </Show>
795
803
  </>
796
804
  )}
797
805
 
@@ -1,55 +0,0 @@
1
- import type { Database } from "../../../shared/sqlite";
2
- export interface DreamQueueEntry {
3
- id: number;
4
- /** Project identity (e.g. "git:<sha>"), NOT a filesystem path */
5
- projectIdentity: string;
6
- reason: string;
7
- enqueuedAt: number;
8
- startedAt: number | null;
9
- }
10
- export declare function ensureDreamQueueTable(db: Database): void;
11
- export declare function hasActiveDreamLease(db: Database): boolean;
12
- /** Enqueue a project for dreaming. Skips if the same project already has any queue entry (queued or running).
13
- *
14
- * @param force - When true (e.g. manual /ctx-dream), uses the lease TTL (2 min) as the stale threshold
15
- * instead of the full 2-hour max-runtime window. This lets users re-trigger dreaming after a crash or
16
- * restart even when the previous queue entry was started only seconds ago.
17
- */
18
- export declare function enqueueDream(db: Database, projectIdentity: string, reason: string, force?: boolean): DreamQueueEntry | null;
19
- /** Peek at the next unstarted entry without claiming it.
20
- *
21
- * @param projectIdentity - When provided, only matches entries for this project.
22
- * This is critical for cross-process coexistence: each running OpenCode/Pi
23
- * process registers exactly one project, so it must only drain entries that
24
- * belong to it. Without this filter, Pi (running in project A) would dequeue
25
- * queue entries for project B and try to dream B with Pi's runner — which
26
- * either spawns `pi` in a directory that doesn't exist (the `git:<sha>`
27
- * identity string) or, even if it succeeded, runs the wrong harness for that
28
- * project.
29
- */
30
- export declare function peekQueue(db: Database, projectIdentity?: string): DreamQueueEntry | null;
31
- /** Claim the next unstarted entry atomically by marking started_at. Returns null if queue is empty.
32
- *
33
- * @param projectIdentity - When provided, only dequeues entries for this project.
34
- * See `peekQueue` for the cross-process coexistence rationale.
35
- */
36
- export declare function dequeueNext(db: Database, projectIdentity?: string): DreamQueueEntry | null;
37
- /** Remove a completed or failed entry from the queue. */
38
- export declare function removeDreamEntry(db: Database, id: number): void;
39
- /** Reset a dequeued entry so it can be retried (e.g., after lease failure). Increments retry_count. */
40
- export declare function resetDreamEntry(db: Database, id: number): void;
41
- /** Get the retry count for a queue entry. */
42
- export declare function getEntryRetryCount(db: Database, id: number): number;
43
- /**
44
- * Clear stale started entries (stuck for more than maxAgeMs).
45
- *
46
- * Callers MUST gate this on `!hasActiveDreamLease(db)` — a healthy long-running
47
- * dream can exceed `maxAgeMs` while still renewing its lease, and deleting its
48
- * own row mid-run is the bug this guard prevents (mirrors the enqueue path).
49
- *
50
- * `projectIdentity` scopes the delete to one project. The shared `dream_queue`
51
- * is cross-process (OpenCode + Pi); a global delete would reap other hosts'
52
- * still-running rows. Omit only for the legacy "reap any" test path.
53
- */
54
- export declare function clearStaleEntries(db: Database, maxAgeMs: number, projectIdentity?: string): number;
55
- //# sourceMappingURL=queue.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queue.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/queue.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAGvD,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,iEAAiE;IACjE,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAexD;AAED,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,QAAQ,GAAG,OAAO,CASzD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CACxB,EAAE,EAAE,QAAQ,EACZ,eAAe,EAAE,MAAM,EACvB,MAAM,EAAE,MAAM,EACd,KAAK,UAAQ,GACd,eAAe,GAAG,IAAI,CAsCxB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,EAAE,EAAE,QAAQ,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CA4BxF;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,QAAQ,EAAE,eAAe,CAAC,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CAa1F;AAED,yDAAyD;AACzD,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAE/D;AAED,uGAAuG;AACvG,wBAAgB,eAAe,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAI9D;AAED,6CAA6C;AAC7C,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAOnE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAC7B,EAAE,EAAE,QAAQ,EACZ,QAAQ,EAAE,MAAM,EAChB,eAAe,CAAC,EAAE,MAAM,GACzB,MAAM,CAYR"}
@@ -1,92 +0,0 @@
1
- import type { DreamingTask } from "../../../config/schema/magic-context";
2
- import type { PluginContext } from "../../../plugin/types";
3
- import { Database } from "../../../shared/sqlite";
4
- interface ExperimentalPinKeyFilesConfig {
5
- enabled: boolean;
6
- token_budget: number;
7
- min_reads: number;
8
- }
9
- export declare function registerDreamProjectDirectory(projectIdentity: string, directory: string): void;
10
- export interface DreamRunResult {
11
- startedAt: number;
12
- finishedAt: number;
13
- holderId: string;
14
- smartNotesSurfaced: number;
15
- smartNotesPending: number;
16
- tasks: {
17
- name: string;
18
- durationMs: number;
19
- result: unknown;
20
- error?: string;
21
- }[];
22
- }
23
- export declare function runDream(args: {
24
- db: Database;
25
- client: PluginContext["client"];
26
- /** Project identity (e.g. "git:<sha>"), NOT a filesystem path. Used for dream state keys. */
27
- projectIdentity: string;
28
- tasks: DreamingTask[];
29
- taskTimeoutMinutes: number;
30
- maxRuntimeMinutes: number;
31
- parentSessionId?: string;
32
- sessionDirectory?: string;
33
- experimentalUserMemories?: {
34
- enabled: boolean;
35
- promotionThreshold: number;
36
- };
37
- experimentalPinKeyFiles?: ExperimentalPinKeyFilesConfig;
38
- /**
39
- * Resolved fallback chain for dreamer subagent calls. When the primary
40
- * `dreamer.model` fails (auth, model-not-found, rate limit, transient
41
- * network), each entry is tried in order before giving up. Empty/undefined
42
- * disables fallback iteration (legacy single-suggestion-retry only).
43
- *
44
- * Caller (`processDreamQueue` / direct caller) resolves this via
45
- * `resolveFallbackChain(DREAMER_AGENT, config.dreamer.fallback_models)`.
46
- */
47
- fallbackModels?: readonly string[];
48
- }): Promise<DreamRunResult>;
49
- export declare function processDreamQueue(args: {
50
- db: Database;
51
- client: PluginContext["client"];
52
- tasks: DreamingTask[];
53
- taskTimeoutMinutes: number;
54
- maxRuntimeMinutes: number;
55
- experimentalUserMemories?: {
56
- enabled: boolean;
57
- promotionThreshold: number;
58
- };
59
- experimentalPinKeyFiles?: ExperimentalPinKeyFilesConfig;
60
- /**
61
- * Optional project identity filter — when provided, only entries belonging
62
- * to this project are dequeued. Each running OpenCode/Pi process registers
63
- * exactly one project, and the host's dreamer client (and `pi` runner, in
64
- * Pi's case) is project-specific. Without this filter, a Pi process running
65
- * for project A would dequeue queue entries for project B and try to
66
- * `posix_spawn 'pi'` in B's `git:<sha>` identity string as a directory,
67
- * failing with ENOENT every cycle.
68
- *
69
- * Callers should pass this whenever they own a single project — both the
70
- * scheduled timer tick (`sweepProject`) and the `/ctx-dream` command
71
- * handler. Tests pass `undefined` to keep the legacy "dequeue any" semantics.
72
- */
73
- projectIdentity?: string;
74
- /**
75
- * Filesystem directory of the project THIS draining process owns. Because
76
- * project identity collapses worktrees/clones to one `git:<sha>`, resolving
77
- * the execution directory from the shared in-memory map can pick a stale
78
- * sibling checkout ("last-registered wins"). The drain caller always knows
79
- * its own live directory, so passing it here guarantees the dream runs in a
80
- * checkout this process actually registered. Paired with projectIdentity
81
- * (the queue filter), so the dequeued entry is guaranteed to be this
82
- * project's. Falls back to the map (then the identity string) when omitted.
83
- */
84
- sessionDirectoryOverride?: string;
85
- /**
86
- * Resolved Dreamer fallback chain. See `runDream` for semantics. Callers
87
- * compute via `resolveFallbackChain(DREAMER_AGENT, pluginConfig.dreamer?.fallback_models)`.
88
- */
89
- fallbackModels?: readonly string[];
90
- }): Promise<DreamRunResult | null>;
91
- export {};
92
- //# sourceMappingURL=runner.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/runner.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAO3D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAiClD,UAAU,6BAA6B;IACnC,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,6BAA6B,CAAC,eAAe,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAE9F;AAMD,MAAM,WAAW,cAAc;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,KAAK,EAAE;QACH,IAAI,EAAE,MAAM,CAAC;QACb,UAAU,EAAE,MAAM,CAAC;QACnB,MAAM,EAAE,OAAO,CAAC;QAChB,KAAK,CAAC,EAAE,MAAM,CAAC;KAClB,EAAE,CAAC;CACP;AAqED,wBAAsB,QAAQ,CAAC,IAAI,EAAE;IACjC,EAAE,EAAE,QAAQ,CAAC;IACb,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,6FAA6F;IAC7F,eAAe,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,wBAAwB,CAAC,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5E,uBAAuB,CAAC,EAAE,6BAA6B,CAAC;IACxD;;;;;;;;OAQG;IACH,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC,GAAG,OAAO,CAAC,cAAc,CAAC,CAijB1B;AA2OD,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC1C,EAAE,EAAE,QAAQ,CAAC;IACb,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,wBAAwB,CAAC,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5E,uBAAuB,CAAC,EAAE,6BAA6B,CAAC;IACxD;;;;;;;;;;;;OAYG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB;;;;;;;;;OASG;IACH,wBAAwB,CAAC,EAAE,MAAM,CAAC;IAClC;;;OAGG;IACH,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC,GAAG,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAqEjC"}
@@ -1,29 +0,0 @@
1
- import type { Database } from "../../../shared/sqlite";
2
- /** Parse "HH:MM-HH:MM" into start/end minutes since midnight. */
3
- export declare function parseScheduleWindow(schedule: string): {
4
- startMinutes: number;
5
- endMinutes: number;
6
- } | null;
7
- /** Check if the current time is inside the schedule window. Handles overnight windows (e.g. 23:00-05:00). */
8
- export declare function isInScheduleWindow(schedule: string, now?: Date): boolean;
9
- /** Find projects that have memory updates or pending smart notes since their per-project last dream time. */
10
- export declare function findProjectsNeedingDream(db: Database): string[];
11
- /**
12
- * Check schedule and enqueue eligible projects.
13
- * Called periodically from the hook layer (debounced to once per hour).
14
- * Returns the number of projects enqueued.
15
- *
16
- * @param ownProjectIdentity - When provided, restricts enqueue to this project.
17
- * Each running OpenCode/Pi process registers exactly one project, so it
18
- * must only enqueue work for THAT project — otherwise a process running for
19
- * project A would enqueue dream entries for projects B, C, D... that this
20
- * host can't actually drain (it has the wrong client + the wrong
21
- * subagent-runner directory). Without the filter, a Pi process running for
22
- * `opencode-anthropic-auth` ends up trying to spawn `pi --print` for
23
- * `opencode-xtra` (a project Pi was never opened in), failing every cycle.
24
- *
25
- * When undefined, the legacy "enqueue everything that needs a dream"
26
- * behavior is preserved for tests and any future single-host caller.
27
- */
28
- export declare function checkScheduleAndEnqueue(db: Database, schedule: string, ownProjectIdentity?: string): number;
29
- //# sourceMappingURL=scheduler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"scheduler.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/dreamer/scheduler.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAIvD,iEAAiE;AACjE,wBAAgB,mBAAmB,CAC/B,QAAQ,EAAE,MAAM,GACjB;IAAE,YAAY,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CAkBrD;AAaD,6GAA6G;AAC7G,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,GAAE,IAAiB,GAAG,OAAO,CAYpF;AAED,6GAA6G;AAC7G,wBAAgB,wBAAwB,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,EAAE,CAwD/D;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,uBAAuB,CACnC,EAAE,EAAE,QAAQ,EACZ,QAAQ,EAAE,MAAM,EAChB,kBAAkB,CAAC,EAAE,MAAM,GAC5B,MAAM,CAgCR"}
@@ -1,11 +0,0 @@
1
- export interface AftAvailability {
2
- available: boolean;
3
- opencode: boolean;
4
- pi: boolean;
5
- checkedPaths: string[];
6
- }
7
- export declare function getAftAvailability(): AftAvailability;
8
- export declare function isAftAvailable(): boolean;
9
- /** Test-only override for deterministic key-files unit tests. */
10
- export declare function setAftAvailabilityOverride(value: boolean | null): void;
11
- //# sourceMappingURL=aft-availability.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"aft-availability.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/key-files/aft-availability.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,eAAe;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,OAAO,CAAC;IAClB,EAAE,EAAE,OAAO,CAAC;IACZ,YAAY,EAAE,MAAM,EAAE,CAAC;CAC1B;AAsED,wBAAgB,kBAAkB,IAAI,eAAe,CAkDpD;AAED,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAED,iEAAiE;AACjE,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,CAEtE"}
@@ -1,84 +0,0 @@
1
- import type { PluginContext } from "../../../plugin/types";
2
- import type { Database } from "../../../shared/sqlite";
3
- import { bumpKeyFilesVersion } from "./project-key-files";
4
- import { type FileReadStat } from "./read-stats";
5
- export declare const KEY_FILES_SYSTEM_PROMPT = "You are a file importance evaluator. Given read statistics about files in a coding session, identify which are core orientation files worth pinning in context. Return a JSON array.";
6
- /**
7
- * Build the LLM prompt for key file identification.
8
- * Called from the dreamer runner which handles session creation.
9
- */
10
- export declare function buildKeyFilesPrompt(candidates: FileReadStat[], tokenBudget: number, minReads: number): string;
11
- /**
12
- * Parse the LLM's response into a ranked file list.
13
- */
14
- export declare function parseKeyFilesOutput(text: string): Array<{
15
- filePath: string;
16
- tokens: number;
17
- }>;
18
- /**
19
- * Get candidate files for key-file analysis from OpenCode's DB.
20
- * Returns files with full reads >= minReads and size under half the budget.
21
- */
22
- export declare function getKeyFileCandidates(openCodeDb: Database, sessionId: string, minReads: number, tokenBudget: number, projectDirectory?: string): FileReadStat[];
23
- /**
24
- * Apply LLM-ranked results through the knapsack solver and persist.
25
- */
26
- export declare function applyKeyFileResults(db: Database, sessionId: string, llmRanked: Array<{
27
- filePath: string;
28
- tokens: number;
29
- }>, tokenBudget: number, candidatePaths?: Set<string>): {
30
- filesIdentified: number;
31
- totalTokens: number;
32
- };
33
- /**
34
- * Pure heuristic fallback when LLM is unavailable.
35
- * Ranks by: high read count, low edit count, reasonable size.
36
- */
37
- export declare function heuristicKeyFileSelection(db: Database, sessionId: string, candidates: FileReadStat[], tokenBudget: number): {
38
- filesIdentified: number;
39
- totalTokens: number;
40
- };
41
- export interface V6KeyFilesConfig {
42
- enabled: boolean;
43
- token_budget: number;
44
- min_reads: number;
45
- }
46
- export interface ValidatedKeyFilesOutput {
47
- no_change: boolean;
48
- files: Array<{
49
- path: string;
50
- content: string;
51
- approx_token_estimate: number;
52
- local_token_estimate: number;
53
- }>;
54
- }
55
- export declare class KeyFilesValidationError extends Error {
56
- constructor(message: string);
57
- }
58
- export declare function computeGenerationConfigHash(config: Pick<V6KeyFilesConfig, "token_budget" | "min_reads">): string;
59
- export declare function validateLlmOutput(raw: string, config: V6KeyFilesConfig, projectPath: string, candidatePaths?: ReadonlySet<string>): ValidatedKeyFilesOutput;
60
- export declare function commitKeyFiles(args: {
61
- db: Database;
62
- projectPath: string;
63
- validated: ValidatedKeyFilesOutput;
64
- configHash: string;
65
- modelId: string;
66
- leaseHolderId: string;
67
- bumpVersion?: typeof bumpKeyFilesVersion;
68
- }): number | null;
69
- export declare function runKeyFilesTask(args: {
70
- db: Database;
71
- openCodeDb: Database;
72
- client: PluginContext["client"];
73
- projectPath: string;
74
- config: V6KeyFilesConfig;
75
- holderId: string;
76
- deadline: number;
77
- parentSessionId?: string;
78
- fallbackModels?: readonly string[];
79
- }): Promise<{
80
- committedVersion: number | null;
81
- candidates: number;
82
- noChange: boolean;
83
- }>;
84
- //# sourceMappingURL=identify-key-files.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"identify-key-files.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/key-files/identify-key-files.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAO3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAIvD,OAAO,EACH,mBAAmB,EAOtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,KAAK,YAAY,EAAuB,MAAM,cAAc,CAAC;AAGtE,eAAO,MAAM,uBAAuB,yLACsJ,CAAC;AAE3L;;;GAGG;AACH,wBAAgB,mBAAmB,CAC/B,UAAU,EAAE,YAAY,EAAE,EAC1B,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,GACjB,MAAM,CAqCR;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,CAqB7F;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAChC,UAAU,EAAE,QAAQ,EACpB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,gBAAgB,CAAC,EAAE,MAAM,GAC1B,YAAY,EAAE,CAoBhB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAC/B,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,EACtD,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,GAAG,CAAC,MAAM,CAAC,GAC7B;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAelD;AAED;;;GAGG;AACH,wBAAgB,yBAAyB,CACrC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,YAAY,EAAE,EAC1B,WAAW,EAAE,MAAM,GACpB;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAmBlD;AAED,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,uBAAuB;IACpC,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,EAAE,KAAK,CAAC;QACT,IAAI,EAAE,MAAM,CAAC;QACb,OAAO,EAAE,MAAM,CAAC;QAChB,qBAAqB,EAAE,MAAM,CAAC;QAC9B,oBAAoB,EAAE,MAAM,CAAC;KAChC,CAAC,CAAC;CACN;AAED,qBAAa,uBAAwB,SAAQ,KAAK;gBAClC,OAAO,EAAE,MAAM;CAI9B;AAED,wBAAgB,2BAA2B,CACvC,MAAM,EAAE,IAAI,CAAC,gBAAgB,EAAE,cAAc,GAAG,WAAW,CAAC,GAC7D,MAAM,CAER;AA4FD,wBAAgB,iBAAiB,CAC7B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,gBAAgB,EACxB,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,GACrC,uBAAuB,CAsFzB;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE;IACjC,EAAE,EAAE,QAAQ,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,uBAAuB,CAAC;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,OAAO,mBAAmB,CAAC;CAC5C,GAAG,MAAM,GAAG,IAAI,CA6ChB;AA2DD,wBAAsB,eAAe,CAAC,IAAI,EAAE;IACxC,EAAE,EAAE,QAAQ,CAAC;IACb,UAAU,EAAE,QAAQ,CAAC;IACrB,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,gBAAgB,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC,GAAG,OAAO,CAAC;IAAE,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,OAAO,CAAA;CAAE,CAAC,CAmHtF"}
@@ -1,42 +0,0 @@
1
- import type { Database } from "../../../shared/sqlite";
2
- export type KeyFileStaleReason = "missing" | "content_drift";
3
- export interface ProjectKeyFileRow {
4
- projectPath: string;
5
- path: string;
6
- content: string;
7
- contentHash: string;
8
- localTokenEstimate: number;
9
- generatedAt: number;
10
- generatedByModel: string | null;
11
- generationConfigHash: string;
12
- staleReason: KeyFileStaleReason | null;
13
- }
14
- export interface ReplacementKeyFile {
15
- path: string;
16
- content: string;
17
- localTokenEstimate: number;
18
- generatedByModel?: string | null;
19
- generationConfigHash: string;
20
- }
21
- export interface CommitKeyFile {
22
- path: string;
23
- content: string;
24
- localTokenEstimate: number;
25
- }
26
- export interface ResolvedCommitKeyFile extends CommitKeyFile {
27
- contentHash: string;
28
- staleReason: KeyFileStaleReason | null;
29
- }
30
- declare const MISSING_CONTENT_HASH = "<missing>";
31
- export declare function sha256(input: string | Buffer): string;
32
- export declare function resolveProjectPath(directory: string | undefined): string | null;
33
- export declare function readCurrentKeyFiles(db: Database, projectPath: string): ProjectKeyFileRow[];
34
- export declare function getKeyFilesVersion(db: Database, projectPath: string): number;
35
- export declare function bumpKeyFilesVersion(db: Database, projectPath: string): number;
36
- export declare function resolveCommitFiles(projectPath: string, files: CommitKeyFile[]): ResolvedCommitKeyFile[];
37
- export declare function replaceProjectKeyFiles(db: Database, projectPath: string, files: ReplacementKeyFile[], generatedAt?: number): number;
38
- export declare function insertResolvedKeyFiles(db: Database, projectPath: string, files: ResolvedCommitKeyFile[], generatedAt: number, generatedByModel: string | null, generationConfigHash: string): void;
39
- export declare function deleteOrphanProjectKeyFiles(db: Database, now?: number): number;
40
- export declare function isRelativeProjectFile(projectPath: string, relativePath: string): boolean;
41
- export { MISSING_CONTENT_HASH };
42
- //# sourceMappingURL=project-key-files.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"project-key-files.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/key-files/project-key-files.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,eAAe,CAAC;AAE7D,MAAM,WAAW,iBAAiB;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,oBAAoB,EAAE,MAAM,CAAC;IAC7B,WAAW,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAC1C;AAED,MAAM,WAAW,kBAAkB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,oBAAoB,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,aAAa;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,qBAAsB,SAAQ,aAAa;IACxD,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAC1C;AAED,QAAA,MAAM,oBAAoB,cAAc,CAAC;AAGzC,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAO/E;AAiBD,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,iBAAiB,EAAE,CAY1F;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAM5E;AAED,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,CAQ7E;AAED,wBAAgB,kBAAkB,CAC9B,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,aAAa,EAAE,GACvB,qBAAqB,EAAE,CAiBzB;AAED,wBAAgB,sBAAsB,CAClC,EAAE,EAAE,QAAQ,EACZ,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,kBAAkB,EAAE,EAC3B,WAAW,SAAa,GACzB,MAAM,CAsCR;AAED,wBAAgB,sBAAsB,CAClC,EAAE,EAAE,QAAQ,EACZ,WAAW,EAAE,MAAM,EACnB,KAAK,EAAE,qBAAqB,EAAE,EAC9B,WAAW,EAAE,MAAM,EACnB,gBAAgB,EAAE,MAAM,GAAG,IAAI,EAC/B,oBAAoB,EAAE,MAAM,GAC7B,IAAI,CAoBN;AAED,wBAAgB,2BAA2B,CAAC,EAAE,EAAE,QAAQ,EAAE,GAAG,SAAa,GAAG,MAAM,CA6BlF;AAED,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,GAAG,OAAO,CAexF;AAED,OAAO,EAAE,oBAAoB,EAAE,CAAC"}
@@ -1,26 +0,0 @@
1
- import type { Database } from "../../../shared/sqlite";
2
- export interface ReadRange {
3
- start: number;
4
- end: number;
5
- count: number;
6
- lastReadAt: number;
7
- }
8
- export interface KeyFileCandidate {
9
- path: string;
10
- totalReads: number;
11
- rangedReads: number;
12
- fullReads: number;
13
- editCount: number;
14
- latestReadBytes: number;
15
- firstReadAt: number;
16
- lastReadAt: number;
17
- ranges: ReadRange[];
18
- }
19
- export declare function coalesceRanges(ranges: ReadRange[]): ReadRange[];
20
- export declare function collectKeyFileCandidates(args: {
21
- openCodeDb: Database;
22
- magicDb: Database;
23
- projectPath: string;
24
- minReads: number;
25
- }): KeyFileCandidate[];
26
- //# sourceMappingURL=read-history.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"read-history.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/key-files/read-history.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,WAAW,SAAS;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,SAAS,EAAE,CAAC;CACvB;AA6BD,wBAAgB,cAAc,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,SAAS,EAAE,CAe/D;AAiFD,wBAAgB,wBAAwB,CAAC,IAAI,EAAE;IAC3C,UAAU,EAAE,QAAQ,CAAC;IACrB,OAAO,EAAE,QAAQ,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;CACpB,GAAG,gBAAgB,EAAE,CAoGrB"}
@@ -1,18 +0,0 @@
1
- import type { Database } from "../../../shared/sqlite";
2
- export interface FileReadStat {
3
- filePath: string;
4
- fullReadCount: number;
5
- /** Number of times the file was edited (write/edit tool) in this session */
6
- editCount: number;
7
- /** Byte size of the most recent full read output */
8
- latestReadBytes: number;
9
- /** Token count of the most recent full read's output (real Claude tokenizer) */
10
- latestReadTokens: number;
11
- }
12
- /**
13
- * Query file read patterns from OpenCode's DB for a specific session.
14
- * Returns files that were fully read (no line range) at least `minReads` times,
15
- * sorted by read frequency descending.
16
- */
17
- export declare function getSessionReadStats(openCodeDb: Database, sessionId: string, minReads: number): FileReadStat[];
18
- //# sourceMappingURL=read-stats.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"read-stats.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/key-files/read-stats.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,WAAW,YAAY;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,4EAA4E;IAC5E,SAAS,EAAE,MAAM,CAAC;IAClB,oDAAoD;IACpD,eAAe,EAAE,MAAM,CAAC;IACxB,gFAAgF;IAChF,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAED;;;;GAIG;AACH,wBAAgB,mBAAmB,CAC/B,UAAU,EAAE,QAAQ,EACpB,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACjB,YAAY,EAAE,CAsFhB"}
@@ -1,20 +0,0 @@
1
- import type { Database } from "../../../shared/sqlite";
2
- export interface KeyFileEntry {
3
- filePath: string;
4
- /** Approximate token count when last pinned */
5
- tokens: number;
6
- }
7
- /**
8
- * Set the pinned key files for a session.
9
- */
10
- export declare function setKeyFiles(db: Database, sessionId: string, files: KeyFileEntry[]): void;
11
- /**
12
- * Greedy-fit files into a token budget.
13
- * Takes files sorted by priority (dreamer's ranking) and greedily adds
14
- * them until the budget is exhausted. Returns the selected files.
15
- */
16
- export declare function greedyFitFiles(rankedFiles: Array<{
17
- filePath: string;
18
- tokens: number;
19
- }>, tokenBudget: number): KeyFileEntry[];
20
- //# sourceMappingURL=storage-key-files.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage-key-files.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/key-files/storage-key-files.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,WAAW,YAAY;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,GAAG,IAAI,CAYxF;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAC1B,WAAW,EAAE,KAAK,CAAC;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,EACxD,WAAW,EAAE,MAAM,GACpB,YAAY,EAAE,CAehB"}
@@ -1,27 +0,0 @@
1
- import { type KeyFileStaleReason } from "../../features/magic-context/key-files/project-key-files";
2
- import type { SessionMeta } from "../../features/magic-context/types";
3
- import type { Database } from "../../shared/sqlite";
4
- export interface KeyFilesConfigForRender {
5
- enabled: boolean;
6
- tokenBudget: number;
7
- }
8
- interface CacheEntry {
9
- value: string | null;
10
- version: number;
11
- }
12
- export declare const cachedKeyFilesBySession: Map<string, CacheEntry>;
13
- export declare function queueStaleUpdate(projectPath: string, path: string, generatedAtWitness: number, staleReason: KeyFileStaleReason): void;
14
- export declare function flushStaleUpdates(db: Database): number;
15
- export declare function pendingStaleUpdateCount(): number;
16
- export declare function clearKeyFilesCacheForSession(sessionId: string): void;
17
- export declare function buildKeyFilesBlock(db: Database, projectPath: string, config?: KeyFilesConfigForRender): string | null;
18
- export declare function readVersionedKeyFiles(args: {
19
- db: Database;
20
- sessionId: string | undefined;
21
- sessionMeta: SessionMeta;
22
- directory?: string;
23
- isCacheBusting: boolean;
24
- config?: KeyFilesConfigForRender;
25
- }): string | null;
26
- export {};
27
- //# sourceMappingURL=key-files-block.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"key-files-block.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/key-files-block.ts"],"names":[],"mappings":"AAIA,OAAO,EAEH,KAAK,kBAAkB,EAI1B,MAAM,0DAA0D,CAAC;AAClE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oCAAoC,CAAC;AAEtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,WAAW,uBAAuB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,UAAU,UAAU;IAChB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,OAAO,EAAE,MAAM,CAAC;CACnB;AASD,eAAO,MAAM,uBAAuB,yBAAgC,CAAC;AAQrE,wBAAgB,gBAAgB,CAC5B,WAAW,EAAE,MAAM,EACnB,IAAI,EAAE,MAAM,EACZ,kBAAkB,EAAE,MAAM,EAC1B,WAAW,EAAE,kBAAkB,GAChC,IAAI,CAGN;AAED,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,QAAQ,GAAG,MAAM,CA0BtD;AAED,wBAAgB,uBAAuB,IAAI,MAAM,CAEhD;AAED,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAEpE;AASD,wBAAgB,kBAAkB,CAC9B,EAAE,EAAE,QAAQ,EACZ,WAAW,EAAE,MAAM,EACnB,MAAM,GAAE,uBAAgE,GACzE,MAAM,GAAG,IAAI,CAwEf;AAED,wBAAgB,qBAAqB,CAAC,IAAI,EAAE;IACxC,EAAE,EAAE,QAAQ,CAAC;IACb,SAAS,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,uBAAuB,CAAC;CACpC,GAAG,MAAM,GAAG,IAAI,CA2BhB"}
@@ -1,26 +0,0 @@
1
- /**
2
- * Provider-agnostic fallback chain entry.
3
- * Each entry specifies a model and the providers to try in priority order.
4
- * Follows oh-my-opencode's FallbackEntry pattern — `opencode` acts as a
5
- * catch-all proxy provider and is listed last in most entries.
6
- */
7
- export type FallbackEntry = {
8
- providers: string[];
9
- model: string;
10
- variant?: string;
11
- };
12
- export type AgentModelRequirement = {
13
- fallbackChain: FallbackEntry[];
14
- };
15
- export declare const AGENT_MODEL_REQUIREMENTS: Record<string, AgentModelRequirement>;
16
- /**
17
- * Expand a provider-agnostic fallback chain into a flat `provider/model` list
18
- * that OpenCode's agent config accepts as `fallback_models`.
19
- */
20
- export declare function expandFallbackChain(chain: FallbackEntry[]): string[];
21
- /**
22
- * Get the expanded fallback_models list for an agent.
23
- * Returns undefined if no requirement is defined.
24
- */
25
- export declare function getAgentFallbackModels(agent: string): string[] | undefined;
26
- //# sourceMappingURL=model-requirements.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"model-requirements.d.ts","sourceRoot":"","sources":["../../src/shared/model-requirements.ts"],"names":[],"mappings":"AAIA;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GAAG;IACxB,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAChC,aAAa,EAAE,aAAa,EAAE,CAAC;CAClC,CAAC;AAqCF,eAAO,MAAM,wBAAwB,EAAE,MAAM,CAAC,MAAM,EAAE,qBAAqB,CAM1E,CAAC;AAEF;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,MAAM,EAAE,CAQpE;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAI1E"}
@@ -1,86 +0,0 @@
1
- import { DREAMER_AGENT } from "../agents/dreamer";
2
- import { HISTORIAN_AGENT, HISTORIAN_EDITOR_AGENT } from "../agents/historian";
3
- import { SIDEKICK_AGENT } from "../agents/sidekick";
4
-
5
- /**
6
- * Provider-agnostic fallback chain entry.
7
- * Each entry specifies a model and the providers to try in priority order.
8
- * Follows oh-my-opencode's FallbackEntry pattern — `opencode` acts as a
9
- * catch-all proxy provider and is listed last in most entries.
10
- */
11
- export type FallbackEntry = {
12
- providers: string[];
13
- model: string;
14
- variant?: string;
15
- };
16
-
17
- export type AgentModelRequirement = {
18
- fallbackChain: FallbackEntry[];
19
- };
20
-
21
- // Historian: quality matters, single long prompt.
22
- // Copilot first (request-based pricing, ideal for single-prompt background work).
23
- const HISTORIAN_FALLBACK_CHAIN: FallbackEntry[] = [
24
- { providers: ["github-copilot", "anthropic", "opencode"], model: "claude-sonnet-4-6" },
25
- { providers: ["opencode-go"], model: "minimax-m2.7" },
26
- {
27
- providers: ["zai-coding-plan", "bailian-coding-plan", "opencode-go", "opencode"],
28
- model: "glm-5",
29
- },
30
- { providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4" },
31
- { providers: ["google", "github-copilot", "opencode"], model: "gemini-3.1-pro" },
32
- ];
33
-
34
- // Dreamer: runs overnight during idle time, can be slow.
35
- // Copilot first (request-based pricing). Local models also work well here.
36
- const DREAMER_FALLBACK_CHAIN: FallbackEntry[] = [
37
- { providers: ["github-copilot", "anthropic", "opencode"], model: "claude-sonnet-4-6" },
38
- { providers: ["google", "github-copilot", "opencode"], model: "gemini-3-flash" },
39
- {
40
- providers: ["zai-coding-plan", "bailian-coding-plan", "opencode-go", "opencode"],
41
- model: "glm-5",
42
- },
43
- { providers: ["opencode-go"], model: "minimax-m2.7" },
44
- { providers: ["github-copilot", "openai", "opencode"], model: "gpt-5.4-mini" },
45
- ];
46
-
47
- // Sidekick: speed is critical — fast inference providers first.
48
- // No Copilot preference (low token count, request-based pricing doesn't help).
49
- const SIDEKICK_FALLBACK_CHAIN: FallbackEntry[] = [
50
- { providers: ["cerebras"], model: "qwen-3-235b-a22b-instruct-2507" },
51
- { providers: ["google", "github-copilot", "opencode"], model: "gemini-3-flash" },
52
- { providers: ["openai", "github-copilot", "opencode"], model: "gpt-5.4-mini" },
53
- { providers: ["opencode"], model: "gpt-5-nano" },
54
- ];
55
-
56
- export const AGENT_MODEL_REQUIREMENTS: Record<string, AgentModelRequirement> = {
57
- [HISTORIAN_AGENT]: { fallbackChain: HISTORIAN_FALLBACK_CHAIN },
58
- // Editor reuses historian's fallback chain — same input profile (long single prompt).
59
- [HISTORIAN_EDITOR_AGENT]: { fallbackChain: HISTORIAN_FALLBACK_CHAIN },
60
- [DREAMER_AGENT]: { fallbackChain: DREAMER_FALLBACK_CHAIN },
61
- [SIDEKICK_AGENT]: { fallbackChain: SIDEKICK_FALLBACK_CHAIN },
62
- };
63
-
64
- /**
65
- * Expand a provider-agnostic fallback chain into a flat `provider/model` list
66
- * that OpenCode's agent config accepts as `fallback_models`.
67
- */
68
- export function expandFallbackChain(chain: FallbackEntry[]): string[] {
69
- const models: string[] = [];
70
- for (const entry of chain) {
71
- for (const provider of entry.providers) {
72
- models.push(`${provider}/${entry.model}`);
73
- }
74
- }
75
- return models;
76
- }
77
-
78
- /**
79
- * Get the expanded fallback_models list for an agent.
80
- * Returns undefined if no requirement is defined.
81
- */
82
- export function getAgentFallbackModels(agent: string): string[] | undefined {
83
- const requirement = AGENT_MODEL_REQUIREMENTS[agent];
84
- if (!requirement) return undefined;
85
- return expandFallbackChain(requirement.fallbackChain);
86
- }