@cortexkit/opencode-magic-context 0.21.8 → 0.22.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (223) hide show
  1. package/README.md +124 -323
  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/agent-overrides.d.ts.map +1 -1
  9. package/dist/config/schema/magic-context.d.ts +95 -104
  10. package/dist/config/schema/magic-context.d.ts.map +1 -1
  11. package/dist/features/builtin-commands/commands.d.ts.map +1 -1
  12. package/dist/features/magic-context/compartment-embedding.d.ts +34 -0
  13. package/dist/features/magic-context/compartment-embedding.d.ts.map +1 -0
  14. package/dist/features/magic-context/compartment-events.d.ts +50 -0
  15. package/dist/features/magic-context/compartment-events.d.ts.map +1 -0
  16. package/dist/features/magic-context/compartment-storage.d.ts +22 -0
  17. package/dist/features/magic-context/compartment-storage.d.ts.map +1 -1
  18. package/dist/features/magic-context/dreamer/lease.d.ts.map +1 -1
  19. package/dist/features/magic-context/dreamer/queue.d.ts +13 -2
  20. package/dist/features/magic-context/dreamer/queue.d.ts.map +1 -1
  21. package/dist/features/magic-context/dreamer/runner.d.ts +11 -0
  22. package/dist/features/magic-context/dreamer/runner.d.ts.map +1 -1
  23. package/dist/features/magic-context/dreamer/task-prompts.d.ts +1 -1
  24. package/dist/features/magic-context/dreamer/task-prompts.d.ts.map +1 -1
  25. package/dist/features/magic-context/git-commits/git-log-reader.d.ts.map +1 -1
  26. package/dist/features/magic-context/key-files/identify-key-files.d.ts +1 -1
  27. package/dist/features/magic-context/key-files/identify-key-files.d.ts.map +1 -1
  28. package/dist/features/magic-context/key-files/project-key-files.d.ts.map +1 -1
  29. package/dist/features/magic-context/key-files/read-stats.d.ts +1 -1
  30. package/dist/features/magic-context/key-files/read-stats.d.ts.map +1 -1
  31. package/dist/features/magic-context/memory/constants.d.ts +4 -0
  32. package/dist/features/magic-context/memory/constants.d.ts.map +1 -1
  33. package/dist/features/magic-context/memory/embedding-identity.d.ts.map +1 -1
  34. package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
  35. package/dist/features/magic-context/memory/embedding-openai.d.ts +6 -0
  36. package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -1
  37. package/dist/features/magic-context/memory/embedding-probe.d.ts +5 -0
  38. package/dist/features/magic-context/memory/embedding-probe.d.ts.map +1 -1
  39. package/dist/features/magic-context/memory/embedding.d.ts.map +1 -1
  40. package/dist/features/magic-context/memory/index.d.ts +1 -1
  41. package/dist/features/magic-context/memory/index.d.ts.map +1 -1
  42. package/dist/features/magic-context/memory/memory-migration.d.ts +133 -0
  43. package/dist/features/magic-context/memory/memory-migration.d.ts.map +1 -0
  44. package/dist/features/magic-context/memory/project-identity.d.ts +38 -7
  45. package/dist/features/magic-context/memory/project-identity.d.ts.map +1 -1
  46. package/dist/features/magic-context/memory/storage-memory-fts.d.ts.map +1 -1
  47. package/dist/features/magic-context/memory/storage-memory.d.ts +15 -1
  48. package/dist/features/magic-context/memory/storage-memory.d.ts.map +1 -1
  49. package/dist/features/magic-context/memory/types.d.ts +3 -1
  50. package/dist/features/magic-context/memory/types.d.ts.map +1 -1
  51. package/dist/features/magic-context/message-index.d.ts.map +1 -1
  52. package/dist/features/magic-context/migrations.d.ts +7 -0
  53. package/dist/features/magic-context/migrations.d.ts.map +1 -1
  54. package/dist/features/magic-context/project-docs-hash.d.ts +6 -0
  55. package/dist/features/magic-context/project-docs-hash.d.ts.map +1 -0
  56. package/dist/features/magic-context/project-identity.d.ts +2 -0
  57. package/dist/features/magic-context/project-identity.d.ts.map +1 -0
  58. package/dist/features/magic-context/storage-db.d.ts +51 -7
  59. package/dist/features/magic-context/storage-db.d.ts.map +1 -1
  60. package/dist/features/magic-context/storage-historian-runs.d.ts +73 -0
  61. package/dist/features/magic-context/storage-historian-runs.d.ts.map +1 -0
  62. package/dist/features/magic-context/storage-identity-rekey-map.d.ts +11 -0
  63. package/dist/features/magic-context/storage-identity-rekey-map.d.ts.map +1 -0
  64. package/dist/features/magic-context/storage-m0-mutation-log.d.ts +22 -0
  65. package/dist/features/magic-context/storage-m0-mutation-log.d.ts.map +1 -0
  66. package/dist/features/magic-context/storage-memory-mutation-log.d.ts +25 -0
  67. package/dist/features/magic-context/storage-memory-mutation-log.d.ts.map +1 -0
  68. package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
  69. package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
  70. package/dist/features/magic-context/storage-meta-shared.d.ts +44 -0
  71. package/dist/features/magic-context/storage-meta-shared.d.ts.map +1 -1
  72. package/dist/features/magic-context/storage-meta.d.ts +1 -0
  73. package/dist/features/magic-context/storage-meta.d.ts.map +1 -1
  74. package/dist/features/magic-context/storage-project-state.d.ts +19 -0
  75. package/dist/features/magic-context/storage-project-state.d.ts.map +1 -0
  76. package/dist/features/magic-context/storage-subagent-invocations.d.ts +9 -0
  77. package/dist/features/magic-context/storage-subagent-invocations.d.ts.map +1 -1
  78. package/dist/features/magic-context/storage-tags.d.ts +21 -1
  79. package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
  80. package/dist/features/magic-context/storage-v22-backfill-failures.d.ts +24 -0
  81. package/dist/features/magic-context/storage-v22-backfill-failures.d.ts.map +1 -0
  82. package/dist/features/magic-context/storage.d.ts +12 -3
  83. package/dist/features/magic-context/storage.d.ts.map +1 -1
  84. package/dist/features/magic-context/subagent-token-capture.d.ts +1 -1
  85. package/dist/features/magic-context/subagent-token-capture.d.ts.map +1 -1
  86. package/dist/features/magic-context/tagger.d.ts +15 -1
  87. package/dist/features/magic-context/tagger.d.ts.map +1 -1
  88. package/dist/features/magic-context/types.d.ts +21 -0
  89. package/dist/features/magic-context/types.d.ts.map +1 -1
  90. package/dist/features/magic-context/user-memory/review-user-memories.d.ts.map +1 -1
  91. package/dist/features/magic-context/user-memory/storage-user-memory.d.ts.map +1 -1
  92. package/dist/features/magic-context/v22-deferred-backfill.d.ts +46 -0
  93. package/dist/features/magic-context/v22-deferred-backfill.d.ts.map +1 -0
  94. package/dist/features/magic-context/work-metrics.d.ts +66 -0
  95. package/dist/features/magic-context/work-metrics.d.ts.map +1 -1
  96. package/dist/hooks/auto-update-checker/cache.d.ts.map +1 -1
  97. package/dist/hooks/auto-update-checker/checker.d.ts.map +1 -1
  98. package/dist/hooks/magic-context/cache-busting-signals.d.ts +9 -0
  99. package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -1
  100. package/dist/hooks/magic-context/command-handler.d.ts +13 -1
  101. package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
  102. package/dist/hooks/magic-context/compartment-parser.d.ts +25 -0
  103. package/dist/hooks/magic-context/compartment-parser.d.ts.map +1 -1
  104. package/dist/hooks/magic-context/compartment-prompt.d.ts +27 -16
  105. package/dist/hooks/magic-context/compartment-prompt.d.ts.map +1 -1
  106. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
  107. package/dist/hooks/magic-context/compartment-runner-mapping.d.ts +6 -2
  108. package/dist/hooks/magic-context/compartment-runner-mapping.d.ts.map +1 -1
  109. package/dist/hooks/magic-context/compartment-runner-partial-recomp.d.ts.map +1 -1
  110. package/dist/hooks/magic-context/compartment-runner-recomp.d.ts +9 -1
  111. package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
  112. package/dist/hooks/magic-context/compartment-runner-types.d.ts +67 -4
  113. package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
  114. package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
  115. package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
  116. package/dist/hooks/magic-context/decay-curve.d.ts +78 -0
  117. package/dist/hooks/magic-context/decay-curve.d.ts.map +1 -0
  118. package/dist/hooks/magic-context/decay-render.d.ts +67 -0
  119. package/dist/hooks/magic-context/decay-render.d.ts.map +1 -0
  120. package/dist/hooks/magic-context/event-handler.d.ts +1 -1
  121. package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
  122. package/dist/hooks/magic-context/event-resolvers.d.ts +17 -0
  123. package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
  124. package/dist/hooks/magic-context/execute-status.d.ts.map +1 -1
  125. package/dist/hooks/magic-context/historian-prompt.generated.d.ts +2 -0
  126. package/dist/hooks/magic-context/historian-prompt.generated.d.ts.map +1 -0
  127. package/dist/hooks/magic-context/hook-handlers.d.ts +3 -0
  128. package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
  129. package/dist/hooks/magic-context/hook.d.ts +9 -21
  130. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  131. package/dist/hooks/magic-context/inject-compartments.d.ts +126 -0
  132. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
  133. package/dist/hooks/magic-context/key-files-block.d.ts.map +1 -1
  134. package/dist/hooks/magic-context/live-session-state.d.ts +9 -0
  135. package/dist/hooks/magic-context/live-session-state.d.ts.map +1 -1
  136. package/dist/hooks/magic-context/m0-token-breakdown.d.ts +35 -0
  137. package/dist/hooks/magic-context/m0-token-breakdown.d.ts.map +1 -0
  138. package/dist/hooks/magic-context/read-session-chunk.d.ts +9 -0
  139. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  140. package/dist/hooks/magic-context/read-session-db.d.ts +7 -0
  141. package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
  142. package/dist/hooks/magic-context/recomp-orchestrator.d.ts +104 -0
  143. package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -0
  144. package/dist/hooks/magic-context/reference-retrieval.d.ts +61 -0
  145. package/dist/hooks/magic-context/reference-retrieval.d.ts.map +1 -0
  146. package/dist/hooks/magic-context/reference-seeds.generated.d.ts +8 -0
  147. package/dist/hooks/magic-context/reference-seeds.generated.d.ts.map +1 -0
  148. package/dist/hooks/magic-context/send-session-notification.d.ts +1 -1
  149. package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -1
  150. package/dist/hooks/magic-context/system-prompt-hash.d.ts +5 -6
  151. package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
  152. package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
  153. package/dist/hooks/magic-context/tokenizer-calibration.d.ts +6 -0
  154. package/dist/hooks/magic-context/tokenizer-calibration.d.ts.map +1 -1
  155. package/dist/hooks/magic-context/transform-compartment-phase.d.ts +0 -7
  156. package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
  157. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +18 -0
  158. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  159. package/dist/hooks/magic-context/transform.d.ts +9 -7
  160. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  161. package/dist/hooks/magic-context/upgrade-reminder.d.ts +73 -0
  162. package/dist/hooks/magic-context/upgrade-reminder.d.ts.map +1 -0
  163. package/dist/index.d.ts.map +1 -1
  164. package/dist/index.js +9435 -4001
  165. package/dist/plugin/conflict-warning-hook.d.ts +13 -0
  166. package/dist/plugin/conflict-warning-hook.d.ts.map +1 -1
  167. package/dist/plugin/dream-timer.d.ts.map +1 -1
  168. package/dist/plugin/event.d.ts +10 -0
  169. package/dist/plugin/event.d.ts.map +1 -1
  170. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  171. package/dist/plugin/messages-transform.d.ts.map +1 -1
  172. package/dist/plugin/rpc-handlers.d.ts.map +1 -1
  173. package/dist/plugin/tool-registry.d.ts.map +1 -1
  174. package/dist/shared/announcement.d.ts +17 -1
  175. package/dist/shared/announcement.d.ts.map +1 -1
  176. package/dist/shared/models-dev-cache.d.ts.map +1 -1
  177. package/dist/shared/rpc-client.d.ts +1 -0
  178. package/dist/shared/rpc-client.d.ts.map +1 -1
  179. package/dist/shared/rpc-notifications.d.ts +27 -5
  180. package/dist/shared/rpc-notifications.d.ts.map +1 -1
  181. package/dist/shared/rpc-server.d.ts +1 -0
  182. package/dist/shared/rpc-server.d.ts.map +1 -1
  183. package/dist/shared/rpc-types.d.ts +30 -2
  184. package/dist/shared/rpc-types.d.ts.map +1 -1
  185. package/dist/shared/rpc-utils.d.ts +9 -0
  186. package/dist/shared/rpc-utils.d.ts.map +1 -1
  187. package/dist/shared/sqlite-helpers.d.ts +7 -7
  188. package/dist/shared/sqlite.d.ts +23 -14
  189. package/dist/shared/sqlite.d.ts.map +1 -1
  190. package/dist/shared/tag-transcript.d.ts +10 -1
  191. package/dist/shared/tag-transcript.d.ts.map +1 -1
  192. package/dist/tools/ctx-expand/tools.d.ts +5 -1
  193. package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
  194. package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
  195. package/dist/tui/data/context-db.d.ts +16 -1
  196. package/dist/tui/data/context-db.d.ts.map +1 -1
  197. package/package.json +5 -7
  198. package/src/shared/announcement.test.ts +23 -7
  199. package/src/shared/announcement.ts +30 -8
  200. package/src/shared/conflict-detector.test.ts +15 -2
  201. package/src/shared/conflict-fixer.test.ts +5 -1
  202. package/src/shared/models-dev-cache.test.ts +72 -4
  203. package/src/shared/models-dev-cache.ts +47 -8
  204. package/src/shared/opencode-compaction-detector.test.ts +10 -2
  205. package/src/shared/rpc-client.test.ts +54 -3
  206. package/src/shared/rpc-client.ts +19 -9
  207. package/src/shared/rpc-notifications.test.ts +54 -1
  208. package/src/shared/rpc-notifications.ts +82 -13
  209. package/src/shared/rpc-server.ts +33 -4
  210. package/src/shared/rpc-types.ts +30 -2
  211. package/src/shared/rpc-utils.ts +10 -0
  212. package/src/shared/sqlite-helpers.ts +9 -9
  213. package/src/shared/sqlite.ts +99 -80
  214. package/src/shared/tag-transcript.test.ts +280 -0
  215. package/src/shared/tag-transcript.ts +162 -33
  216. package/src/tui/data/context-db.ts +75 -11
  217. package/src/tui/index.tsx +223 -32
  218. package/src/tui/slots/sidebar-content.tsx +366 -34
  219. package/dist/hooks/magic-context/compartment-runner-compressor.d.ts +0 -87
  220. package/dist/hooks/magic-context/compartment-runner-compressor.d.ts.map +0 -1
  221. package/dist/shared/native-binding.d.ts +0 -87
  222. package/dist/shared/native-binding.d.ts.map +0 -1
  223. package/src/shared/native-binding.ts +0 -311
