@cortexkit/opencode-magic-context 0.21.7 → 0.22.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 (214) hide show
  1. package/README.md +116 -325
  2. package/dist/agents/magic-context-prompt.d.ts.map +1 -1
  3. package/dist/agents/permissions.d.ts +29 -14
  4. package/dist/agents/permissions.d.ts.map +1 -1
  5. package/dist/config/index.d.ts.map +1 -1
  6. package/dist/config/migrate-experimental.d.ts +29 -0
  7. package/dist/config/migrate-experimental.d.ts.map +1 -0
  8. package/dist/config/schema/magic-context.d.ts +80 -104
  9. package/dist/config/schema/magic-context.d.ts.map +1 -1
  10. package/dist/features/builtin-commands/commands.d.ts.map +1 -1
  11. package/dist/features/magic-context/compartment-embedding.d.ts +34 -0
  12. package/dist/features/magic-context/compartment-embedding.d.ts.map +1 -0
  13. package/dist/features/magic-context/compartment-events.d.ts +50 -0
  14. package/dist/features/magic-context/compartment-events.d.ts.map +1 -0
  15. package/dist/features/magic-context/compartment-storage.d.ts +22 -0
  16. package/dist/features/magic-context/compartment-storage.d.ts.map +1 -1
  17. package/dist/features/magic-context/dreamer/lease.d.ts.map +1 -1
  18. package/dist/features/magic-context/dreamer/queue.d.ts +13 -2
  19. package/dist/features/magic-context/dreamer/queue.d.ts.map +1 -1
  20. package/dist/features/magic-context/dreamer/runner.d.ts +11 -0
  21. package/dist/features/magic-context/dreamer/runner.d.ts.map +1 -1
  22. package/dist/features/magic-context/dreamer/task-prompts.d.ts +1 -1
  23. package/dist/features/magic-context/dreamer/task-prompts.d.ts.map +1 -1
  24. package/dist/features/magic-context/git-commits/git-log-reader.d.ts.map +1 -1
  25. package/dist/features/magic-context/key-files/identify-key-files.d.ts +1 -1
  26. package/dist/features/magic-context/key-files/identify-key-files.d.ts.map +1 -1
  27. package/dist/features/magic-context/key-files/project-key-files.d.ts.map +1 -1
  28. package/dist/features/magic-context/key-files/read-stats.d.ts +1 -1
  29. package/dist/features/magic-context/key-files/read-stats.d.ts.map +1 -1
  30. package/dist/features/magic-context/memory/constants.d.ts +4 -0
  31. package/dist/features/magic-context/memory/constants.d.ts.map +1 -1
  32. package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
  33. package/dist/features/magic-context/memory/index.d.ts +1 -1
  34. package/dist/features/magic-context/memory/index.d.ts.map +1 -1
  35. package/dist/features/magic-context/memory/memory-migration.d.ts +133 -0
  36. package/dist/features/magic-context/memory/memory-migration.d.ts.map +1 -0
  37. package/dist/features/magic-context/memory/project-identity.d.ts +38 -7
  38. package/dist/features/magic-context/memory/project-identity.d.ts.map +1 -1
  39. package/dist/features/magic-context/memory/storage-memory-fts.d.ts.map +1 -1
  40. package/dist/features/magic-context/memory/storage-memory.d.ts +15 -1
  41. package/dist/features/magic-context/memory/storage-memory.d.ts.map +1 -1
  42. package/dist/features/magic-context/memory/types.d.ts +3 -1
  43. package/dist/features/magic-context/memory/types.d.ts.map +1 -1
  44. package/dist/features/magic-context/message-index.d.ts.map +1 -1
  45. package/dist/features/magic-context/migrations.d.ts +7 -0
  46. package/dist/features/magic-context/migrations.d.ts.map +1 -1
  47. package/dist/features/magic-context/project-docs-hash.d.ts +6 -0
  48. package/dist/features/magic-context/project-docs-hash.d.ts.map +1 -0
  49. package/dist/features/magic-context/project-identity.d.ts +2 -0
  50. package/dist/features/magic-context/project-identity.d.ts.map +1 -0
  51. package/dist/features/magic-context/sidekick/agent.d.ts.map +1 -1
  52. package/dist/features/magic-context/storage-db.d.ts +51 -7
  53. package/dist/features/magic-context/storage-db.d.ts.map +1 -1
  54. package/dist/features/magic-context/storage-historian-runs.d.ts +73 -0
  55. package/dist/features/magic-context/storage-historian-runs.d.ts.map +1 -0
  56. package/dist/features/magic-context/storage-identity-rekey-map.d.ts +11 -0
  57. package/dist/features/magic-context/storage-identity-rekey-map.d.ts.map +1 -0
  58. package/dist/features/magic-context/storage-m0-mutation-log.d.ts +22 -0
  59. package/dist/features/magic-context/storage-m0-mutation-log.d.ts.map +1 -0
  60. package/dist/features/magic-context/storage-memory-mutation-log.d.ts +25 -0
  61. package/dist/features/magic-context/storage-memory-mutation-log.d.ts.map +1 -0
  62. package/dist/features/magic-context/storage-meta-persisted.d.ts +5 -0
  63. package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
  64. package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
  65. package/dist/features/magic-context/storage-meta-shared.d.ts +44 -0
  66. package/dist/features/magic-context/storage-meta-shared.d.ts.map +1 -1
  67. package/dist/features/magic-context/storage-meta.d.ts +2 -1
  68. package/dist/features/magic-context/storage-meta.d.ts.map +1 -1
  69. package/dist/features/magic-context/storage-project-state.d.ts +19 -0
  70. package/dist/features/magic-context/storage-project-state.d.ts.map +1 -0
  71. package/dist/features/magic-context/storage-subagent-invocations.d.ts +61 -0
  72. package/dist/features/magic-context/storage-subagent-invocations.d.ts.map +1 -0
  73. package/dist/features/magic-context/storage-tags.d.ts +21 -1
  74. package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
  75. package/dist/features/magic-context/storage-v22-backfill-failures.d.ts +24 -0
  76. package/dist/features/magic-context/storage-v22-backfill-failures.d.ts.map +1 -0
  77. package/dist/features/magic-context/storage.d.ts +13 -3
  78. package/dist/features/magic-context/storage.d.ts.map +1 -1
  79. package/dist/features/magic-context/subagent-token-capture.d.ts +33 -0
  80. package/dist/features/magic-context/subagent-token-capture.d.ts.map +1 -0
  81. package/dist/features/magic-context/tagger.d.ts +15 -1
  82. package/dist/features/magic-context/tagger.d.ts.map +1 -1
  83. package/dist/features/magic-context/types.d.ts +21 -0
  84. package/dist/features/magic-context/types.d.ts.map +1 -1
  85. package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
  86. package/dist/features/magic-context/user-memory/storage-user-memory.d.ts.map +1 -1
  87. package/dist/features/magic-context/v22-deferred-backfill.d.ts +46 -0
  88. package/dist/features/magic-context/v22-deferred-backfill.d.ts.map +1 -0
  89. package/dist/features/magic-context/work-metrics.d.ts +79 -0
  90. package/dist/features/magic-context/work-metrics.d.ts.map +1 -0
  91. package/dist/hooks/auto-update-checker/cache.d.ts.map +1 -1
  92. package/dist/hooks/auto-update-checker/checker.d.ts.map +1 -1
  93. package/dist/hooks/magic-context/cache-busting-signals.d.ts +9 -0
  94. package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -1
  95. package/dist/hooks/magic-context/command-handler.d.ts +13 -1
  96. package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
  97. package/dist/hooks/magic-context/compartment-parser.d.ts +25 -0
  98. package/dist/hooks/magic-context/compartment-parser.d.ts.map +1 -1
  99. package/dist/hooks/magic-context/compartment-prompt.d.ts +27 -16
  100. package/dist/hooks/magic-context/compartment-prompt.d.ts.map +1 -1
  101. package/dist/hooks/magic-context/compartment-runner-historian.d.ts +2 -0
  102. package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
  103. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
  104. package/dist/hooks/magic-context/compartment-runner-mapping.d.ts +6 -2
  105. package/dist/hooks/magic-context/compartment-runner-mapping.d.ts.map +1 -1
  106. package/dist/hooks/magic-context/compartment-runner-partial-recomp.d.ts.map +1 -1
  107. package/dist/hooks/magic-context/compartment-runner-recomp.d.ts +9 -1
  108. package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
  109. package/dist/hooks/magic-context/compartment-runner-types.d.ts +68 -4
  110. package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
  111. package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
  112. package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
  113. package/dist/hooks/magic-context/decay-curve.d.ts +78 -0
  114. package/dist/hooks/magic-context/decay-curve.d.ts.map +1 -0
  115. package/dist/hooks/magic-context/decay-render.d.ts +67 -0
  116. package/dist/hooks/magic-context/decay-render.d.ts.map +1 -0
  117. package/dist/hooks/magic-context/event-handler.d.ts +1 -1
  118. package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
  119. package/dist/hooks/magic-context/event-resolvers.d.ts +17 -0
  120. package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
  121. package/dist/hooks/magic-context/execute-status.d.ts.map +1 -1
  122. package/dist/hooks/magic-context/historian-prompt.generated.d.ts +2 -0
  123. package/dist/hooks/magic-context/historian-prompt.generated.d.ts.map +1 -0
  124. package/dist/hooks/magic-context/hook-handlers.d.ts +3 -0
  125. package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
  126. package/dist/hooks/magic-context/hook.d.ts +9 -21
  127. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  128. package/dist/hooks/magic-context/inject-compartments.d.ts +126 -0
  129. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
  130. package/dist/hooks/magic-context/key-files-block.d.ts.map +1 -1
  131. package/dist/hooks/magic-context/live-session-state.d.ts +9 -0
  132. package/dist/hooks/magic-context/live-session-state.d.ts.map +1 -1
  133. package/dist/hooks/magic-context/m0-token-breakdown.d.ts +35 -0
  134. package/dist/hooks/magic-context/m0-token-breakdown.d.ts.map +1 -0
  135. package/dist/hooks/magic-context/read-session-chunk.d.ts +9 -0
  136. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  137. package/dist/hooks/magic-context/read-session-db.d.ts +7 -0
  138. package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
  139. package/dist/hooks/magic-context/recomp-orchestrator.d.ts +104 -0
  140. package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -0
  141. package/dist/hooks/magic-context/reference-retrieval.d.ts +61 -0
  142. package/dist/hooks/magic-context/reference-retrieval.d.ts.map +1 -0
  143. package/dist/hooks/magic-context/reference-seeds.generated.d.ts +8 -0
  144. package/dist/hooks/magic-context/reference-seeds.generated.d.ts.map +1 -0
  145. package/dist/hooks/magic-context/send-session-notification.d.ts +1 -1
  146. package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -1
  147. package/dist/hooks/magic-context/system-prompt-hash.d.ts +5 -6
  148. package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
  149. package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
  150. package/dist/hooks/magic-context/tokenizer-calibration.d.ts +6 -0
  151. package/dist/hooks/magic-context/tokenizer-calibration.d.ts.map +1 -1
  152. package/dist/hooks/magic-context/transform-compartment-phase.d.ts +0 -7
  153. package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
  154. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +18 -0
  155. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  156. package/dist/hooks/magic-context/transform.d.ts +9 -7
  157. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  158. package/dist/hooks/magic-context/upgrade-reminder.d.ts +73 -0
  159. package/dist/hooks/magic-context/upgrade-reminder.d.ts.map +1 -0
  160. package/dist/index.d.ts.map +1 -1
  161. package/dist/index.js +22111 -16352
  162. package/dist/plugin/conflict-warning-hook.d.ts +13 -0
  163. package/dist/plugin/conflict-warning-hook.d.ts.map +1 -1
  164. package/dist/plugin/dream-timer.d.ts.map +1 -1
  165. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  166. package/dist/plugin/messages-transform.d.ts.map +1 -1
  167. package/dist/plugin/rpc-handlers.d.ts.map +1 -1
  168. package/dist/plugin/tool-registry.d.ts.map +1 -1
  169. package/dist/shared/announcement.d.ts +1 -1
  170. package/dist/shared/announcement.d.ts.map +1 -1
  171. package/dist/shared/rpc-client.d.ts +1 -0
  172. package/dist/shared/rpc-client.d.ts.map +1 -1
  173. package/dist/shared/rpc-notifications.d.ts +27 -5
  174. package/dist/shared/rpc-notifications.d.ts.map +1 -1
  175. package/dist/shared/rpc-server.d.ts +1 -0
  176. package/dist/shared/rpc-server.d.ts.map +1 -1
  177. package/dist/shared/rpc-types.d.ts +32 -2
  178. package/dist/shared/rpc-types.d.ts.map +1 -1
  179. package/dist/shared/rpc-utils.d.ts +9 -0
  180. package/dist/shared/rpc-utils.d.ts.map +1 -1
  181. package/dist/shared/sqlite-helpers.d.ts +7 -7
  182. package/dist/shared/sqlite.d.ts +23 -14
  183. package/dist/shared/sqlite.d.ts.map +1 -1
  184. package/dist/shared/subagent-runner.d.ts +5 -0
  185. package/dist/shared/subagent-runner.d.ts.map +1 -1
  186. package/dist/shared/tag-transcript.d.ts +10 -1
  187. package/dist/shared/tag-transcript.d.ts.map +1 -1
  188. package/dist/tools/ctx-expand/tools.d.ts +5 -1
  189. package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
  190. package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
  191. package/dist/tui/data/context-db.d.ts +16 -1
  192. package/dist/tui/data/context-db.d.ts.map +1 -1
  193. package/package.json +2 -4
  194. package/src/shared/announcement.ts +6 -7
  195. package/src/shared/rpc-client.test.ts +49 -2
  196. package/src/shared/rpc-client.ts +19 -9
  197. package/src/shared/rpc-notifications.test.ts +54 -1
  198. package/src/shared/rpc-notifications.ts +82 -13
  199. package/src/shared/rpc-server.ts +33 -4
  200. package/src/shared/rpc-types.ts +32 -2
  201. package/src/shared/rpc-utils.ts +10 -0
  202. package/src/shared/sqlite-helpers.ts +9 -9
  203. package/src/shared/sqlite.ts +99 -80
  204. package/src/shared/subagent-runner.ts +14 -0
  205. package/src/shared/tag-transcript.test.ts +280 -0
  206. package/src/shared/tag-transcript.ts +162 -33
  207. package/src/tui/data/context-db.ts +77 -11
  208. package/src/tui/index.tsx +240 -57
  209. package/src/tui/slots/sidebar-content.tsx +415 -101
  210. package/dist/hooks/magic-context/compartment-runner-compressor.d.ts +0 -87
  211. package/dist/hooks/magic-context/compartment-runner-compressor.d.ts.map +0 -1
  212. package/dist/shared/native-binding.d.ts +0 -87
  213. package/dist/shared/native-binding.d.ts.map +0 -1
  214. package/src/shared/native-binding.ts +0 -311
@@ -21,6 +21,19 @@ export declare function cleanupConflictWarnings(client: unknown, directory: stri
21
21
  * Sends an ignored message that auto-deletes after 1 second.
22
22
  */
23
23
  export declare function sendTuiSetupNotification(client: unknown, directory: string, serverUrl?: string): Promise<void>;
24
+ /**
25
+ * Desktop schema-fence warning. When OpenCode and Pi share context.db and one
26
+ * harness auto-updates first, it migrates the DB to a newer schema; the lagging
27
+ * harness then fail-closes and disables ALL of Magic Context. Previously this
28
+ * was log-only, so the user just saw the plugin silently stop working. Surface
29
+ * a clear ignored message telling them what happened and how to fix it. No
30
+ * auto-remove: this is a real blocking state the user must act on (update the
31
+ * lagging harness), unlike the transient TUI-setup notice.
32
+ */
33
+ export declare function sendSchemaFenceWarning(client: unknown, directory: string, detail: {
34
+ persistedVersion: number;
35
+ supportedVersion: number;
36
+ }): Promise<void>;
24
37
  /**
25
38
  * Desktop startup announcement: post a one-shot ignored message describing
26
39
  * what's new in this release. Mirrors the TUI's RPC-driven dialog path so both
@@ -1 +1 @@
1
- {"version":3,"file":"conflict-warning-hook.d.ts","sourceRoot":"","sources":["../../src/plugin/conflict-warning-hook.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAoLlE;;GAEG;AACH,wBAAsB,mBAAmB,CACrC,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,MAAM,EACjB,cAAc,EAAE,cAAc,GAC/B,OAAO,CAAC,IAAI,CAAC,CA+Cf;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,CACzC,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAqHf;AAkCD;;;GAGG;AACH,wBAAsB,wBAAwB,CAC1C,MAAM,EAAE,OAAO,EACf,SAAS,EAAE,MAAM,EACjB,SAAS,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,IAAI,CAAC,CAkEf;AAED;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CACzC,MA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M,EACd,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,GACpC,OAAO,CAAC,IAAI,CAAC,CA8Df"}
@@ -1 +1 @@
1
- {"version":3,"file":"dream-timer.d.ts","sourceRoot":"","sources":["../../src/plugin/dream-timer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAapE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7C;;;;;GAKG;AACH,UAAU,mBAAmB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,wBAAwB,CAAC,EAAE;QAAE,OAAO,EAAE,OAAO,CAAC;QAAC,kBAAkB,EAAE,MAAM,CAAA;KAAE,CAAC;IAC5E,uBAAuB,CAAC,EAAE;QACtB,OAAO,EAAE,OAAO,CAAC;QACjB,YAAY,EAAE,MAAM,CAAC;QACrB,SAAS,EAAE,MAAM,CAAC;KACrB,CAAC;IACF,iBAAiB,CAAC,EAAE;QAChB,OAAO,EAAE,OAAO,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,WAAW,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,gBAAgB,EAAE,CAAC,SAAS,EAAE,MAAM,EAAE,EAAE,EAAE,QAAQ,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACxE;AAQD;;;;;;;;;;GAUG;AACH,wBAAsB,uBAAuB,CACzC,IAAI,EAAE,mBAAmB,GAC1B,OAAO,CAAC,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC,CA4DnC"}
1
+ {"version":3,"file":"dream-timer.d.ts","sourceRoot":"","sources":["../../src/plugin/dream-timer.ts"],"names":[],"mappings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AAU,CAAC;AAE9C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,aAAa,CAAC;IACnB,YAAY,EAAE,wBAAwB,CAAC;IACvC,gBAAgB,EAAE,gBAAgB,CAAC;CACtC;;;;;;qBAoDkuJ,CAAC;;;;;;;;;;;;qBAA9sC,CAAC;mBAAyB,CAAC;iBAAuB,CAAC;iBAAuB,CAAC;0BAAc,CAAC;uBAAiB,CAAC;;;;;;0BAA+luB,CAAC;;;;;;EADju1B"}
1
+ {"version":3,"file":"create-session-hooks.d.ts","sourceRoot":"","sources":["../../../src/plugin/hooks/create-session-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAU7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAE9C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,aAAa,CAAC;IACnB,YAAY,EAAE,wBAAwB,CAAC;IACvC,gBAAgB,EAAE,gBAAgB,CAAC;CACtC;;;;;;qBAwD25F,CAAC;;;;;;;;;;;;qBAA+f,CAAC;mBAAyB,CAAC;iBAAuB,CAAC;iBAAuB,CAAC;0BAAc,CAAC;uBAAiB,CAAC;;;;;;0BAA+8zB,CAAC;;;;;;EADv96B"}
@@ -1 +1 @@
1
- {"version":3,"file":"messages-transform.d.ts","sourceRoot":"","sources":["../../src/plugin/messages-transform.ts"],"names":[],"mappings":"AAWA,KAAK,gBAAgB,GAAG;IACpB,IAAI,EAAE,OAAO,kBAAkB,EAAE,OAAO,CAAC;IACzC,KAAK,EAAE,OAAO,kBAAkB,EAAE,IAAI,EAAE,CAAC;CAC5C,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAA;CAAE,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE;IACjD,YAAY,EAAE;QACV,sCAAsC,CAAC,EAAE,CACrC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAC5B,MAAM,EAAE,uBAAuB,KAC9B,OAAO,CAAC,IAAI,CAAC,CAAC;KACtB,GAAG,IAAI,CAAC;CACZ,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,uBAAuB,KAAK,OAAO,CAAC,IAAI,CAAC,CAiDnF"}
1
+ {"version":3,"file":"messages-transform.d.ts","sourceRoot":"","sources":["../../src/plugin/messages-transform.ts"],"names":[],"mappings":"AAWA,KAAK,gBAAgB,GAAG;IACpB,IAAI,EAAE,OAAO,kBAAkB,EAAE,OAAO,CAAC;IACzC,KAAK,EAAE,OAAO,kBAAkB,EAAE,IAAI,EAAE,CAAC;CAC5C,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAA;CAAE,CAAC;AAEhE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AACH,wBAAgB,8BAA8B,CAAC,IAAI,EAAE;IACjD,YAAY,EAAE;QACV,sCAAsC,CAAC,EAAE,CACrC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAC5B,MAAM,EAAE,uBAAuB,KAC9B,OAAO,CAAC,IAAI,CAAC,CAAC;KACtB,GAAG,IAAI,CAAC;CACZ,GAAG,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,uBAAuB,KAAK,OAAO,CAAC,IAAI,CAAC,CAoDnF"}
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-handlers.d.ts","sourceRoot":"","sources":["../../src/plugin/rpc-handlers.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE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aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,aAAa,CAAC;IACnB,YAAY,EAAE,wBAAwB,CAAC;CAC1C,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAyEjC"}
1
+ {"version":3,"file":"tool-registry.d.ts","sourceRoot":"","sources":["../../src/plugin/tool-registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAiB1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAE7C,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,aAAa,CAAC;IACnB,YAAY,EAAE,wBAAwB,CAAC;CAC1C,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CA6EjC"}
@@ -18,7 +18,7 @@
18
18
  * Bump only when there are user-visible changes worth a startup dialog.
19
19
  * Does NOT need to match the published package version.
20
20
  */
21
- export declare const ANNOUNCEMENT_VERSION = "0.21.7";
21
+ export declare const ANNOUNCEMENT_VERSION = "0.22.0";
22
22
  /**
23
23
  * Short, user-facing bullet strings. Keep each line ~80 chars or shorter so the
24
24
  * TUI dialog renders cleanly without horizontal scroll on a typical terminal.
@@ -1 +1 @@
1
- {"version":3,"file":"announcement.d.ts","sourceRoot":"","sources":["../../src/shared/announcement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH;;;GAGG;AACH,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC,MAAM,CAOvD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,qDAAqD,CAAC;AAQtF;;;;;;GAMG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAQjD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAS1D;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAGhD"}
1
+ {"version":3,"file":"announcement.d.ts","sourceRoot":"","sources":["../../src/shared/announcement.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH;;;GAGG;AACH,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,aAAa,CAAC,MAAM,CAMvD,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,qDAAqD,CAAC;AAQtF;;;;;;GAMG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAQjD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAS1D;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,IAAI,OAAO,CAGhD"}
@@ -1,5 +1,6 @@
1
1
  export declare class MagicContextRpcClient {
2
2
  private port;
3
+ private token;
3
4
  private portDir;
4
5
  private legacyPortFilePath;
5
6
  private healthChecked;
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-client.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-client.ts"],"names":[],"mappings":"AAiBA,qBAAa,qBAAqB;IAC9B,OAAO,CAAC,IAAI,CAAuB;IACnC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,aAAa,CAAS;gBAElB,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAKjD,iFAAiF;IAC3E,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACrC,OAAO,CAAC,CAAC,CAAC;IAiDb,4CAA4C;IACtC,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;YASvB,WAAW;IAkCzB,OAAO,CAAC,YAAY;YA4BN,WAAW;YAWX,gBAAgB;IAU9B,KAAK,IAAI,IAAI;CAIhB"}
1
+ {"version":3,"file":"rpc-client.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-client.ts"],"names":[],"mappings":"AAiBA,qBAAa,qBAAqB;IAC9B,OAAO,CAAC,IAAI,CAAuB;IACnC,OAAO,CAAC,KAAK,CAAuB;IACpC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,kBAAkB,CAAS;IACnC,OAAO,CAAC,aAAa,CAAS;gBAElB,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM;IAKjD,iFAAiF;IAC3E,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAClC,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GACrC,OAAO,CAAC,CAAC,CAAC;IAwDb,4CAA4C;IACtC,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;YASvB,WAAW;IAmCzB,OAAO,CAAC,YAAY;YA4BN,WAAW;YAWX,gBAAgB;IAU9B,KAAK,IAAI,IAAI;CAKhB"}
@@ -15,10 +15,32 @@ export interface RpcNotification {
15
15
  /** Push a notification for TUI to pick up via polling. */
16
16
  export declare function pushNotification(type: string, payload: Record<string, unknown>, sessionId?: string): void;
17
17
  /** Return pending notifications after acking the client's last received id.
18
- * Updates lastDrainAt so isTuiConnected() reflects recent activity. */
19
- export declare function drainNotifications(lastReceivedId?: number): RpcNotification[];
18
+ * Updates lastDrainAt so isTuiConnected() reflects recent activity.
19
+ *
20
+ * Session scoping: when `sessionId` is provided, only notifications tagged for
21
+ * that session (or session-less/global ones) are returned and pruned — a
22
+ * notification tagged for a DIFFERENT session is never handed to this client
23
+ * and is never pruned by this client's ack. This matters because the in-memory
24
+ * queue is per-process but a TUI can end up draining a process that also serves
25
+ * OTHER sessions: e.g. opening OpenCode Desktop on the same project starts a
26
+ * newer RPC server that the TUI's port discovery (newest-pid-wins) then selects,
27
+ * so a Desktop-session upgrade-dialog action would otherwise surface in an
28
+ * unrelated TUI session. Each client also tracks its own `lastReceivedId`, so a
29
+ * global watermark prune would let session A's ack drop session B's still-unseen
30
+ * notification — scoping the prune to the acking session prevents that too.
31
+ *
32
+ * Delivery is at-least-once (non-destructive return + prune-on-ack): a returned
33
+ * notification stays queued until a later call acks it via a higher
34
+ * `lastReceivedId`, so a lost poll response re-delivers on the next poll. */
35
+ export declare function drainNotifications(lastReceivedId?: number, sessionId?: string): RpcNotification[];
20
36
  /** Whether a TUI client is actively polling for notifications.
21
- * Returns true only if the TUI has drained within the last 3 seconds.
22
- * This prevents stale-connected state after TUI closes or disconnects. */
23
- export declare function isTuiConnected(): boolean;
37
+ * Returns true only if a TUI has drained within the last 3 seconds.
38
+ *
39
+ * Pass `sessionId` (preferred) to ask whether a TUI is polling FOR THAT
40
+ * SESSION — this is what producers (`/ctx-status`, `/ctx-recomp`, the upgrade
41
+ * reminder) must use to decide dialog-vs-message, so a TUI on a different
42
+ * session in the same process does not misroute their delivery. Omit it only
43
+ * for legacy/global callers that genuinely have no session context; they fall
44
+ * back to "any session recently drained" (the pre-per-session behavior). */
45
+ export declare function isTuiConnected(sessionId?: string): boolean;
24
46
  //# sourceMappingURL=rpc-notifications.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-notifications.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAUD,0DAA0D;AAC1D,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,CAAC,EAAE,MAAM,GACnB,IAAI,CAMN;AAED;wEACwE;AACxE,wBAAgB,kBAAkB,CAAC,cAAc,SAAI,GAAG,eAAe,EAAE,CAMxE;AAED;;2EAE2E;AAC3E,wBAAgB,cAAc,IAAI,OAAO,CAExC"}
1
+ {"version":3,"file":"rpc-notifications.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-notifications.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,MAAM,WAAW,eAAe;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACjC,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAsBD,0DAA0D;AAC1D,wBAAgB,gBAAgB,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAChC,SAAS,CAAC,EAAE,MAAM,GACnB,IAAI,CAwBN;AAED;;;;;;;;;;;;;;;;;8EAiB8E;AAC9E,wBAAgB,kBAAkB,CAAC,cAAc,SAAI,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,eAAe,EAAE,CAkB5F;AAED;;;;;;;;6EAQ6E;AAC7E,wBAAgB,cAAc,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAO1D"}
@@ -6,6 +6,7 @@ export declare class MagicContextRpcServer {
6
6
  private portFilePath;
7
7
  private portDir;
8
8
  private startedAt;
9
+ private readonly token;
9
10
  constructor(storageDir: string, directory: string);
10
11
  /** Register an RPC method handler. */
11
12
  handle(method: string, handler: RpcHandler): void;
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-server.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-server.ts"],"names":[],"mappings":"AAaA,KAAK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OAAO,EAAE,UAAU,GAAG,IAAI;IAIjD,6DAA6D;IACvD,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC;IA2D9B,OAAO,CAAC,uBAAuB;IAgB/B,8CAA8C;IAC9C,IAAI,IAAI,IAAI;IAYZ,OAAO,CAAC,QAAQ;CA0EnB"}
@@ -23,10 +23,23 @@ export interface SidebarSnapshot {
23
23
  compartmentTokens: number;
24
24
  factTokens: number;
25
25
  memoryTokens: number;
26
+ /**
27
+ * Token estimate of the injected <project-docs> block (root ARCHITECTURE.md
28
+ * + STRUCTURE.md) that lives in m[0] in v2. Part of the message stream, not
29
+ * conversation. Display layer shows this as "Docs".
30
+ */
31
+ docsTokens: number;
32
+ /**
33
+ * Token estimate of the injected <user-profile> block (promoted user
34
+ * memories) that lives in m[0] in v2. Part of the message stream, not
35
+ * conversation. Display layer shows this as "Profile".
36
+ */
37
+ profileTokens: number;
26
38
  /**
27
39
  * Token estimate of real user/assistant discussion (text + reasoning +
28
- * image parts) inside messages, excluding injected <session-history>
29
- * blocks. Display layer shows this as "Conversation".
40
+ * image parts) inside messages, excluding injected <session-history>,
41
+ * <project-docs>, and <user-profile> blocks. Display layer shows this as
42
+ * "Conversation".
30
43
  */
31
44
  conversationTokens: number;
32
45
  /**
@@ -54,6 +67,23 @@ export interface SidebarSnapshot {
54
67
  * scheduler and transform paths.
55
68
  */
56
69
  executeThreshold: number;
70
+ newWorkTokens?: number | null;
71
+ totalInputTokens?: number | null;
72
+ /**
73
+ * Live recomp / session-upgrade progress for this session, or null when no
74
+ * recomp is running (and no recent terminal state is being shown). Drives the
75
+ * sidebar "Recomp"/"Upgrade" progress bar and the /ctx-status dialog. Mirrors
76
+ * the runtime `RecompProgress` shape from compartment-runner-types.ts.
77
+ */
78
+ recompProgress?: {
79
+ phase: "recomp" | "migration" | "done" | "failed";
80
+ processedMessages: number;
81
+ totalMessages: number;
82
+ passCount: number;
83
+ compartmentsCreated: number;
84
+ message?: string;
85
+ note?: string;
86
+ } | null;
57
87
  }
58
88
  export interface StatusDetail extends SidebarSnapshot {
59
89
  tagCounter: number;
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-types.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-types.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,eAAe;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,gBAAgB,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,gBAAgB,EAAE,OAAO,CAAC;IAC1B,qBAAqB,EAAE,OAAO,CAAC;IAC/B,gBAAgB,EAAE,MAAM,CAAC;IACzB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,iBAAiB,EAAE,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB;;;;OAIG;IACH,kBAAkB,EAAE,MAAM,CAAC;IAC3B;;;;OAIG;IACH,cAAc,EAAE,MAAM,CAAC;IACvB;;;;;;;OAOG;IACH,oBAAoB,EAAE,MAAM,CAAC;IAC7B;;;;;;;;OAQG;IACH,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,YAAa,SAAQ,eAAe;IACjD,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,C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ord {
2
2
  port: number;
3
3
  pid: number;
4
4
  started_at: number;
5
+ /**
6
+ * Per-process bearer token. The server requires it on all non-health RPC
7
+ * calls so a random local process or browser-origin script that merely
8
+ * discovers/guesses the port cannot drive side-effecting endpoints
9
+ * (recomp/upgrade/dismiss). Optional in the type for forward/backward
10
+ * compatibility with port files written by older builds (treated as "no
11
+ * auth required" only when the server itself didn't set one).
12
+ */
13
+ token?: string;
5
14
  }
6
15
  /**
7
16
  * Stable hash for a project directory — scopes RPC port files per-project
@@ -1 +1 @@
1
- {"version":3,"file":"rpc-utils.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-utils.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED,0EAA0E;AAC1E,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAExE;AAED,sCAAsC;AACtC,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,SAAc,GAAG,MAAM,CAEhG;AAED,2DAA2D;AAC3D,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEnF;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAQ/C;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,SAAI,GAAG,iBAAiB,GAAG,IAAI,CAwB3F"}
1
+ {"version":3,"file":"rpc-utils.d.ts","sourceRoot":"","sources":["../../src/shared/rpc-utils.ts"],"names":[],"mappings":"AAGA,MAAM,WAAW,iBAAiB;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,UAAU,EAAE,MAAM,CAAC;IACnB;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAGrD;AAED,0EAA0E;AAC1E,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAExE;AAED,sCAAsC;AACtC,wBAAgB,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,SAAc,GAAG,MAAM,CAEhG;AAED,2DAA2D;AAC3D,wBAAgB,qBAAqB,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAEnF;AAED,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAQ/C;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,SAAI,GAAG,iBAAiB,GAAG,IAAI,CAyB3F"}
@@ -1,16 +1,16 @@
1
1
  /**
2
- * Cross-runtime helpers that smooth over the small bun:sqlite ↔ better-sqlite3
3
- * API differences without leaking either library into call sites.
2
+ * Cross-runtime helpers that smooth over the small bun:sqlite ↔ node:sqlite
3
+ * API differences without leaking either backend into call sites.
4
4
  */
5
5
  import type { Database } from "./sqlite";
6
6
  /**
7
7
  * Close a database, ignoring errors.
8
8
  *
9
- * bun:sqlite supports `db.close(throwOnError = false)`. better-sqlite3 has
10
- * only `db.close()` and throws on already-closed databases. This helper
11
- * mirrors the bun "swallow errors" semantics for both runtimes — useful in
12
- * test teardown and `finally` blocks where the caller doesn't care whether
13
- * the close succeeded.
9
+ * bun:sqlite supports `db.close(throwOnError = false)`. node:sqlite has only
10
+ * `db.close()` and throws ("database is not open") on an already-closed
11
+ * handle. This helper mirrors the bun "swallow errors" semantics for both
12
+ * runtimes — useful in test teardown and `finally` blocks where the caller
13
+ * doesn't care whether the close succeeded.
14
14
  */
15
15
  export declare function closeQuietly(db: Database | null | undefined): void;
16
16
  //# sourceMappingURL=sqlite-helpers.d.ts.map
@@ -3,27 +3,36 @@
3
3
  *
4
4
  * The same shipped plugin artifact must run under two different runtimes:
5
5
  * - Bun (current OpenCode releases) → uses `bun:sqlite` (built-in, fast)
6
- * - Node (OpenCode beta + future Pi plugin) → uses `better-sqlite3`
6
+ * - Node / Electron (Pi plugin, OpenCode Desktop) → uses `node:sqlite`
7
+ * (`DatabaseSync`, built into Node 22.5+ / Electron 41+, stable-enough and
8
+ * flag-free since Node 22.13/23.4).
7
9
  *
8
- * Bun cannot load `better-sqlite3` (oven-sh/bun#4290), and Node has no
9
- * `bun:sqlite` module. Static imports of either would crash at parse time
10
- * in the wrong runtime, so we use dynamic imports gated by runtime detection.
10
+ * Bun has no `node:sqlite`, and Node/Electron have no `bun:sqlite`. Static
11
+ * imports of either would crash at parse time in the wrong runtime, so we use
12
+ * dynamic imports gated by runtime detection.
11
13
  *
12
- * The Function-constructor wrapper around `import()` defeats bundler static
13
- * analysis without it, esbuild/bun build would try to resolve both modules
14
- * during the bundle step, including the one that doesn't exist in the build
15
- * runtime.
14
+ * Why `node:sqlite` instead of `better-sqlite3`: better-sqlite3 is a native
15
+ * module requiring per-ABI prebuilds, and Electron's ABI never matches the npm
16
+ * Node prebuild which forced a runtime download of an Electron-matched
17
+ * `.node` binary (a supply-chain + maintenance liability). `node:sqlite` is
18
+ * built into the runtime, so there is NOTHING to download or rebuild. Both Pi
19
+ * (plain Node 24) and OpenCode Desktop (Electron 41 → Node 24.14.1) ship it.
16
20
  *
17
- * Both libraries expose ~95% API parity:
18
- * - new Database(path, { readonly?: boolean })
21
+ * API surface we use (common across both backends, modulo the shims below):
22
+ * - new Database(path, { readonly?: boolean }) ← we map readonly→readOnly
19
23
  * - db.prepare(sql).run/get/all
20
24
  * - db.exec(multistatement)
21
- * - db.transaction(fn) → wrapped function
25
+ * - db.transaction(fn) → wrapped function ← shimmed for node:sqlite
22
26
  * - db.close()
23
27
  *
24
- * The 5% that differs (db.query, db.run, db.close(boolean), Database.open)
25
- * is either rewritten to common-subset patterns or hidden behind the helpers
26
- * in `./sqlite-helpers.ts`.
28
+ * The two backend differences we bridge for node:sqlite:
29
+ * 1. node:sqlite has no `db.transaction(fn)` helper we add a savepoint-aware
30
+ * shim (below) that matches better-sqlite3/bun semantics.
31
+ * 2. node:sqlite's constructor option is `readOnly` (camel-case), not
32
+ * better-sqlite3/bun's `readonly` — we translate it so call sites are
33
+ * unchanged.
34
+ * Everything else (named params with bare keys, ATTACH under defensive mode,
35
+ * `run()` → {changes,lastInsertRowid}) is identical and was verified directly.
27
36
  */
28
37
  import type BetterSqlite3 from "better-sqlite3";
29
38
  export declare const Database: typeof BetterSqlite3;
@@ -1 +1 @@
1
- {"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/shared/sqlite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAMH,OAAO,KAAK,aAAa,MAAM,gBAAgB,CAAC;AAsFhD,eAAO,MAAM,QAAQ,EAAE,OAAO,aAA4B,CAAC;AAE3D,+DAA+D;AAC/D,MAAM,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC;AAE9C;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC"}
1
+ {"version":3,"file":"sqlite.d.ts","sourceRoot":"","sources":["../../src/shared/sqlite.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAMH,OAAO,KAAK,aAAa,MAAM,gBAAgB,CAAC;AAgGhD,eAAO,MAAM,QAAQ,EAAE,OAAO,aAA4B,CAAC;AAE3D,+DAA+D;AAC/D,MAAM,MAAM,QAAQ,GAAG,aAAa,CAAC,QAAQ,CAAC;AAE9C;;;;;;;;;GASG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAAC"}
@@ -88,6 +88,11 @@ export interface SubagentRunOptions {
88
88
  * runner's hot path. Errors are swallowed.
89
89
  */
90
90
  onProgress?: (event: SubagentProgressEvent) => void;
91
+ /** Optional token accounting metadata. When present, harness runners persist subagent_invocations. */
92
+ accountingSessionId?: string | undefined;
93
+ accountingSubagent?: "historian" | "historian_editor" | "compressor" | "dreamer" | "sidekick" | "user_memory_review" | "recomp" | undefined;
94
+ accountingTask?: string | null | undefined;
95
+ accountingParentInvocationId?: number | null | undefined;
91
96
  }
92
97
  /**
93
98
  * Progress events emitted by a runner during a run. Distinct from the final
@@ -1 +1 @@
1
- {"version":3,"file":"subagent-runner.d.ts","sourceRoot":"","sources":["../../src/shared/subagent-runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,WAAW,kBAAkB;IAC/B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,GAAG,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,MAAM,CAAC,EAAE,WAAW,GAAG,SAAS,CAAC;IACjC;;;;;;;;;OASG;IACH,aAAa,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEnC;;;;;;;;;OASG;IACH,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;CACvD;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,MAA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c,GACd,eAAe,GACf,cAAc,GACd,cAAc,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC,CAAC;AAER;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC3B,yEAAyE;IACzE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB;;;;;;OAMG;IACH,GAAG,CAAC,OAAO,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;CAChE"}
@@ -45,7 +45,7 @@
45
45
  * - Tag prefix primitives (`prependTag`, `stripTagPrefix`, `byteSize`).
46
46
  */
47
47
  import type { ContextDatabase } from "../features/magic-context/storage";
48
- import type { Tagger } from "../features/magic-context/tagger";
48
+ import { type Tagger } from "../features/magic-context/tagger";
49
49
  import type { TagTarget } from "../hooks/magic-context/tag-messages";
50
50
  import type { Transcript } from "./transcript";
51
51
  export interface TagTranscriptOptions {
@@ -58,6 +58,15 @@ export interface TagTranscriptOptions {
58
58
  * consistent across passes.
59
59
  */
60
60
  skipPrefixInjection?: boolean;
61
+ /**
62
+ * Pi-only: map of messageId → raw-message fingerprint. When a NEW message
63
+ * text tag is created, its fingerprint is persisted on the tag row so a
64
+ * later pass can adopt the fallback-id tag onto the real SessionEntry id
65
+ * (keeping tag_number/§N§ stable). OpenCode omits this → tags store NULL
66
+ * → adoption never fires. Keyed by the bare messageId (not the `:pN`
67
+ * contentId) since all parts of a message share one fingerprint.
68
+ */
69
+ entryFingerprintByMessageId?: ReadonlyMap<string, string>;
61
70
  }
62
71
  export interface TagTranscriptResult {
63
72
  targets: Map<number, TagTarget>;
@@ -1 +1 @@
1
- {"version":3,"file":"tag-transcript.d.ts","sourceRoot":"","sources":["../../src/shared/tag-transcript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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;AAyDD,wBAAgB,aAAa,CACzB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,eAAe,EACnB,OAAO,GAAE,oBAAyB,GACnC,mBAAmB,CA8MrB"}
@@ -1,3 +1,7 @@
1
1
  import { type ToolDefinition } from "@opencode-ai/plugin";
2
- export declare function createCtxExpandTools(): Record<string, ToolDefinition>;
2
+ import type { ContextDatabase } from "../../features/magic-context/storage";
3
+ export interface CtxExpandToolDeps {
4
+ db: ContextDatabase;
5
+ }
6
+ export declare function createCtxExpandTools(deps: CtxExpandToolDeps): Record<string, ToolDefinition>;
3
7
  //# sourceMappingURL=tools.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-expand/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAqDhE,wBAAgB,oBAAoB,IAAI,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAIrE"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-expand/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAEhE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AAK5E,MAAM,WAAW,iBAAiB;IAC9B,EAAE,EAAE,eAAe,CAAC;CACvB;AA8DD,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAI5F"}
@@ -1 +1 @@
1
- {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-memory/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AAyBhE,OAAO,EAIH,KAAK,iBAAiB,EACzB,MAAM,SAAS,CAAC;AA+djB,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAI5F"}
1
+ {"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../../../src/tools/ctx-memory/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAQ,MAAM,qBAAqB,CAAC;AA4BhE,OAAO,EAIH,KAAK,iBAAiB,EACzB,MAAM,SAAS,CAAC;AAyjBjB,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAI5F"}
@@ -2,6 +2,7 @@ import type { SidebarSnapshot, StatusDetail } from "../../shared/rpc-types";
2
2
  export type { SidebarSnapshot, StatusDetail };
3
3
  /** Initialize the RPC client. Call once on TUI startup. */
4
4
  export declare function initRpcClient(directory: string): void;
5
+ export declare function getRpcGeneration(): number;
5
6
  /** Clean up the RPC client. */
6
7
  export declare function closeRpc(): void;
7
8
  /** Fetch sidebar snapshot from the server via RPC. */
@@ -12,7 +13,15 @@ export declare function loadStatusDetail(sessionId: string, directory: string, m
12
13
  export declare function getCompartmentCount(sessionId: string): Promise<number>;
13
14
  /** Send recomp request to server via RPC. */
14
15
  export declare function requestRecomp(sessionId: string): Promise<boolean>;
16
+ /** Run `/ctx-session-upgrade` for the session (full recomp + once-per-project
17
+ * memory migration). Fired from the upgrade dialog's "Run upgrade now" action. */
18
+ export declare function requestUpgrade(sessionId: string): Promise<boolean>;
19
+ /** Mark the upgrade reminder dismissed (the user made an explicit Confirm/Cancel
20
+ * choice), setting the durable stamp so the FRESH dialog won't re-show. Resume
21
+ * prompts are staging-driven and unaffected. */
22
+ export declare function dismissUpgradeReminder(sessionId: string): Promise<boolean>;
15
23
  export interface TuiMessage {
24
+ id: number;
16
25
  type: string;
17
26
  payload: Record<string, unknown>;
18
27
  sessionId?: string;
@@ -32,5 +41,11 @@ export declare function getAnnouncement(): Promise<AnnouncementResponse>;
32
41
  /** Mark the current ANNOUNCEMENT_VERSION as dismissed on the server. */
33
42
  export declare function markAnnounced(): Promise<boolean>;
34
43
  /** Poll for pending server→TUI notifications via RPC. */
35
- export declare function consumeTuiMessages(): Promise<TuiMessage[]>;
44
+ export declare function consumeTuiMessages(sessionId: string): Promise<TuiMessage[]>;
45
+ /**
46
+ * Advance the delivered-message cursor for one active TUI session.
47
+ * Callers must pass only the contiguous handled prefix of the drained batch;
48
+ * this helper remains empty-safe and monotonic for that prefix.
49
+ */
50
+ export declare function markTuiMessagesHandled(sessionId: string, messages: TuiMessage[]): void;
36
51
  //# sourceMappingURL=context-db.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"context-db.d.ts","sourceRoot":"","sources":["../../../src/tui/data/context-db.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAA0B,eAAe,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAEpG,YAAY,EAAE,eAAe,EAAE,YAAY,EAAE,CAAC;AAc9C,2DAA2D;AAC3D,wBAAgB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAGrD;AAED,+BAA+B;AAC/B,wBAAgB,QAAQ,IAAI,IAAI,CAI/B;AAwFD,sDAAsD;AACtD,wBAAsB,mBAAmB,CACrC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,GAClB,OAAO,CAAC,eAAe,CAAC,CA4B1B;AAED,wDAAwD;AACxD,wBAAsB,gBAAgB,CAClC,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,QAAQ,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,YAAY,CAAC,CA4CvB;AAED,qCAAqC;AACrC,wBAAsB,mBAAmB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAQ5E;AAED,6CAA6C;AAC7C,wBAAsB,aAAa,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,OA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  "description": "OpenCode plugin for Magic Context — cross-session memory and context management",
6
6
  "main": "dist/index.js",
@@ -29,7 +29,7 @@
29
29
  "README.md"
30
30
  ],
31
31
  "scripts": {
32
- "build": "bun build src/index.ts --outdir dist --target node --format esm --external @opencode-ai/plugin --external @huggingface/transformers --external onnxruntime-web --external better-sqlite3 --external bun:sqlite && tsc --emitDeclarationOnly",
32
+ "build": "bun build src/index.ts --outdir dist --target node --format esm --external @opencode-ai/plugin --external @huggingface/transformers --external onnxruntime-web --external bun:sqlite --external node:sqlite && tsc --emitDeclarationOnly",
33
33
  "typecheck": "tsc --noEmit && tsc -p tsconfig.scripts.json",
34
34
  "test": "bun test",
35
35
  "lint": "biome check .",
@@ -44,9 +44,7 @@
44
44
  "@opencode-ai/plugin": "^1.14.39",
45
45
  "@opencode-ai/sdk": "^1.14.39",
46
46
  "ai-tokenizer": "^1.0.6",
47
- "better-sqlite3": "^12.9.0",
48
47
  "comment-json": "^4.2.5",
49
- "nanotar": "^0.3.0",
50
48
  "zod": "^4.1.8"
51
49
  },
52
50
  "devDependencies": {
@@ -23,19 +23,18 @@ import { getMagicContextStorageDir } from "./data-path";
23
23
  * Bump only when there are user-visible changes worth a startup dialog.
24
24
  * Does NOT need to match the published package version.
25
25
  */
26
- export const ANNOUNCEMENT_VERSION = "0.21.7";
26
+ export const ANNOUNCEMENT_VERSION = "0.22.0";
27
27
 
28
28
  /**
29
29
  * Short, user-facing bullet strings. Keep each line ~80 chars or shorter so the
30
30
  * TUI dialog renders cleanly without horizontal scroll on a typical terminal.
31
31
  */
32
32
  export const ANNOUNCEMENT_FEATURES: ReadonlyArray<string> = [
33
- "Pi parity sweep: 44 audit findings fixed, including a critical SHIP-BLOCKER where /ctx-flush did not drain the pending Pi compaction queue.",
34
- "Pi historian recovery fix: empty/no-op historian returns now clear emergency recovery so sessions cannot loop forever at 95%.",
35
- "trimPiMessagesToBoundary now sweeps non-contiguous tool-result orphans, fixing provider 400s after compaction in long Pi sessions.",
36
- "Hidden subagent tool isolation: historian, dreamer, and sidekick can no longer spawn subagents or run unsafe tools.",
37
- "TUI sidebar and /ctx-status header now show execute threshold inline: '47.5% / 65%' on the left, '475K / 1.0M' on the right.",
38
- "doctor --issue now caps GitHub issue bodies at ~60KB with a dedicated 'Recent errors' section so reports stay submittable.",
33
+ "NOW ON BY DEFAULT Temporal awareness: the agent sees elapsed-time markers (e.g. +2h 15m) between messages and dated compartments, so it knows how long ago things happened. Opt out with temporal_awareness: false.",
34
+ "NOW ON BY DEFAULT — Auto-search hints: each turn a background ctx_search whispers a compact 'vague recall' when something relevant exists in your memories, past conversation, or git history. No full content injected. Opt out with memory.auto_search.enabled: false.",
35
+ "Experimental features graduated to stable config: temporal_awareness and caveman_text_compression are now top-level keys; auto_search and git_commit_indexing moved under memory.* . Run `doctor` to migrate old experimental.* settings (your opt-ins/opt-outs are preserved).",
36
+ "git_commit_indexing (make project history semantically searchable) stays opt-in enable with memory.git_commit_indexing.enabled: true.",
37
+ "Audit hardening across both harnesses: memory config-bypass fix, supersede-delta cache-stability fixes, and dashboard correctness fixes.",
39
38
  ];
40
39
 
41
40
  /**
@@ -1,10 +1,11 @@
1
1
  import { afterEach, describe, expect, test } from "bun:test";
2
- import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
2
+ import { mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
3
3
  import { createServer } from "node:http";
4
4
  import { tmpdir } from "node:os";
5
5
  import { dirname, join } from "node:path";
6
6
  import { MagicContextRpcClient } from "./rpc-client";
7
- import { rpcPortFilePath } from "./rpc-utils";
7
+ import { MagicContextRpcServer } from "./rpc-server";
8
+ import { parseRpcPortFile, rpcPortFilePath } from "./rpc-utils";
8
9
 
9
10
  interface TestServer {
10
11
  port: number;
@@ -116,6 +117,52 @@ describe("MagicContextRpcClient", () => {
116
117
  expect(await client.call<{ value: string }>("value")).toEqual({ value: "second" });
117
118
  });
118
119
 
120
+ test("authenticates against a real server with the published token", async () => {
121
+ const storageDir = makeTempDir();
122
+ const directory = "/repo-auth";
123
+ const server = new MagicContextRpcServer(storageDir, directory);
124
+ server.handle("ping", async () => ({ pong: true }));
125
+ await server.start();
126
+ try {
127
+ const client = new MagicContextRpcClient(storageDir, directory);
128
+ // Real round-trip: client must read the token from the port file and
129
+ // send it as Bearer auth, or the server returns 401.
130
+ expect(await client.call<{ pong: boolean }>("ping")).toEqual({ pong: true });
131
+ } finally {
132
+ server.stop();
133
+ }
134
+ });
135
+
136
+ test("a request without the token is rejected 401 by the server", async () => {
137
+ const storageDir = makeTempDir();
138
+ const directory = "/repo-noauth";
139
+ const server = new MagicContextRpcServer(storageDir, directory);
140
+ server.handle("ping", async () => ({ pong: true }));
141
+ const port = await server.start();
142
+ try {
143
+ // Sanity: the port file carries a non-empty token.
144
+ const record = parseRpcPortFile(
145
+ readFileSync(rpcPortFilePath(storageDir, directory), "utf-8"),
146
+ );
147
+ expect(typeof record?.token).toBe("string");
148
+ expect((record?.token ?? "").length).toBeGreaterThan(0);
149
+
150
+ // A raw fetch with no Authorization header must be rejected.
151
+ const res = await fetch(`http://127.0.0.1:${port}/rpc/ping`, {
152
+ method: "POST",
153
+ headers: { "Content-Type": "application/json" },
154
+ body: "{}",
155
+ });
156
+ expect(res.status).toBe(401);
157
+
158
+ // Health stays open (no token required) for discovery.
159
+ const health = await fetch(`http://127.0.0.1:${port}/health`);
160
+ expect(health.status).toBe(200);
161
+ } finally {
162
+ server.stop();
163
+ }
164
+ });
165
+
119
166
  test("gives up when the port file points at a dead server", async () => {
120
167
  const storageDir = makeTempDir();
121
168
  const directory = "/repo";