@@ -19,7 +19,14 @@ export interface Tagger {
19
19
  * Tool tags MUST use {@link assignToolTag}; the `type` parameter
20
20
  * here is narrowed at compile time to forbid `"tool"`.
21
21
  */
22
- assignTag(sessionId: string, messageId: string, type: NonToolTagType, byteSize: number, db: Database, reasoningByteSize?: number, toolName?: string | null, inputByteSize?: number): number;
22
+ assignTag(sessionId: string, messageId: string, type: NonToolTagType, byteSize: number, db: Database, reasoningByteSize?: number, toolName?: string | null, inputByteSize?: number,
23
+ /**
24
+ * Pi-only: fingerprint of the raw message this tag is created for,
25
+ * persisted on the tag row so a later pass can adopt a fallback-id tag
26
+ * onto the real SessionEntry id. OpenCode passes undefined → column
27
+ * stays NULL → no behavior change.
28
+ */
29
+ entryFingerprint?: string | null): number;
23
30
  /**
24
31
  * Look up the tag number for a non-tool entity.
25
32
  *
@@ -48,6 +55,13 @@ export interface Tagger {
48
55
  */
49
56
  getToolTag(sessionId: string, callId: string, ownerMsgId: string): number | undefined;
50
57
  bindTag(sessionId: string, messageId: string, tagNumber: number): void;
58
+ /**
59
+ * Remove a stale in-memory assignment key. Used by Pi fallback-tag
60
+ * adoption after a tag's message_id is migrated from the pi-msg-*
61
+ * fallback to the real id: the old fallback key must be dropped so it
62
+ * doesn't linger as an alias to the same tag number.
63
+ */
64
+ unbindTag(sessionId: string, messageId: string): void;
51
65
  /**
52
66
  * Bind a tool tag by composite key. The in-memory map keys this as
53
67
  * `${ownerMsgId}\x00${callId}`.
@@ -1 +1 @@
1
- {"version":3,"file":"tagger.d.ts","sourceRoot":"","sources":["../../../src/features/magic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AAE,EAAE,EAAE,QAAQ,GAAG,IAAI,CAAC;IAClD,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CACpC;AAmJD,wBAAgB,YAAY,IAAI,MAAM,CAkdrC"}
@@ -63,6 +63,27 @@ export interface SessionMeta {
63
63
  toolCallTokens: number;
64
64
  clearedReasoningThroughTag: number;
65
65
  lastTodoState: string;
66
+ cachedM0Bytes: Buffer | null;
67
+ cachedM1Bytes: Buffer | null;
68
+ cachedM0ProjectMemoryEpoch: number | null;
69
+ cachedM0ProjectUserProfileVersion: number | null;
70
+ cachedM0MaxCompartmentSeq: number | null;
71
+ cachedM0MaxMemoryId: number | null;
72
+ /**
73
+ * Pi message stable-id scheme version (Pi-only; OpenCode ignores it).
74
+ * NULL/0 = legacy index-based `pi-msg-*` ids; >=1 = real-SessionEntry-id
75
+ * scheme. Drives the one-time forced execute+materialize cutover when a
76
+ * session's stored scheme is below PI_STABLE_ID_SCHEME.
77
+ */
78
+ piStableIdScheme: number | null;
79
+ cachedM0MaxMutationId: number | null;
80
+ cachedM0MaxMemoryMutationId: number | null;
81
+ cachedM0ProjectDocsHash: string | null;
82
+ cachedM0MaterializedAt: number | null;
83
+ cachedM0SessionFactsVersion: number | null;
84
+ cachedM0UpgradeState: string | null;
85
+ lastObservedModelKey: string | null;
86
+ upgradeRemindedAt: number | null;
66
87
  }
67
88
  export type SchedulerDecision = "execute" | "defer";
68
89
  export interface ContextUsage {
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,QAAQ;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,SAAS,GAAG,MAAM,GAAG,MAAM,CAAC;IAClC,MAAM,EAAE,QAAQ,GAAG,SAAS,GAAG,WAAW,CAAC;IAC3C,QAAQ,EAAE,MAAM,GAAG,WAAW,CAAC;IA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1 @@
1
- {"version":3,"file":"review-user-memories.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/user-memory/review-user-memories.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAK3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAavD,UAAU,sBAAsB;IAC5B,EAAE,EAAE,QAAQ,CAAC;IACb,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,uCAAuC;IACvC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAED,UAAU,YAAY;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,YAAY,CAAC,CAyP5F"}
1
+ {"version":3,"file":"review-user-memories.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/user-memory/review-user-memories.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAK3D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAcvD,UAAU,sBAAsB;IAC5B,EAAE,EAAE,QAAQ,CAAC;IACb,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAChC,eAAe,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,uCAAuC;IACvC,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAED,UAAU,YAAY;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;CAC9B;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,YAAY,CAAC,CAwQ5F"}
@@ -1 +1 @@
1
- {"version":3,"file":"storage-user-memory.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/user-memory/storage-user-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,WAAW,mBAAmB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,QAAQ,GAAG,WAAW,CAAC;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,kBAAkB,EAAE,MAAM,EAAE,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACrB;AAID,wBAAgB,0BAA0B,CACtC,EAAE,EAAE,QAAQ,EACZ,UAAU,EAAE,KAAK,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CACjC,CAAC,GACH,IAAI,CAiBN;AAED,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,QAAQ,GAAG,mBAAmB,EAAE,CAqB3E;AAED,wBAAgB,0BAA0B,CAAC,EAAE,EAAE,QAAQ,EAAE,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,CAI5E;AAID,wBAAgB,gBAAgB,CAC5B,EAAE,EAAE,QAAQ,EACZ,OAAO,EAAE,MAAM,EACf,kBAAkB,EAAE,MAAM,EAAE,GAC7B,MAAM,CAQR;AAED,wBAAgB,qBAAqB,CAAC,EAAE,EAAE,QAAQ,GAAG,UAAU,EAAE,CAehE;AAED,wBAAgB,kBAAkB,CAAC,EAAE,EAAE,QAAQ,GAAG,UAAU,EAAE,CAe7D;AAED,wBAAgB,uBAAuB,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAMvF;AAED,wBAAgB,iBAAiB,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAKhE;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,GAAG,IAAI,CAE/D"}
1
+ {"version":3,"file":"storage-user-memory.d.ts","sourceRoot":"","sources":["../../../../src/features/magic-context/user-memory/storage-user-memory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAEvD,MAAM,WAAW,mBAAmB;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,sBAAsB,EAAE,MAAM,GAAG,IAAI,CAAC;IACtC,oBAAoB,EAAE,MAAM,GAAG,IAAI,CAAC;IACpC,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,UAAU;IACvB,EAAE,EAAE,MAAM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../shared/sqlite";
2
+ export declare const BATCH_SIZE = 25;
3
+ export declare const YIELD_EVERY_N_ROWS = 5;
4
+ type V22BackfillStatus = "pending" | "completed" | "completed_with_failures" | "skipped";
5
+ interface LegacyMemoryRow {
6
+ id: number;
7
+ project_path: string;
8
+ category: string;
9
+ normalized_hash: string;
10
+ seen_count: number;
11
+ }
12
+ export interface V22BackfillSummary {
13
+ status: V22BackfillStatus;
14
+ processedRows: number;
15
+ changedRows: number;
16
+ failedRows: number;
17
+ failureCount: number;
18
+ lastCursor: number;
19
+ }
20
+ export interface DeferredV22BackfillOptions {
21
+ resolveIdentity?: (rawProjectPath: string) => string;
22
+ yieldToEventLoop?: () => Promise<void>;
23
+ onBatchResolved?: (batch: readonly LegacyMemoryRow[]) => void | Promise<void>;
24
+ }
25
+ export declare function computeLegacyRustDirIdentity(rawProjectPath: string): string;
26
+ export declare function getV22BackfillStatus(db: Database): {
27
+ status: V22BackfillStatus | "missing";
28
+ failureCount: number;
29
+ cursor: number;
30
+ maxLegacyMemoryId: number;
31
+ };
32
+ export declare function runDeferredV22Backfill(db: Database, options?: DeferredV22BackfillOptions): Promise<V22BackfillSummary>;
33
+ export declare function doctorRetryV22Backfill(db: Database): Promise<{
34
+ attempted: number;
35
+ succeeded: number;
36
+ failed: number;
37
+ skipped: number;
38
+ status: V22BackfillStatus;
39
+ }>;
40
+ export declare function doctorRekeyV22DirIdentity(db: Database, rawProjectPath: string): Promise<{
41
+ oldIdentity: string;
42
+ newIdentity: string;
43
+ changedRows: number;
44
+ }>;
45
+ export {};
46
+ //# sourceMappingURL=v22-deferred-backfill.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"v22-deferred-backfill.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/v22-deferred-backfill.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAQpD,eAAO,MAAM,UAAU,KAAK,CAAC;AAC7B,eAAO,MAAM,kBA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AM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,iBAAiB,CAAC;CAC7B,CAAC,CAuFD;AAED,wBAAsB,yBAAyB,CAC3C,EAAE,EAAE,QAAQ,EACZ,cAAc,EAAE,MAAM,GACvB,OAAO,CAAC;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAAC,CA6B5E"}
@@ -9,5 +9,71 @@ export interface PiSessionEntry {
9
9
  message?: unknown;
10
10
  }
11
11
  export declare function computeOpenCodeWorkMetrics(openCodeDb: Database, sessionId: string): WorkMetrics;
12
+ /** A single assistant row's usage, as folded by `foldWorkMetricsRows`. */
13
+ export interface AssistantUsageRow {
14
+ /** json_extract(data,'$.agent'); null when absent (its own partition). */
15
+ agent: string | null;
16
+ timeCreated: number;
17
+ id: string;
18
+ /** input + cache.read + cache.write. */
19
+ prompt: number;
20
+ output: number;
21
+ }
22
+ interface AgentCarry {
23
+ prevPrompt: number;
24
+ phaseId: number;
25
+ /** Max qualifying prompt in the current (open) phase. */
26
+ phasePeak: number;
27
+ /** Whether the current phase has at least one qualifying row. */
28
+ phaseHasQualifying: boolean;
29
+ /** Summed peaks of already-closed qualifying phases. */
30
+ closedPhaseSum: number;
31
+ lastOutput: number;
32
+ seen: boolean;
33
+ }
34
+ /** Resumable accumulator: fold new rows into this to extend the metric. */
35
+ export interface WorkMetricsCarry {
36
+ perAgent: Map<string, AgentCarry>;
37
+ /** Σ max(0, prompt - prevPrompt) across every folded row (metric A body). */
38
+ newWorkSum: number;
39
+ /** Watermark: last folded row's ordering key. */
40
+ lastTimeCreated: number;
41
+ lastId: string;
42
+ }
43
+ export declare function emptyWorkMetricsCarry(): WorkMetricsCarry;
44
+ /**
45
+ * Fold rows (which MUST be in (timeCreated, id) ascending order and strictly
46
+ * newer than `carry`'s watermark) into the carry, mutating and returning it.
47
+ *
48
+ * Mirrors OPEN_CODE_WORK_METRICS_SQL:
49
+ * - delta per row = max(0, prompt - LAG(prompt) per agent), default LAG 0.
50
+ * - phase_id = cumulative count of (prompt < prevPrompt) per agent; a dropping
51
+ * row starts (and belongs to) the new phase.
52
+ * - phase peak counts only QUALIFYING rows (prevPrompt > 0 OR phase_id == 0).
53
+ * - metric A = Σ deltas + Σ (last output per agent); metric B = Σ phase peaks.
54
+ */
55
+ export declare function foldWorkMetricsRows(rows: AssistantUsageRow[], carry: WorkMetricsCarry): WorkMetricsCarry;
56
+ /** Current metric value implied by the carry (cheap; no DB access). */
57
+ export declare function metricsFromCarry(carry: WorkMetricsCarry): WorkMetrics;
58
+ /** Read assistant usage rows strictly newer than the carry watermark. */
59
+ export declare function readAssistantUsageRowsAfter(openCodeDb: Database, sessionId: string, afterTimeCreated: number, afterId: string): AssistantUsageRow[];
60
+ /**
61
+ * Extend `carry` with assistant rows newer than its watermark and return the
62
+ * up-to-date metrics. On a fresh carry this folds the whole session once (cold
63
+ * start); subsequent calls fold only new rows (≈0 when idle).
64
+ *
65
+ * The single most-recent assistant row is NEVER committed into the durable
66
+ * carry — OpenCode writes the row at stream start and finalizes `data.tokens`
67
+ * at completion, so a poll mid-stream would otherwise freeze that row at a
68
+ * partial/zero value. Instead the watermark is advanced only through the
69
+ * second-to-last row; the last row is re-read every poll and folded into a
70
+ * throwaway clone for the returned value, so the result always matches a full
71
+ * re-scan even while the latest turn is still streaming.
72
+ */
73
+ export declare function computeOpenCodeWorkMetricsIncremental(openCodeDb: Database, sessionId: string, carry: WorkMetricsCarry): {
74
+ carry: WorkMetricsCarry;
75
+ metrics: WorkMetrics;
76
+ };
12
77
  export declare function computePiWorkMetrics(sessionEntries: PiSessionEntry[] | unknown[]): WorkMetrics;
78
+ export {};
13
79
  //# sourceMappingURL=work-metrics.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"work-metrics.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/work-metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,WAAW,WAAW;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAuFD,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,WAAW,CAQ/F;AAED,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,cAAc,EAAE,GAAG,OAAO,EAAE,GAAG,WAAW,CA8B9F"}
1
+ {"version":3,"file":"work-metrics.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/work-metrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,MAAM,WAAW,WAAW;IACxB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,cAAc;IAC3B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAwFD,wBAAgB,0BAA0B,CAAC,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,WAAW,CAQ/F;AAaD,0EAA0E;AAC1E,MAAM,WAAW,iBAAiB;IAC9B,0EAA0E;IAC1E,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,EAAE,EAAE,MAAM,CAAC;IACX,wCAAwC;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAClB;AAED,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@
1
- {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/hooks/auto-update-checker/cache.ts"],"names":[],"mappings":"AAmBA,UAAU,wBAAwB;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;CAC3B;AAgGD,wBAAgB,qBAAqB,CACjC,sBAAsB,GAAE,MAAM,GAAG,IAAyC,GAC3E,wBAAwB,GAAG,IAAI,CA2CjC;AAED,wBAAgB,oBAAoB,CAChC,OAAO,EAAE,MAAM,EACf,WAAW,GAAE,MAAqB,EAClC,sBAAsB,GAAE,MAAM,GAAG,IAAyC,GAC3E,MAAM,GAAG,IAAI,CAyBf;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACnC,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAO,GAC3D,OAAO,CAAC,OAAO,CAAC,CA2ClB"}
1
+ {"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../src/hooks/auto-update-checker/cache.ts"],"names":[],"mappings":"AAmBA,UAAU,wBAAwB;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,eAAe,EAAE,MAAM,CAAC;CAC3B;AAoHD,wBAAgB,qBAAqB,CACjC,sBAAsB,GAAE,MAAM,GAAG,IAAyC,GAC3E,wBAAwB,GAAG,IAAI,CA2CjC;AAED,wBAAgB,oBAAoB,CAChC,OAAO,EAAE,MAAM,EACf,WAAW,GAAE,MAAqB,EAClC,sBAAsB,GAAE,MAAM,GAAG,IAAyC,GAC3E,MAAM,GAAG,IAAI,CAyBf;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,iBAAiB,CACnC,UAAU,EAAE,MAAM,EAClB,OAAO,GAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAO,GAC3D,OAAO,CAAC,OAAO,CAAC,CAgDlB"}
@@ -1 +1 @@
1
- {"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../../../src/hooks/auto-update-checker/checker.ts"],"names":[],"mappings":"AAeA,OAAO,EAIH,KAAK,eAAe,EACvB,MAAM,SAAS,CAAC;AAqCjB,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAY7D;AA4ED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYnE;AAED,wBAAgB,gCAAgC,CAC5C,gBAAgB,GAAE,MAAwB,GAC3C,MAAM,GAAG,IAAI,CAOf;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CA2BzE;AAQD,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CA0BpE;AAED,wBAAgB,mBAAmB,CAC/B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACnB,OAAO,CAwBT;AAMD,wBAAsB,gBAAgB,CAClC,OAAO,SAAW,EAClB,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAO,GACjF,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAuBxB"}
1
+ {"version":3,"file":"checker.d.ts","sourceRoot":"","sources":["../../../src/hooks/auto-update-checker/checker.ts"],"names":[],"mappings":"AAeA,OAAO,EAIH,KAAK,eAAe,EACvB,MAAM,SAAS,CAAC;AAqCjB,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAY7D;AA4ED,wBAAgB,kBAAkB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAYnE;AAED,wBAAgB,gCAAgC,CAC5C,gBAAgB,GAAE,MAAwB,GAC3C,MAAM,GAAG,IAAI,CAOf;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,GAAG,IAAI,CA2BzE;AAQD,wBAAgB,gBAAgB,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CA0BpE;AAED,wBAAgB,mBAAmB,CAC/B,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACnB,OAAO,CAyCT;AAMD,wBAAsB,gBAAgB,CAClC,OAAO,SAAW,EAClB,OAAO,GAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,WAAW,CAAA;CAAO,GACjF,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAuBxB"}
@@ -7,4 +7,13 @@ export interface DeferredConsumptionArgs {
7
7
  activeRunBlocksMaterialization: boolean;
8
8
  }
9
9
  export declare function canConsumeDeferredOnThisPass(args: DeferredConsumptionArgs): boolean;
10
+ export interface MaterializationPassSignals {
11
+ /** True when this transform pass successfully wrote fresh cached m[0] bytes. */
12
+ m0RematerializedThisPass: boolean;
13
+ /** True when retry exhaustion forced fallback to a previous cached m[0]. */
14
+ materializationContentionRetryExhausted: boolean;
15
+ /** True when postprocess observed newer m0_mutation_log ids than cached m[0]. */
16
+ m0MutationDriftDetected: boolean;
17
+ }
18
+ export declare function createMaterializationPassSignals(): MaterializationPassSignals;
10
19
  //# sourceMappingURL=cache-busting-signals.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"cache-busting-signals.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/cache-busting-signals.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,uBAAuB;IACpC,iBAAiB,EAAE,SAAS,GAAG,OAAO,CAAC;IACvC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uFAAuF;IACvF,sBAAsB,EAAE,OAAO,CAAC;IAChC,sFAAsF;IACtF,8BAA8B,EAAE,OAAO,CAAC;CAC3C;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAQnF"}
1
+ {"version":3,"file":"cache-busting-signals.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/cache-busting-signals.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,uBAAuB;IACpC,iBAAiB,EAAE,SAAS,GAAG,OAAO,CAAC;IACvC,iBAAiB,EAAE,MAAM,CAAC;IAC1B,uFAAuF;IACvF,sBAAsB,EAAE,OAAO,CAAC;IAChC,sFAAsF;IACtF,8BAA8B,EAAE,OAAO,CAAC;CAC3C;AAED,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAQnF;AAED,MAAM,WAAW,0BAA0B;IACvC,gFAAgF;IAChF,wBAAwB,EAAE,OAAO,CAAC;IAClC,4EAA4E;IAC5E,uCAAuC,EAAE,OAAO,CAAC;IACjD,iFAAiF;IACjF,uBAAuB,EAAE,OAAO,CAAC;CACpC;AAED,wBAAgB,gCAAgC,IAAI,0BAA0B,CAM7E"}
@@ -9,6 +9,7 @@ import type { NotificationParams } from "./send-session-notification";
9
9
  * Accepted forms:
10
10
  * - empty / whitespace-only → full recomp
11
11
  * - `<start>-<end>` → partial recomp with explicit inclusive range
12
+ * - `--upgrade` → upgrade legacy compartments (dispatch stub until Wave 3)
12
13
  *
13
14
  * Returns an error object for unparseable or nonsensical inputs. */
14
15
  export declare function parseRecompArgs(raw: string): {
@@ -16,6 +17,8 @@ export declare function parseRecompArgs(raw: string): {
16
17
  } | {
17
18
  kind: "partial";
18
19
  range: PartialRecompRange;
20
+ } | {
21
+ kind: "upgrade";
19
22
  } | {
20
23
  kind: "error";
21
24
  message: string;
@@ -54,10 +57,19 @@ export declare function createMagicContextCommandHandler(deps: {
54
57
  onFlush?: (sessionId: string) => void;
55
58
  /** Runs /ctx-recomp. When `range` is provided, runs partial recomp over
56
59
  * that range (snapped to enclosing compartment boundaries). When omitted,
57
- * runs full recomp from message 1 to the protected tail. */
60
+ * runs full recomp from message 1 to the protected tail.
61
+ *
62
+ * TODO(worker-f): once bumpSessionFactsVersion is exported, the underlying
63
+ * recomp publish path must call it in the same transaction that replaces
64
+ * session_facts. Command parsing stays here; fact writes happen in the
65
+ * runner/storage layer. */
58
66
  executeRecomp?: (sessionId: string, options?: {
59
67
  range?: PartialRecompRange;
60
68
  }) => Promise<string>;
69
+ /** Runs the once-per-project 5-cat memory migration for /ctx-session-upgrade.
70
+ * Optional: when unavailable, /ctx-session-upgrade still upgrades compartments
71
+ * via recomp and skips the memory re-evaluation. */
72
+ runUpgrade?: (sessionId: string) => Promise<string>;
61
73
  sendNotification: (sessionId: string, text: string, params: NotificationParams) => Promise<void>;
62
74
  sidekick?: {
63
75
  config: SidekickConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"command-handler.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/command-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EACH,KAAK,cAAc,EAGtB,MAAM,sCAAsC,CAAC;AAG9C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EACH,KAAK,kBAAkB,EAE1B,MAAM,qCAAqC,CAAC;AAG7C,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAiBtE;;;;;;qEAMqE;AACrE,wBAAgB,eAAe,CAC3B,GAAG,EAAE,MAAM,GAET;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAChB;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,KAAK,EAAE,kBAAkB,CAAA;CAAE,GAC9C;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,EAAE,kBAAkB,CAAA;KAAE,KACvC,OAAO,CAAC,MAAM,CAAC,CAAC;IACrB,gBAAgB,EAAE,CACd,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,kBAAkB,KACzB,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,QAAQ,CAAC,EAAE;QACP,MAAM,EAAE,cAAc,CAAC;QACvB,WAAW,EAAE,MAAM,CAAC;QACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,MAAM,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;KACnC,CAAC;IACF,OAAO,CAAC,EAAE;QACN,MAAM,EAAE,aAAa,CAAC;QACtB,WAAW,EAAE,MAAM,CAAC;QACpB,MAAM,EAAE,OAAO,CAAC;QAChB,SAAS,EAAE,MAAM,CAAC;QAClB,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,GAAG,IAAI,CAAC,CAAC;QACrE,wBAAwB,CAAC,EAAE;YAAE,OAAO,EAAE,OAAO,CAAC;YAAC,kBAAkB,EAAE,MAAM,CAAA;SAAE,CAAC;QAC5E,uBAAuB,CAAC,EAAE;YACtB,OAAO,EAAE,OAAO,CAAC;YACjB,YAAY,EAAE,MAAM,CAAC;YACrB,SAAS,EAAE,MAAM,CAAC;SACrB,CAAC;QACF,wEAAwE;QACxE,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;KACtC,CAAC;CACL;sCASkB,mBAAmB,WACjB,oBAAoB,WACpB,kBAAkB,KAC5B,OAAO,CAAC,IAAI,CAAC;EAuKvB"}
1
+ {"version":3,"file":"command-handler.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/command-handler.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AACvF,OAAO,EACH,KAAK,cAAc,EAGtB,MAAM,sCAAsC,CAAC;AAG9C,O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AO,CAAC;YAAC,kBAAkB,EAAE,MAAM,CAAA;SAAE,CAAC;QAC5E,uBAAuB,CAAC,EAAE;YACtB,OAAO,EAAE,OAAO,CAAC;YACjB,YAAY,EAAE,MAAM,CAAC;YACrB,SAAS,EAAE,MAAM,CAAC;SACrB,CAAC;QACF,wEAAwE;QACxE,cAAc,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;KACtC,CAAC;CACL;sCAUkB,mBAAmB,WACjB,oBAAoB,WACpB,kBAAkB,KAC5B,OAAO,CAAC,IAAI,CAAC;EAuLvB"}
@@ -2,15 +2,40 @@ export interface ParsedCompartment {
2
2
  startMessage: number;
3
3
  endMessage: number;
4
4
  title: string;
5
+ /** v2: P1 tier text (mirror). v1/flat: the flat compartment body. */
5
6
  content: string;
7
+ /** v2 paraphrase tiers (model B). Undefined for v1/flat compartments. p4 may be "" (self-close). */
8
+ p1?: string;
9
+ p2?: string;
10
+ p3?: string;
11
+ p4?: string;
12
+ /** v2 decay-rate signal (1-100). Undefined for v1/flat. */
13
+ importance?: number;
14
+ /** v2 comma-separated activity types. Undefined for v1/flat. */
15
+ episodeType?: string;
6
16
  }
7
17
  export interface ParsedFact {
8
18
  category: string;
9
19
  content: string;
10
20
  }
21
+ /**
22
+ * A historian-extracted event (v2). Two kinds today — `causal_incident` and
23
+ * `trajectory_correction` — but parsed kind-agnostically: `kind` is the element
24
+ * name and `fields` holds every child element verbatim. v2.0 STORES events
25
+ * (E2 events table) but does NOT render them; parsing kind-agnostically means a
26
+ * future event-kind or field addition needs no parser change.
27
+ */
28
+ export interface ParsedEvent {
29
+ kind: string;
30
+ /** 1-based compartment index the event anchors to (`at_compartment="N"`); null if absent/invalid. */
31
+ atCompartment: number | null;
32
+ /** child element name → text content (e.g. summary, before_strategy, evidence). */
33
+ fields: Record<string, string>;
34
+ }
11
35
  export interface ParsedCompartmentOutput {
12
36
  compartments: ParsedCompartment[];
13
37
  facts: ParsedFact[];
38
+ events: ParsedEvent[];
14
39
  unprocessedFrom: number | null;
15
40
  userObservations: string[];
16
41
  }
@@ -1 +1 @@
1
- {"version":3,"file":"compartment-parser.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-parser.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,UAAU;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,uBAAuB;IACpC,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC9B;AAWD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,uBAAuB,CAyC5E"}
1
+ {"version":3,"file":"compartment-parser.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-parser.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,iBAAiB;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,qEAAqE;IACrE,OAAO,EAAE,MAAM,CAAC;IAChB,oGAAoG;IACpG,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,2DAA2D;IAC3D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,UAAU;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;GAMG;AACH,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,qGAAqG;IACrG,aAAa,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,mFAAmF;IACnF,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAED,MAAM,WAAW,uBAAuB;IACpC,YAAY,EAAE,iBAAiB,EAAE,CAAC;IAClC,KAAK,EAAE,UAAU,EAAE,CAAC;IACpB,MAAM,EAAE,WAAW,EAAE,CAAC;IACtB,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/B,gBAAgB,EAAE,MAAM,EAAE,CAAC;CAC9B;AAkDD,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,MAAM,GAAG,uBAAuB,CA0G5E"}
@@ -1,19 +1,30 @@
1
- export declare const COMPARTMENT_AGENT_SYSTEM_PROMPT = "You condense long AI coding sessions into two outputs:\n\n1. compartments: completed logical work units\n2. facts: persistent cross-cutting information for future work\n\nCompartment rules:\n- A compartment is one contiguous completed work unit: investigation, fix, refactor, docs update, feature, or decision.\n- Start a new compartment only when the work clearly pivots to a different objective.\n- If one broad effort contains multiple completed sub-pivots with distinct outcomes, prefer multiple smaller compartments over one umbrella compartment with many U: lines.\n- Do not create compartments for magic-context commands or tool-only noise.\n- If the input ends mid-topic, leave it out and report its first message index in <unprocessed_from>.\n- All compartment start/end ordinals and <unprocessed_from> must use the absolute raw message numbers shown in the input. Never renumber relative to this chunk.\n- Every displayed raw message ordinal in the input MUST appear in exactly one compartment. Gaps between compartments are invalid. When a displayed block is pure tool noise (e.g. a long \"TC: ...\" run with no narrative text), do NOT skip it \u2014 extend the preceding compartment's `end` to absorb the range, or include it inside the current compartment if the block falls within an ongoing work unit. Never create a dedicated compartment just to cover a tool-only run.\n- Only emit NEW compartments for the new messages. Do not re-emit existing compartments from the existing state.\n- Write comprehensive, detailed compartments. Include file paths, function names, commit hashes, config keys, and values when they matter.\n- Do not list every changed file. Do not narrate tool calls. Do not preserve dead-end exploration beyond a brief clause when needed.\n\n# Construction order (MANDATORY)\n\nFor each compartment, build in this exact order:\n\n1. Write the narrative summary first \u2014 what was done, why, and the outcome. This is 1\u20134 sentences covering the work unit completely.\n2. Re-read your narrative. Ask: does the summary already convey all important decisions and constraints from this work unit?\n3. If yes, the compartment is DONE with zero U: lines. Move on.\n4. If no, identify the specific signal the narrative cannot capture. Add U: lines ONLY for those signals.\n5. Before writing each U: line, run the CROSS-COMPARTMENT CHECK (see below).\n\nZero U: lines in a compartment is normal and expected. Most compartments should have 0\u20132 U: lines. Compartments with 3\u20135 are rare and must be justified by genuinely distinct durable signals.\n\n# DROP rules (check these first \u2014 if any match, drop without exception)\n\n- Questions in ANY form: \"should I X?\", \"what about Y?\", \"do you think Z?\", \"isn't it better to A?\", \"why don't we B?\", \"any ideas?\" \u2014 the resolved answer belongs in narrative only. If it feels important to keep the question, you are wrong: keep the answer in narrative.\n- Agreements and acknowledgments: \"yes\", \"okay\", \"sure\", \"thanks\", \"go ahead\", \"looks good\", \"perfect\", \"I agree\", \"sounds good\", \"great\".\n- Pure pacing and sequencing: \"let's start\", \"continue\", \"let's do all\", \"now we can X\", \"let's commit\", \"first do A then B\", \"before that\", \"in the meantime\".\n- Tactical observations: \"I just noticed X\", \"we recently did Y\", \"I'm seeing Z right now\", \"this seems wrong\".\n- Debugging status: \"context is at 78%\", \"I'm restarting\", \"the last build failed\".\n- Dogfooding/restart loops: \"I restarted, can you check?\", \"okay we should have updated versions now\", \"let me try again\".\n- Pasted error output or logs as U: line \u2014 capture the underlying problem in narrative, not the raw paste.\n- Examples and illustrations: \"mine was when an agent wants to see X\" \u2014 convert the underlying intent into a directive or drop.\n- Hype with embedded directive: ALL-CAPS pleas, \"PLEASE PLEASE PLEASE just do X\" \u2014 extract only the underlying directive into narrative; drop the hype.\n- Social signals, banter, emoji-only, enthusiasm.\n- Deferred ideas: \"for later\", \"we can do X later\", \"another idea for the future\".\n- Mid-process status: \"running Y\", \"checking Z\".\n- Superseded drafts once a later message gives the final decision.\n- Standing workflow rules (\"always run lint before push\") \u2014 these belong in WORKFLOW_RULES facts, not U: lines.\n\n# Wording rule (default: verbatim)\n\nBy default, U: lines use the user's actual wording. The user's exact phrasing often carries negotiation context, emphasis, or technical specificity that paraphrase loses.\n\nParaphrase ONLY in these cases:\n- **Strip agreement prefixes**: \"Yes X\", \"Okay X\", \"Sure X\" \u2192 keep only the substantive part of X, in the user's original wording.\n- **Split compound directives**: If one message contains two distinct durable directives, split into two U: lines \u2014 each preserving the user's wording for its part.\n- **Drop conversational noise, keep core**: If a message wraps a directive in exploratory phrasing (\"so I was thinking, maybe... but actually...\"), drop the exploration and keep the core directive in the user's remaining words. Don't invent new phrasing.\n\nNEVER:\n- Rewrite a clear user directive into a formal constraint statement. (\"We need tool count at ~8\" stays as-is; do NOT convert to \"Tool count must be capped at 8.\")\n- Synthesize a directive from multiple messages into one canonical statement. If the signal needs synthesis, it belongs in narrative, not a U: line.\n- Add technical specificity the user didn't state (file paths, function names, constant names). Canonical technical specificity belongs in narrative or facts, not in U: lines attributed to the user.\n\nGood example:\n Original user message: \"Yes let's do this. But we need to also make sure that we limit by message count as some sessions have quite a lot of messages.\"\n Correct U: line: \"We need to also make sure that we limit by message count as some sessions have quite a lot of messages.\"\n (Stripped agreement prefix; kept the user's actual wording.)\n\nBad example (do not do this):\n Incorrect U: line: \"Cap session history retrieval at a maximum message count to prevent memory issues on large sessions.\"\n (Rewrote the user directive into formal language and invented specificity.)\n\n# KEEP rules (U: line survives only if ALL pass)\n\n1. DURABLE: The signal matters after the immediate turn.\n2. SPECIFIC: Concrete goal, hard constraint, design decision, rejection, rationale, threshold, source-of-truth correction, or future-work directive.\n3. OUTCOME-BACKED: This compartment's narrative clearly states what was done, decided, or changed because of the message.\n4. NON-REDUNDANT: Not captured by another U: line (see CROSS-COMPARTMENT CHECK), by a fact, or by the narrative.\n5. IRREPLACEABLE: The user's wording adds signal that narrative paraphrase cannot preserve. If the same information could appear as narrative without losing meaning, it should.\n\nCategories of KEEP:\n- Hard gates, thresholds, config defaults, percentages, byte sizes with concrete values.\n- Accepted designs and explicit decisions.\n- Rejections and negative constraints: \"X is wrong because Y\", \"we should NOT do Z\".\n- Source-of-truth corrections: \"follow the code, not the README\".\n- Implementation pivots stated in future tense: \"instead of X let's do Y\", \"switch to Z\".\n- Durable rationale that explains WHY an approach was chosen.\n- Specific feature requirements stated as durable goals.\n\n# PIVOT vs OBSERVATION test\n\nA pivot is FUTURE-TENSE and changes the plan: \"instead of X, let's do Y\", \"switch this to Z\", \"actually, let's not do A\".\nAn observation is PAST-TENSE or PRESENT-TENSE and reports state: \"we recently did X\", \"I just noticed Y\", \"this is broken right now\".\nObservations may frame narrative context but are NOT pivots and NOT durable. Drop them as U: lines.\n\n# CROSS-COMPARTMENT CHECK (forward-looking)\n\nBefore writing ANY U: line in the current compartment:\n1. Scan U: lines you have ALREADY written in previous compartments in this response.\n2. If any prior U: line expresses the same intent, decision, constraint, or rationale \u2014 even in different words \u2014 do NOT write the new U: line.\n3. Let the narrative in the current compartment carry the signal instead.\n\nThis is a forward operation: you only need to check what you already wrote, not revisit past compartments.\n\nExamples of same-intent pairs to collapse:\n- \"X shouldn't cause cache bust\" + \"X must not bust cache by itself\" \u2192 keep only the first, in its original compartment.\n- \"Let's use monorepo\" + \"Yes, monorepo is the right call\" \u2192 keep only the first.\n- \"Add logging\" + \"We need logs here too\" \u2192 keep only the first.\n\nNever keep two U: lines for the same underlying directive across compartments.\n\n# Budget\n\n- HARD LIMIT: 3\u20135 U: lines per compartment. 0\u20132 is typical.\n- If you have more than 5 candidate U: lines in one compartment, that is a signal to split into two compartments at a natural pivot, not to stuff more.\n- Every U: line must be immediately followed by 1\u20133 sentences describing the outcome, decision, or effect. Never stack two U: lines without intervening outcome text.\n\n# Example: CORRECT preservation (narrative-first, verbatim U: line)\n\n<compartment start=\"50\" end=\"120\" title=\"Built the auth layer\">\nImplemented JWT auth with hard 60-minute exp claim and refresh-token rotation. Chose Bearer tokens over cookies after finding cookie-based auth broke the SPA flow. Added session_expiry config (read-only at runtime). Commits: a3f891, b22c4e.\nU: We need session expiry capped at 1 hour, no exceptions\nHardcoded the 60-minute cap at the JWT-issuer layer so runtime overrides cannot extend it.\n</compartment>\n\nNotice: only one U: line, kept verbatim from the user's actual message. The cookie-to-Bearer pivot is narrative because paraphrase captures the signal fully.\n\n# Example: OVER-PRESERVATION (avoid)\n\n<compartment start=\"200\" end=\"350\" title=\"Refactored data layer\">\nU: Okay let's start on the data layer\nU: What about transactions?\nU: Yes that approach looks good\nU: Actually wait, maybe we need write-ahead logging\nU: I just noticed the previous commit broke a test\nU: Let's commit and ship it\nRefactored data layer with WAL mode and connection pooling.\n</compartment>\n\nProblems: pacing, question, agreement, observation, pacing again. Only one message carries signal, and even that is narrative-capturable.\n\n# CORRECT version of the above\n\n<compartment start=\"200\" end=\"350\" title=\"Refactored data layer\">\nRefactored data layer to use WAL mode plus connection pooling. Chose WAL over plain connections for concurrent read performance under sustained write load.\n</compartment>\n\nZero U: lines. The pivot to WAL is clear in narrative.\n\nFact rules:\n- Facts are editable state, not append-only notes. Rewrite, normalize, deduplicate, or drop existing facts whenever needed.\n- Before emitting any fact, check all existing facts in the same category for semantic duplicates. If two facts describe the same decision, constraint, or default with different wording, merge them into one canonical statement. Never emit two facts that could be answered by the same question.\n- When project memories are provided as read-only reference, drop any session fact that is already covered by a project memory. Project memories are the canonical cross-session source; session facts must not duplicate them.\n- Facts must be durable and actionable after the conversation ends.\n- A fact is either a stable invariant/default or a reusable operating rule. If it mainly explains what happened, it belongs in a compartment, not a fact.\n- Facts belong only in these categories when relevant: WORKFLOW_RULES, ARCHITECTURE_DECISIONS, CONSTRAINTS, CONFIG_DEFAULTS, KNOWN_ISSUES, ENVIRONMENT, NAMING, USER_PREFERENCES, USER_DIRECTIVES.\n- Keep only high-signal facts. Omit greetings, acknowledgements, temporary status, one-off sequencing, branch-local tactics, and task-local cleanup notes.\n- When a user message carries durable goals, constraints, preferences, or decision rationale, add a USER_DIRECTIVES fact when future agents should follow it after the session is compacted.\n- Do not turn task-local details into facts.\n- Do not keep stale facts. Rewrite or drop them even if the new input only implies they are obsolete.\n- Keep existing ARCHITECTURE_DECISIONS and CONSTRAINTS facts when they are still valid and uncontradicted; rewrite them into canonical form instead of dropping them.\n- Facts must be present tense and operational. Do not use chronology or provenance wording such as: initially, currently, remained, previously, later, then, was implemented, we changed, used to.\n- One fact bullet must contain exactly one rule/default/constraint/preference. If a candidate fact mixes history with guidance, keep the guidance and drop the history.\n- Durability test: a future agent should still act correctly on the fact next session, after merge/restart, without rereading the conversation.\n- Category guide:\n - WORKFLOW_RULES: standing repeatable process only. Prefer Do/When form: When <condition>, <action>. Do not store one-off branch strategy or task-specific sequencing unless it is standing policy.\n - ARCHITECTURE_DECISIONS: stable design choice. Use: <component> uses <choice> because <reason>.\n - CONSTRAINTS: hard must/must-not rule or invariant. Use: <thing> must/must not <action> because <reason>.\n - CONFIG_DEFAULTS: stable default only. Use: <key>=<value>.\n - KNOWN_ISSUES: unresolved recurring problem only. Do not store solved-issue stories.\n - ENVIRONMENT: stable setup fact that affects future work.\n - NAMING: canonical term choice. Use: Use <term>; avoid <term>.\n - USER_PREFERENCES: durable user preference. Prefer Do/When form.\n - USER_DIRECTIVES: durable user-stated goal, constraint, preference, or rationale. Keep the user's wording when it carries meaning, but narrow it to 1-3 sentences and remove filler.\n- Fact dedup examples:\n - These are DUPLICATES (merge into one): \"Plugin config uses layered JSONC files\" and \"AFT plugin config uses layered JSONC files at ~/.config/opencode/aft.jsonc and <project>/.opencode/aft.jsonc, with project values deep-merging over user values.\" \u2192 keep the longer, more specific version only.\n - These are NOT duplicates (keep both): \"AFT uses 1-based line numbers\" and \"AFT converts to LSP 0-based UTF-16 at the protocol boundary\" \u2192 different aspects of the same system.\n- Fact rewrite examples:\n - Bad ARCHITECTURE_DECISIONS: The new tool-heavy `ctx_reduce` reminder was initially implemented as a hidden instruction appended to the latest user message in `transform`.\n - Good ARCHITECTURE_DECISIONS: `ctx_reduce` turn reminders are injected into the latest user message in `transform`.\n - Bad WORKFLOW_RULES: Current local workflow remained feat -> integrate -> build for code changes.\n - Good WORKFLOW_RULES (only if this is standing policy): For magic-context changes, commit on `feat/magic-context`, cherry-pick to `integrate/athena-magic-context`, run `bun run build` on integrate, then return to `feat/magic-context`.\n\nInput notes:\n- [N] or [N-M] is a stable raw OpenCode message range.\n- U: means user.\n- A: means assistant.\n- TC: means tool call \u2014 a compact summary of what the agent did (e.g., \"TC: Fix lint errors\", \"TC: read(src/index.ts)\", \"TC: grep(ctx_memory)\"). TC lines appear when there is no text describing the action. Use them to understand what happened between text blocks, but do not copy them verbatim into compartments \u2014 incorporate their meaning into the narrative.\n- commits: ... on an assistant block lists commit hashes mentioned in that work unit; keep the relevant ones in the compartment summary when they matter.\n\nOutput valid XML only in this shape:\n<output>\n<compartments>\n<compartment start=\"FIRST\" end=\"LAST\" title=\"short title\">\nU: Verbatim high-signal user message\nSummary text describing what was done and why.\nU: Another high-signal user message if applicable\nMore summary text.\n</compartment>\n</compartments>\n<facts>\n<WORKFLOW_RULES>\n* Fact text\n</WORKFLOW_RULES>\n</facts>\n<meta>\n<messages_processed>FIRST-LAST</messages_processed>\n<unprocessed_from>INDEX</unprocessed_from>\n</meta>\n</output>\n\nOmit empty fact categories. Compartments must be ordered, contiguous for the ranges they cover, and non-overlapping.";
2
- export declare const COMPRESSOR_AGENT_SYSTEM_PROMPT = "You compress older compartments from a long AI coding session by merging adjacent compartments and rewriting their content at a target density.\n\nYour two jobs:\n1. Merge N input compartments into M output compartments (M < N). Typical M = ceil(N/2).\n2. Rewrite each merged compartment's content at the density level specified per-request.\n\nUniversal rules (all density levels):\n- Merged compartments must collectively cover the same start-to-end range as the input.\n- Use the EXACT start/end ordinals from the input compartments for every output compartment boundary.\n- Do not invent new ordinal boundaries that don't exist in the input.\n- Output compartments must be ordered and non-overlapping.\n- Preserve commit hashes (7-40 hex chars), file paths, config keys, URLs, and `backtick-fenced` code verbatim \u2014 never modify, abbreviate, or drop them.\n- Preserve lines starting with \"U: \" verbatim when they remain in output. Do not paraphrase user directives.\n- Do not add new information or invent details.\n- Do not re-emit any compartment unchanged \u2014 if the content doesn't need rewriting at the target density, still merge it with neighbors.\n\nDensity levels (specified per-request):\n\nLevel 1 \u2014 MERGE ONLY:\n Preserve all narrative prose and all U: lines. Only remove genuine duplicate sentences spanning merged compartments (same fact said twice becomes one).\n\nLevel 2 \u2014 LITE TIGHTEN:\n Merge + drop filler words (\"just\", \"really\", \"basically\", \"essentially\") and hedging (\"I think\", \"probably\", \"perhaps\"). Keep full grammar, keep U: lines verbatim.\n\nLevel 3 \u2014 FULL CONDENSE:\n Single paragraph per output compartment. Drop articles (\"the\", \"a\", \"an\") and weak auxiliaries (\"was\", \"were\"). Fragments acceptable. Keep only the IRREPLACEABLE U: lines (unique-signal quotes). Drop U: lines whose intent is already in narrative.\n\nLevel 4 \u2014 ULTRA TELEGRAPH:\n Telegraphic fragments. Symbol connectives: \"\u2192\" for \"then/causes\", \"+\" for \"and\", \"//\" for \"because\", \"|\" for \"or\". Pattern: [thing] [action] [reason]. [next]. Keep U: lines only if their exact phrasing is truly irreplaceable (rare).\n\nOutput valid XML only in this shape:\n<output>\n<compartments>\n<compartment start=\"FIRST\" end=\"LAST\" title=\"short title\">Compressed content.</compartment>\n</compartments>\n</output>";
1
+ export { COMPARTMENT_AGENT_SYSTEM_PROMPT } from "./historian-prompt.generated";
3
2
  export declare const HISTORIAN_EDITOR_SYSTEM_PROMPT = "You are an editor refining a historian draft. The draft was produced by a first-pass historian and may contain noise \u2014 low-signal U: lines, redundant quotes across compartments, and weak preservation decisions.\n\nYour job is to clean the draft without changing its structure:\n\n1. DROP low-signal U: lines:\n - Questions in any form \u2014 resolved decision goes in narrative only.\n - Pacing/agreement: \"let's go\", \"yes\", \"okay\", \"sounds good\", \"I agree\".\n - Pasted error output, debugging status, mid-process observations.\n - Tactical micro-direction: \"now look at X\", \"first check Y\".\n\n2. DROP cross-compartment duplicates:\n - Scan U: lines across ALL compartments in the draft.\n - If two U: lines express the same intent/decision, keep only ONE \u2014 in the compartment where the outcome is actually described.\n\n3. STRIP agreement prefixes:\n - \"Yes we should X\" \u2192 keep only the directive content, or drop entirely if nothing substantive remains after \"Yes\".\n\n4. PREFER verbatim over paraphrase:\n - If the draft rephrased a user directive into formal constraint language, restore the user's wording if available.\n - Do not invent technical specificity (file paths, function names, constants) the user did not state.\n\n5. FOLD into narrative when possible:\n - If a U: line's signal is already captured in the surrounding narrative, drop the U: line.\n - Narrative should not need the U: line to be understood.\n\n6. KEEP as U: lines ONLY:\n - Hard constraints with concrete values (thresholds, byte sizes, timeouts).\n - Explicit rejections (\"X is wrong because Y\", \"NOT Z\").\n - Implementation pivots in future-tense (\"instead of A, do B\").\n - Source-of-truth corrections.\n\nDo NOT change:\n- Compartment titles, ranges, or ordering.\n- Narrative summary text unless it directly references a U: line you dropped (in which case integrate the signal into the narrative).\n- Facts \u2014 leave the facts section untouched.\n- <meta> section \u2014 leave messages_processed and unprocessed_from exactly as the draft has them.\n\nOutput the cleaned version as valid XML matching the original structure. Preserve all XML tags, compartment ranges, meta, and facts.";
4
3
  export declare function buildHistorianEditorPrompt(draft: string): string;
5
- export declare const USER_OBSERVATIONS_APPENDIX = "\n\nUser observation rules (EXPERIMENTAL):\n- After outputting compartments and facts, also output a <user_observations> section.\n- User observations capture UNIVERSAL behavioral patterns about the human user \u2014 not project-specific or technical.\n- Good observations: communication preferences, review focus areas, expertise level, decision-making patterns, frustration triggers, working style.\n- Bad observations (DO NOT emit): project-specific preferences, framework choices, coding language preferences, one-off moods, task-local frustration.\n- Each observation must be a single concise sentence in present tense.\n- Only emit observations you have strong evidence for from the conversation. Do not speculate.\n- Emit 0-5 observations per run. Zero is fine if nothing stands out.\n- The output shape inside <output> gains an additional section:\n<user_observations>\n* User prefers terse communication and dislikes verbose explanations.\n* User is technically deep \u2014 understands cache invalidation, SQLite internals, and prompt engineering.\n</user_observations>\nIf no observations, omit the <user_observations> section entirely.";
6
- /** Build the per-request prompt for a compressor run.
7
- * `outputDepth` selects the density level (1-4). Depth 5 is handled by
8
- * the runner short-circuit and never invokes this builder. */
9
- export declare function buildCompressorPrompt(compartments: Array<{
10
- startMessage: number;
11
- endMessage: number;
12
- title: string;
13
- content: string;
14
- }>, currentTokens: number, targetTokens: number, outputDepth: number, outputCount?: number): string;
15
- export declare function buildCompartmentAgentPrompt(existingState: string, inputSource: string, options?: {
16
- userMemoriesEnabled?: boolean;
17
- stateFilePath?: string;
18
- }): string;
4
+ export interface CompartmentPromptInputs {
5
+ /** `<compartment_examples_from_other_projects>` block (4-seed floor), or "". */
6
+ seedExamples: string;
7
+ /** `<session_references>` block (last-6 recency), or "" for a young session. */
8
+ sessionReferences: string;
9
+ /** `<project-memory>` block for fact dedup, or "" when memory disabled/empty. */
10
+ projectMemory: string;
11
+ /** Raw chunk to compartmentalize, pre-formatted `Messages X-Y:\n\n...`. */
12
+ inputSource: string;
13
+ /** When false, instruct the historian to SKIP fact extraction entirely.
14
+ * v2 faithful facts are stored only as project memories; with memory
15
+ * disabled there is no fact store, so emitting facts is pure waste
16
+ * (and they would never be rendered). Defaults to enabled. */
17
+ memoryEnabled?: boolean;
18
+ }
19
+ /**
20
+ * Assemble the per-run historian USER prompt for the v8.7.3 system prompt.
21
+ *
22
+ * The system prompt (`COMPARTMENT_AGENT_SYSTEM_PROMPT`, from
23
+ * historian-prompt.generated.ts) carries ALL instructions. This builder only
24
+ * lays out the four input blocks in the order the prompt's Inputs section
25
+ * documents: cross-project examples → session references → project memory →
26
+ * `<new_messages>`. The unbounded v1 `existing_state` dump is GONE (v2) —
27
+ * bounded reference blocks replace it.
28
+ */
29
+ export declare function buildCompartmentAgentPrompt(inputs: CompartmentPromptInputs): string;
19
30
  //# sourceMappingURL=compartment-prompt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compartment-prompt.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-prompt.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,+BAA+B,4xgBAgNyE,CAAC;AAEtH,eAAO,MAAM,8BAA8B,u1EAmCjC,CAAC;AAEX,eAAO,MAAM,8BAA8B,ysEAqC0F,CAAC;AAEtI,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAUhE;AAED,eAAO,MAAM,0BAA0B,+nCAe4B,CAAC;AAEpE;;+DAE+D;AAC/D,wBAAgB,qBAAqB,CACjC,YAAY,EAAE,KAAK,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC,EACF,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,MAAM,EACnB,WAAW,CAAC,EAAE,MAAM,GACrB,MAAM,CAkDR;AAED,wBAAgB,2BAA2B,CACvC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE;IAAE,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,GACpE,MAAM,CAyBR"}
1
+ {"version":3,"file":"compartment-prompt.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-prompt.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,+BAA+B,EAAE,MAAM,8BAA8B,CAAC;AAE/E,eAAO,MAAM,8BAA8B,ysEAqC0F,CAAC;AAEtI,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAUhE;AACD,MAAM,WAAW,uBAAuB;IACpC,gFAAgF;IAChF,YAAY,EAAE,MAAM,CAAC;IACrB,gFAAgF;IAChF,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iFAAiF;IACjF,aAAa,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,WAAW,EAAE,MAAM,CAAC;IACpB;;;mEAG+D;IAC/D,aAAa,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;;;;;GASG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,uBAAuB,GAAG,MAAM,CAgBnF"}
@@ -1 +1 @@
1
- {"version":3,"file":"compartment-runner-incremental.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-runner-incremental.ts"],"names":[],"mappings":"AAYA,OAAO,EACH,yBAAyB,EACzB,gCAAgC,EAChC,4BAA4B,GAC/B,MAAM,wBAAwB,CAAC;AAuBhC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAoBxE,+DAA+D;AAC/D,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAEhE;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmXpF"}
1
+ {"version":3,"file":"compartment-runner-incremental.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-runner-incremental.ts"],"names":[],"mappings":"AAYA,OAAO,EACH,yBAAyB,EACzB,gCAAgC,EAChC,4BAA4B,GAC/B,MAAM,wBAAwB,CAAC;AA6BhC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAqBxE,+DAA+D;AAC/D,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAEhE;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,IAAI,CAAC,CA2hBpF"}
@@ -1,10 +1,13 @@
1
+ import type { ParsedCompartment } from "./compartment-parser";
1
2
  import type { CandidateCompartment } from "./compartment-runner-types";
3
+ /** Tier/metadata fields a parsed compartment may carry, threaded to storage. */
4
+ type ParsedTierFields = Pick<ParsedCompartment, "p1" | "p2" | "p3" | "p4" | "importance" | "episodeType">;
2
5
  export declare function mapParsedCompartmentsToChunk(compartments: Array<{
3
6
  startMessage: number;
4
7
  endMessage: number;
5
8
  title: string;
6
9
  content: string;
7
- }>, chunk: {
10
+ } & ParsedTierFields>, chunk: {
8
11
  startIndex: number;
9
12
  endIndex: number;
10
13
  lines: Array<{
@@ -23,11 +26,12 @@ export declare function mapParsedCompartmentsToSession(compartments: Array<{
23
26
  endMessage: number;
24
27
  title: string;
25
28
  content: string;
26
- }>, sessionId: string): {
29
+ } & ParsedTierFields>, sessionId: string): {
27
30
  ok: true;
28
31
  compartments: CandidateCompartment[];
29
32
  } | {
30
33
  ok: false;
31
34
  error: string;
32
35
  };
36
+ export {};
33
37
  //# sourceMappingURL=compartment-runner-mapping.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compartment-runner-mapping.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-runner-mapping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGvE,wBAAgB,4BAA4B,CACxC,YAAY,EAAE,KAAK,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC,EACF,KAAK,EAAE;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACxD,EACD,cAAc,EAAE,MAAM,GACvB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,YAAY,EAAE,oBAAoB,EAAE,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAuBnF;AAED,wBAAgB,8BAA8B,CAC1C,YAAY,EAAE,KAAK,CAAC;IAChB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC,EACF,SAAS,EAAE,MAAM,GAClB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,YAAY,EAAE,oBAAoB,EAAE,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CA8BnF"}
1
+ {"version":3,"file":"compartment-runner-mapping.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-runner-mapping.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAC9D,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC;AAGvE,gFAAgF;AAChF,KAAK,gBAAgB,GAAG,IAAI,CACxB,iBAAiB,EACjB,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,YAAY,GAAG,aAAa,CAC3D,CAAC;AAaF,wBAAgB,4BAA4B,CACxC,YAAY,EAAE,KAAK,CACf;IACI,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB,GAAG,gBAAgB,CACvB,EACD,KAAK,EAAE;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACxD,EACD,cAAc,EAAE,MAAM,GACvB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,YAAY,EAAE,oBAAoB,EAAE,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAwBnF;AAED,wBAAgB,8BAA8B,CAC1C,YAAY,EAAE,KAAK,CACf;IACI,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB,GAAG,gBAAgB,CACvB,EACD,SAAS,EAAE,MAAM,GAClB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,YAAY,EAAE,oBAAoB,EAAE,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CA+BnF"}
@@ -1 +1 @@
1
- {"version":3,"file":"compartment-runner-partial-recomp.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-runner-partial-recomp.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,WAAW,EAEd,MAAM,kDAAkD,CAAC;AA0B1D,OAAO,KAAK,EAAwB,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAU9F,MAAM,WAAW,kBAAkB;IAC/B,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,GAAG,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAChC,kEAAkE;IAClE,SAAS,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,WAAW,EAAE,CAAC;IACjC,iBAAiB,EAAE,WAAW,EAAE,CAAC;IACjC,gBAAgB,EAAE,WAAW,EAAE,CAAC;CACnC;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACnC,YAAY,EAAE,WAAW,EAAE,EAC3B,KAAK,EAAE,kBAAkB,GAC1B,mBAAmB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CA2CzC;AAcD,wBAAsB,4BAA4B,CAC9C,IAAI,EAAE,qBAAqB,EAC3B,KAAK,EAAE,kBAAkB,GAC1B,OAAO,CAAC,MAAM,CAAC,CAmXjB"}
1
+ {"version":3,"file":"compartment-runner-partial-recomp.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-runner-partial-recomp.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACR,WAAW,EAEd,MAAM,kDAAkD,CAAC;AAwB1D,OAAO,KAAK,EAAwB,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAW9F,MAAM,WAAW,kBAAkB;IAC/B,8DAA8D;IAC9D,KAAK,EAAE,MAAM,CAAC;IACd,2DAA2D;IAC3D,GAAG,EAAE,MAAM,CAAC;CACf;AAED,MAAM,WAAW,mBAAmB;IAChC,kEAAkE;IAClE,SAAS,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAC;IAChB,iBAAiB,EAAE,WAAW,EAAE,CAAC;IACjC,iBAAiB,EAAE,WAAW,EAAE,CAAC;IACjC,gBAAgB,EAAE,WAAW,EAAE,CAAC;CACnC;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CACnC,YAAY,EAAE,WAAW,EAAE,EAC3B,KAAK,EAAE,kBAAkB,GAC1B,mBAAmB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CA2CzC;AAuBD,wBAAsB,4BAA4B,CAC9C,IAAI,EAAE,qBAAqB,EAC3B,KAAK,EAAE,kBAAkB,GAC1B,OAAO,CAAC,MAAM,CAAC,CA2YjB"}
@@ -1,3 +1,11 @@
1
- import type { CompartmentRunnerDeps } from "./compartment-runner-types";
1
+ import type { Database } from "../../shared/sqlite";
2
+ import type { CandidateCompartment, CompartmentRunnerDeps } from "./compartment-runner-types";
3
+ export declare function promoteRecompStagingWithM0Mutation(db: Database, sessionId: string, holderId: string): {
4
+ compartments: CandidateCompartment[];
5
+ facts: Array<{
6
+ category: string;
7
+ content: string;
8
+ }>;
9
+ } | null;
2
10
  export declare function executeContextRecompInternal(deps: CompartmentRunnerDeps): Promise<string>;
3
11
  //# sourceMappingURL=compartment-runner-recomp.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compartment-runner-recomp.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-runner-recomp.ts"],"names":[],"mappings":"AA4BA,OAAO,KAAK,EAAwB,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAc9F,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,CA+V/F"}
1
+ {"version":3,"file":"compartment-runner-recomp.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compartment-runner-recomp.ts"],"names":[],"mappings":"AA0BA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAMpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AAmD9F,wBAAgB,kCAAkC,CAC9C,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,GACjB;IACC,YAAY,EAAE,oBAAoB,EAAE,CAAC;IACrC,KAAK,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACvD,GAAG,IAAI,CAgDP;AAED,wBAAsB,4BAA4B,CAAC,IAAI,EAAE,qBAAqB,GAAG,OAAO,CAAC,MAAM,CAAC,CAid/F"}