@cortexkit/opencode-magic-context 0.49.11 → 0.49.12

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 (206) hide show
  1. package/README.md +1 -1
  2. package/dist/agents/smart-notes-dreamer-gate.fixture.d.ts +28 -0
  3. package/dist/agents/smart-notes-dreamer-gate.fixture.d.ts.map +1 -0
  4. package/dist/{announcement-hdbkt8v5.js → announcement-g789dmt6.js} +2 -2
  5. package/dist/auto-search-worker.js +4 -4
  6. package/dist/{compaction-marker-candidates-xxz35vwp.js → compaction-marker-candidates-v5c6997n.js} +3 -3
  7. package/dist/compaction-marker-candidates-worker.js +1 -1
  8. package/dist/config/agent-disable.d.ts +14 -0
  9. package/dist/config/agent-disable.d.ts.map +1 -1
  10. package/dist/config/dependency-notes.d.ts +34 -0
  11. package/dist/config/dependency-notes.d.ts.map +1 -0
  12. package/dist/config/schema/magic-context.d.ts.map +1 -1
  13. package/dist/{conflict-warning-hook-xwkfncav.js → conflict-warning-hook-f4x5wed7.js} +8 -8
  14. package/dist/{context-twz3s0cg.js → context-dam8p201.js} +106 -96
  15. package/dist/{derive-budgets-3nbxsyss.js → derive-budgets-5306b1jt.js} +3 -3
  16. package/dist/embedding-backfill-qbfcbp87.js +21 -0
  17. package/dist/embedding-worker-process.js +2 -2
  18. package/dist/embedding-worker.js +6 -6
  19. package/dist/features/magic-context/dreamer/task-config.d.ts +22 -4
  20. package/dist/features/magic-context/dreamer/task-config.d.ts.map +1 -1
  21. package/dist/features/magic-context/dreamer/task-registry.d.ts +22 -0
  22. package/dist/features/magic-context/dreamer/task-registry.d.ts.map +1 -1
  23. package/dist/features/magic-context/dreamer/task-scheduler.d.ts +4 -1
  24. package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
  25. package/dist/features/magic-context/memory/embedding-openai.d.ts +32 -0
  26. package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -1
  27. package/dist/features/magic-context/memory/project-identity.d.ts +1 -0
  28. package/dist/features/magic-context/memory/project-identity.d.ts.map +1 -1
  29. package/dist/features/magic-context/memory/unborn-head.d.ts +34 -0
  30. package/dist/features/magic-context/memory/unborn-head.d.ts.map +1 -0
  31. package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
  32. package/dist/features/magic-context/storage-tags.d.ts +2 -0
  33. package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
  34. package/dist/{history-owner-ty29fz0f.js → history-owner-xp3pngv7.js} +3 -3
  35. package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
  36. package/dist/hooks/magic-context/compartment-prompt.d.ts +6 -0
  37. package/dist/hooks/magic-context/compartment-prompt.d.ts.map +1 -1
  38. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
  39. package/dist/hooks/magic-context/compartment-runner-types.d.ts +3 -0
  40. package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
  41. package/dist/hooks/magic-context/compartment-trigger-error.d.ts +12 -0
  42. package/dist/hooks/magic-context/compartment-trigger-error.d.ts.map +1 -0
  43. package/dist/hooks/magic-context/historian-prompt-fit.d.ts +2 -0
  44. package/dist/hooks/magic-context/historian-prompt-fit.d.ts.map +1 -1
  45. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  46. package/dist/hooks/magic-context/pending-materialization.d.ts +2 -0
  47. package/dist/hooks/magic-context/pending-materialization.d.ts.map +1 -1
  48. package/dist/hooks/magic-context/protected-tail-boundary.d.ts +12 -0
  49. package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
  50. package/dist/hooks/magic-context/raw-exact-ordinal-read.d.ts +58 -0
  51. package/dist/hooks/magic-context/raw-exact-ordinal-read.d.ts.map +1 -0
  52. package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts +7 -0
  53. package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts.map +1 -1
  54. package/dist/hooks/magic-context/read-session-raw.d.ts +19 -0
  55. package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -1
  56. package/dist/hooks/magic-context/recomp-orchestrator.d.ts +2 -0
  57. package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -1
  58. package/dist/hooks/magic-context/transform-compartment-phase.d.ts +2 -0
  59. package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
  60. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  61. package/dist/hooks/magic-context/transform.d.ts +4 -0
  62. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  63. package/dist/hooks/magic-context/wrapup-orchestrator.d.ts.map +1 -1
  64. package/dist/{index-g40wgxxt.js → index-05n6ykca.js} +4 -4
  65. package/dist/{index-bzp9s8z2.js → index-1d289pq2.js} +2 -2
  66. package/dist/{index-w28y7d0z.js → index-1sarmj9z.js} +15 -15
  67. package/dist/{index-hqnggmxn.js → index-1wwh38fk.js} +128 -66
  68. package/dist/{index-0abg88h2.js → index-2pgxcncf.js} +4 -4
  69. package/dist/{index-84j7jq8a.js → index-6sytd5w3.js} +10 -10
  70. package/dist/{index-yhrrx7qa.js → index-6sz25c3s.js} +3 -3
  71. package/dist/{index-4jkhhpn1.js → index-7h8a1xpc.js} +3 -3
  72. package/dist/{index-se1w3v2m.js → index-7zd5asz9.js} +140 -17
  73. package/dist/{index-jw4gbfkv.js → index-8ketfacn.js} +2 -2
  74. package/dist/{index-q3qck7j2.js → index-95s8xaj1.js} +6 -5
  75. package/dist/{index-bmwfzz28.js → index-9vqb5p1s.js} +4 -4
  76. package/dist/{index-0jz47061.js → index-a8bvhwqs.js} +190 -30
  77. package/dist/{index-qr1mkc2y.js → index-b16gpywn.js} +9 -9
  78. package/dist/{index-g7jkrz0x.js → index-bp5083x2.js} +1 -1
  79. package/dist/{index-mp2kghkv.js → index-dyvbsvga.js} +1 -1
  80. package/dist/{index-s178h9z8.js → index-f71thw8j.js} +1 -1
  81. package/dist/{index-kvw6xew3.js → index-fkx2qnvw.js} +2 -2
  82. package/dist/{index-f8cn4xqa.js → index-fwefky9w.js} +18 -5
  83. package/dist/{index-4ccdr7yw.js → index-fx90bvjd.js} +5 -5
  84. package/dist/{index-0sahzkwr.js → index-g2q4htwp.js} +46 -2
  85. package/dist/{index-9159kk15.js → index-gf0psee3.js} +5 -5
  86. package/dist/{index-mw7c950g.js → index-gp3kcpc4.js} +1 -1
  87. package/dist/{index-gjvjh960.js → index-hqkczed7.js} +1 -1
  88. package/dist/{index-mvvephtj.js → index-j75v2476.js} +1 -1
  89. package/dist/{index-150zz6fh.js → index-k29z4aqh.js} +1 -1
  90. package/dist/{index-b64n4d0h.js → index-kee4kn5j.js} +1 -1
  91. package/dist/index-ksdyrrav.js +52 -0
  92. package/dist/{index-angx1s0k.js → index-mmfa86mt.js} +16 -6
  93. package/dist/{index-9jvab89d.js → index-n6m03s3n.js} +2 -2
  94. package/dist/{index-q28hsbpg.js → index-nj7yykkx.js} +1 -1
  95. package/dist/{index-ghc9f0n7.js → index-p5y3k4g7.js} +29 -1
  96. package/dist/{index-kkvxnbt8.js → index-qtbdx42g.js} +54 -25
  97. package/dist/{index-a865mj02.js → index-tdn0zkw4.js} +4 -4
  98. package/dist/{index-0j6crjgh.js → index-wqs4q74r.js} +8 -8
  99. package/dist/{index-xztdf9t7.js → index-x2xjyq8f.js} +11 -11
  100. package/dist/{index-a4b0gbyg.js → index-y9f76s3f.js} +1 -1
  101. package/dist/{index-z7avx6rw.js → index-yx5kgp2x.js} +197 -98
  102. package/dist/index.d.ts.map +1 -1
  103. package/dist/index.js +95 -67
  104. package/dist/{logger-wn328tfg.js → logger-jm3sqqzr.js} +2 -2
  105. package/dist/{message-index-bounded-0rbbg9rd.js → message-index-bounded-nq6rp8xa.js} +16 -16
  106. package/dist/{message-index-ct5x2kwa.js → message-index-df7swgy1.js} +16 -16
  107. package/dist/{message-time-backfill-nb5hhnrt.js → message-time-backfill-qjge9044.js} +3 -3
  108. package/dist/migration-worker.js +11 -11
  109. package/dist/plugin/dream-timer.d.ts.map +1 -1
  110. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  111. package/dist/plugin/tool-registry.d.ts.map +1 -1
  112. package/dist/{project-embedding-registry-ft9gh2e2.js → project-embedding-registry-q0ysjyzc.js} +11 -11
  113. package/dist/raw-ordinal-warmup-worker.js +12 -7
  114. package/dist/{read-session-chunk-y3hhsbzw.js → read-session-chunk-ax05f7gr.js} +11 -11
  115. package/dist/{read-session-raw-gm6xj30v.js → read-session-raw-m56hc7v2.js} +7 -3
  116. package/dist/{recomp-orchestrator-67k45s0b.js → recomp-orchestrator-a0mvby4e.js} +29 -29
  117. package/dist/{safe-notification-target-jdynm677.js → safe-notification-target-1szv1k5k.js} +3 -3
  118. package/dist/{search-jd8xh721.js → search-fm002702.js} +23 -23
  119. package/dist/{send-session-notification-vzhj8bsg.js → send-session-notification-y2wg3fkh.js} +6 -6
  120. package/dist/shared/data-path.d.ts +4 -0
  121. package/dist/shared/data-path.d.ts.map +1 -1
  122. package/dist/{storage-tags-35m4gms2.js → storage-tags-yygfb9c8.js} +7 -5
  123. package/dist/{task-config-cgpg0nvh.js → task-config-x3qmayd2.js} +6 -2
  124. package/dist/tools/ctx-note/tools.d.ts.map +1 -1
  125. package/dist/{transform-postprocess-phase-pmqxfq4q.js → transform-postprocess-phase-s84rdf32.js} +29 -29
  126. package/dist/v2/auto-search-worker.js +4 -4
  127. package/dist/v2/{compaction-marker-candidates-a15w3mqh.js → compaction-marker-candidates-1vqwr3s5.js} +2 -2
  128. package/dist/v2/compaction-marker-candidates-worker.js +1 -1
  129. package/dist/v2/{context-p1zfcw41.js → context-x60fa16g.js} +181 -83
  130. package/dist/v2/{derive-budgets-0rmpmxjw.js → derive-budgets-z25jw3py.js} +3 -3
  131. package/dist/v2/embedding-backfill-mbjyza2a.js +20 -0
  132. package/dist/v2/embedding-worker-process.js +1 -1
  133. package/dist/v2/embedding-worker.js +5 -5
  134. package/dist/v2/{history-owner-2cr9py37.js → history-owner-42e16w0n.js} +2 -2
  135. package/dist/v2/hooks/context.d.ts.map +1 -1
  136. package/dist/v2/hooks/dream-manual.d.ts.map +1 -1
  137. package/dist/v2/hooks/dream-trigger.d.ts +1 -1
  138. package/dist/v2/hooks/dream-trigger.d.ts.map +1 -1
  139. package/dist/v2/hooks/transform-features.d.ts +1 -0
  140. package/dist/v2/hooks/transform-features.d.ts.map +1 -1
  141. package/dist/v2/{logger-te6e1j72.js → logger-7qt02bnb.js} +1 -1
  142. package/dist/v2/{message-index-cjhv92m2.js → message-index-5nayhm1r.js} +15 -15
  143. package/dist/v2/{message-index-bounded-7wcbp975.js → message-index-bounded-pgv1ndpb.js} +15 -15
  144. package/dist/v2/{message-time-backfill-rz1pnpaj.js → message-time-backfill-bsteyc4d.js} +2 -2
  145. package/dist/v2/migration-worker.js +10 -10
  146. package/dist/v2/{project-embedding-registry-g34gcf74.js → project-embedding-registry-jbmjc0p4.js} +10 -10
  147. package/dist/v2/raw-ordinal-warmup-worker.js +12 -7
  148. package/dist/v2/{read-session-chunk-8d3v87vr.js → read-session-chunk-hr3w5bjk.js} +10 -10
  149. package/dist/v2/{read-session-raw-h4azh85b.js → read-session-raw-b3tf6ra1.js} +6 -2
  150. package/dist/v2/recomp-orchestrator-8w3449eb.js +59 -0
  151. package/dist/v2/{safe-notification-target-936374xx.js → safe-notification-target-qg7n2s77.js} +2 -2
  152. package/dist/v2/{search-a1acjwf8.js → search-mhmxgq0e.js} +22 -22
  153. package/dist/v2/{send-session-notification-z5mcjdea.js → send-session-notification-jevgj9fe.js} +5 -5
  154. package/dist/v2/{server-npm52h2q.js → server-05xjtq6c.js} +1 -1
  155. package/dist/v2/{server-s6jqh8bj.js → server-0ppsweh6.js} +1 -1
  156. package/dist/v2/server-0s95v3en.js +49 -0
  157. package/dist/v2/{server-pbpp8r8h.js → server-25tg45b4.js} +9 -9
  158. package/dist/v2/{server-83d71zab.js → server-2x42esxd.js} +3 -3
  159. package/dist/v2/{server-5x7kmyz8.js → server-37ngj8qw.js} +10 -51
  160. package/dist/v2/{server-kn7skz9r.js → server-4c10404h.js} +3 -3
  161. package/dist/v2/{server-erfp0xb6.js → server-50mkkhy1.js} +10 -10
  162. package/dist/v2/{server-7fvmt15t.js → server-5gvkzzrf.js} +192 -49
  163. package/dist/v2/{server-7dv9wt9r.js → server-6pmqg9m4.js} +1 -1
  164. package/dist/v2/{server-h3wc20sv.js → server-83ygfha2.js} +4 -4
  165. package/dist/v2/{server-rxcq4t50.js → server-9ewkzqgd.js} +5 -5
  166. package/dist/v2/{server-kmapq3v0.js → server-bxpwy6fy.js} +18 -5
  167. package/dist/v2/{server-d6t16r89.js → server-d8tj10db.js} +1 -1
  168. package/dist/v2/{server-cxsr0ng6.js → server-da07v4xp.js} +1 -1
  169. package/dist/v2/{server-9e5r8y60.js → server-f2xf5gcb.js} +46 -2
  170. package/dist/v2/{server-hn9fb3v0.js → server-f7jfmrrz.js} +2 -2
  171. package/dist/v2/{server-f27he3j1.js → server-fa75w6gp.js} +4 -4
  172. package/dist/v2/{server-njnx39q2.js → server-gvkm8xaj.js} +189 -29
  173. package/dist/v2/{server-ckrb5rm8.js → server-h0410h0v.js} +1 -1
  174. package/dist/v2/{server-nveratm5.js → server-kn9n2qgd.js} +1 -1
  175. package/dist/v2/{server-wkhfyzpg.js → server-m97brnat.js} +9 -9
  176. package/dist/v2/{server-d3f4g62c.js → server-nmrm2rjy.js} +8 -8
  177. package/dist/v2/{server-bx59ezg6.js → server-prg55b7k.js} +16 -6
  178. package/dist/v2/{server-89fcbe37.js → server-pwv4ezb0.js} +1 -1
  179. package/dist/v2/{server-r5p3b1wy.js → server-qd11g795.js} +29 -1
  180. package/dist/v2/{server-988cqjme.js → server-rrqpvwqd.js} +2 -2
  181. package/dist/v2/{server-sg68np13.js → server-sz8jj92q.js} +140 -17
  182. package/dist/v2/{server-jc8v585p.js → server-th4y11y7.js} +15 -15
  183. package/dist/v2/{server-ewqshbs8.js → server-vknbt0gq.js} +5 -5
  184. package/dist/v2/{server-63ha7f0f.js → server-yrvqaswb.js} +1 -1
  185. package/dist/v2/{server-xqf2d2mg.js → server-zs8d0s3b.js} +2 -2
  186. package/dist/v2/server.d.ts.map +1 -1
  187. package/dist/v2/server.js +13 -6
  188. package/dist/v2/{storage-tags-c4zfcxv4.js → storage-tags-a2gq6dw7.js} +6 -4
  189. package/dist/v2/{task-config-x0hq3qfd.js → task-config-nvz8mapa.js} +6 -2
  190. package/dist/v2/{wrapup-orchestrator-87q9d5e2.js → wrapup-orchestrator-r82y780v.js} +30 -29
  191. package/dist/wrapup-orchestrator-vmt6z3q5.js +47 -0
  192. package/package.json +1 -1
  193. package/src/agents/smart-notes-dreamer-gate.fixture.ts +171 -0
  194. package/src/agents/smart-notes-dreamer-gate.golden.json +245 -0
  195. package/src/agents/smart-notes-dreamer-gate.test.ts +161 -0
  196. package/src/config/agent-disable.ts +13 -0
  197. package/src/config/dependency-notes.test.ts +114 -0
  198. package/src/config/dependency-notes.ts +80 -0
  199. package/src/config/schema/magic-context.ts +23 -14
  200. package/src/features/magic-context/dreamer/task-registry.ts +40 -0
  201. package/src/shared/data-path.test.ts +35 -1
  202. package/src/shared/data-path.ts +57 -1
  203. package/dist/embedding-backfill-fjbfh1dt.js +0 -21
  204. package/dist/v2/embedding-backfill-xcw3t6hp.js +0 -20
  205. package/dist/v2/recomp-orchestrator-n0pq36f0.js +0 -59
  206. package/dist/wrapup-orchestrator-jqapepw0.js +0 -47
package/dist/v2/server.js CHANGED
@@ -1,15 +1,18 @@
1
1
  import {
2
2
  loadPluginConfigDetailed
3
- } from "./server-5x7kmyz8.js";
3
+ } from "./server-37ngj8qw.js";
4
4
  import {
5
5
  setHarness2
6
6
  } from "./server-pavzsdc6.js";
7
7
  import {
8
+ getMagicContextStorageDir,
9
+ isMagicContextStorageOutsideEngram,
10
+ claimStorageBackupWarningCheck,
8
11
  registerStalePluginBuildHost,
9
12
  log2,
10
13
  flushLogger2
11
- } from "./server-9e5r8y60.js";
12
- import"./server-nveratm5.js";
14
+ } from "./server-f2xf5gcb.js";
15
+ import"./server-kn9n2qgd.js";
13
16
  import {
14
17
  string,
15
18
  unknown,
@@ -18,7 +21,7 @@ import {
18
21
  union,
19
22
  tuple,
20
23
  record
21
- } from "./server-jc8v585p.js";
24
+ } from "./server-th4y11y7.js";
22
25
  import {
23
26
  pushNotification2
24
27
  } from "./server-x8a7jmkh.js";
@@ -7871,7 +7874,7 @@ var require_src2 = __commonJS(function(exports, module) {
7871
7874
  // package.json
7872
7875
  var package_default = {
7873
7876
  name: "@cortexkit/opencode-magic-context",
7874
- version: "0.49.11",
7877
+ version: "0.49.12",
7875
7878
  type: "module",
7876
7879
  description: "OpenCode plugin for Magic Context — cross-session memory and context management",
7877
7880
  main: "dist/index.js",
@@ -8187,7 +8190,11 @@ async function setup(context) {
8187
8190
  log2("v2 setup() called on a host without session.hook; v1 server lane owns this host, v2 lane inert");
8188
8191
  return async () => {};
8189
8192
  }
8190
- const { registerContext } = await import("./context-p1zfcw41.js");
8193
+ const storageDir = getMagicContextStorageDir();
8194
+ if (claimStorageBackupWarningCheck() && isMagicContextStorageOutsideEngram(storageDir)) {
8195
+ log2(`[magic-context] Magic Context storage is at ${storageDir}, outside the folder Engram backs up (~/.local/share/cortexkit/magic-context). It is not included in CortexKit backups.`);
8196
+ }
8197
+ const { registerContext } = await import("./context-x60fa16g.js");
8191
8198
  setHarness2("opencode2");
8192
8199
  bindStaleBuildNotice({}, import.meta.url, "opencode2");
8193
8200
  const duties = await registerContext(context);
@@ -22,6 +22,7 @@ import {
22
22
  backfillTagTokenCounts2,
23
23
  insertTag2,
24
24
  updateTagStatus2,
25
+ markTagDropped2,
25
26
  markWhitespaceAssistantTagInert2,
26
27
  getInertWhitespaceAssistantTags2,
27
28
  getInertWhitespaceAssistantTagsByNumbers2,
@@ -60,12 +61,12 @@ import {
60
61
  adoptNullOwnerToolTag2,
61
62
  getCandidateToolOwners2,
62
63
  pickNearestPriorOwner2
63
- } from "./server-kmapq3v0.js";
64
+ } from "./server-bxpwy6fy.js";
64
65
  import"./server-1zx87sdm.js";
65
- import"./server-89fcbe37.js";
66
- import"./server-s6jqh8bj.js";
66
+ import"./server-pwv4ezb0.js";
67
+ import"./server-0ppsweh6.js";
67
68
  import"./server-wafzvyhg.js";
68
- import"./server-9e5r8y60.js";
69
+ import"./server-f2xf5gcb.js";
69
70
  import"./server-pavzsdc6.js";
70
71
  export {
71
72
  AGE_RECLAIM_MIN_TOKENS2 as AGE_RECLAIM_MIN_TOKENS,
@@ -117,6 +118,7 @@ export {
117
118
  installTagOwnerDelta2 as installTagOwnerDelta,
118
119
  installTagOwnerSummary2 as installTagOwnerSummary,
119
120
  isTagOwnerSummaryReady2 as isTagOwnerSummaryReady,
121
+ markTagDropped2 as markTagDropped,
120
122
  markTagsCompactedByMessageIds2 as markTagsCompactedByMessageIds,
121
123
  markWhitespaceAssistantTagInert2 as markWhitespaceAssistantTagInert,
122
124
  pickNearestPriorOwner2 as pickNearestPriorOwner,
@@ -1,11 +1,13 @@
1
1
  import {
2
2
  buildDreamTaskRuntimeConfigs2,
3
3
  userMemoryCollectionEnabled2,
4
+ userObservationCollectionEnabled2,
5
+ userObservationsRequested2,
4
6
  userMemoryPromotionThreshold2,
5
7
  dreamTaskScheduled2,
6
8
  enabledDreamTasks2,
7
9
  summarizeDreamSchedule2
8
- } from "./server-r5p3b1wy.js";
10
+ } from "./server-qd11g795.js";
9
11
  import"./server-8cd2j99z.js";
10
12
  export {
11
13
  buildDreamTaskRuntimeConfigs2 as buildDreamTaskRuntimeConfigs,
@@ -13,5 +15,7 @@ export {
13
15
  enabledDreamTasks2 as enabledDreamTasks,
14
16
  summarizeDreamSchedule2 as summarizeDreamSchedule,
15
17
  userMemoryCollectionEnabled2 as userMemoryCollectionEnabled,
16
- userMemoryPromotionThreshold2 as userMemoryPromotionThreshold
18
+ userMemoryPromotionThreshold2 as userMemoryPromotionThreshold,
19
+ userObservationCollectionEnabled2 as userObservationCollectionEnabled,
20
+ userObservationsRequested2 as userObservationsRequested
17
21
  };
@@ -1,8 +1,8 @@
1
1
  import"./server-pavzsdc6.js";
2
2
  import {
3
3
  sessionLog2
4
- } from "./server-9e5r8y60.js";
5
- import"./server-cxsr0ng6.js";
4
+ } from "./server-f2xf5gcb.js";
5
+ import"./server-da07v4xp.js";
6
6
  import {
7
7
  COMPARTMENT_LEASE_RENEWAL_MS,
8
8
  acquireCompartmentLease,
@@ -19,15 +19,15 @@ import {
19
19
  registerActiveCompartmentRun,
20
20
  setRecompStarting2,
21
21
  setRecompTerminal2
22
- } from "./server-7fvmt15t.js";
23
- import"./server-s6jqh8bj.js";
24
- import"./server-988cqjme.js";
22
+ } from "./server-5gvkzzrf.js";
23
+ import"./server-0ppsweh6.js";
24
+ import"./server-rrqpvwqd.js";
25
25
  import {
26
26
  inRootAsyncContext2
27
27
  } from "./server-wafzvyhg.js";
28
- import"./server-63ha7f0f.js";
29
- import"./server-ewqshbs8.js";
30
- import"./server-d3f4g62c.js";
28
+ import"./server-yrvqaswb.js";
29
+ import"./server-vknbt0gq.js";
30
+ import"./server-nmrm2rjy.js";
31
31
  import {
32
32
  getWrapupInProgressState,
33
33
  acquireWrapupInProgress,
@@ -36,40 +36,40 @@ import {
36
36
  getHistorianFailureState,
37
37
  clearEmergencyRecovery,
38
38
  prepareRawSessionOrdinals2
39
- } from "./server-wkhfyzpg.js";
40
- import"./server-89fcbe37.js";
41
- import"./server-erfp0xb6.js";
39
+ } from "./server-m97brnat.js";
40
+ import"./server-pwv4ezb0.js";
41
+ import"./server-50mkkhy1.js";
42
42
  import"./server-1zx87sdm.js";
43
- import"./server-kmapq3v0.js";
44
- import"./server-jc8v585p.js";
43
+ import"./server-bxpwy6fy.js";
44
+ import"./server-th4y11y7.js";
45
45
  import"./server-51779zs2.js";
46
- import"./server-bx59ezg6.js";
46
+ import"./server-prg55b7k.js";
47
47
  import"./server-2ra6pwf3.js";
48
- import"./server-d6t16r89.js";
49
- import"./server-xqf2d2mg.js";
48
+ import"./server-d8tj10db.js";
49
+ import"./server-zs8d0s3b.js";
50
50
  import"./server-fr0wbhdn.js";
51
- import"./server-f27he3j1.js";
52
- import"./server-njnx39q2.js";
53
- import"./server-sg68np13.js";
51
+ import"./server-fa75w6gp.js";
52
+ import"./server-gvkm8xaj.js";
53
+ import"./server-sz8jj92q.js";
54
54
  import"./server-fb3zxn06.js";
55
- import"./server-kn7skz9r.js";
55
+ import"./server-4c10404h.js";
56
56
  import {
57
57
  pushNotification2
58
58
  } from "./server-x8a7jmkh.js";
59
- import"./server-npm52h2q.js";
59
+ import"./server-05xjtq6c.js";
60
60
  import"./server-qt1qqasc.js";
61
61
  import"./server-4dhv7mqz.js";
62
- import"./server-83d71zab.js";
63
- import"./server-rxcq4t50.js";
62
+ import"./server-2x42esxd.js";
63
+ import"./server-9ewkzqgd.js";
64
64
  import"./server-n78avt2p.js";
65
- import"./server-5x7kmyz8.js";
66
- import"./server-nveratm5.js";
67
- import"./server-hn9fb3v0.js";
68
- import"./server-ckrb5rm8.js";
65
+ import"./server-37ngj8qw.js";
66
+ import"./server-kn9n2qgd.js";
67
+ import"./server-f7jfmrrz.js";
68
+ import"./server-h0410h0v.js";
69
69
  import {
70
70
  sendStatusNotification2
71
- } from "./server-h3wc20sv.js";
72
- import"./server-7dv9wt9r.js";
71
+ } from "./server-83ygfha2.js";
72
+ import"./server-6pmqg9m4.js";
73
73
 
74
74
  // src/hooks/magic-context/wrapup-orchestrator.ts
75
75
  import * as crypto from "node:crypto";
@@ -223,6 +223,7 @@ async function runOneWrapupIteration(args) {
223
223
  memoryEnabled: ctx.memoryEnabled,
224
224
  autoPromote: ctx.autoPromote,
225
225
  experimentalUserMemories: ctx.userMemoriesEnabled,
226
+ userObservationsRequested: ctx.userObservationsRequested,
226
227
  ensureProjectRegistered: ctx.ensureProjectRegistered,
227
228
  getNotificationParams: () => ctx.getNotificationParams(sessionId),
228
229
  preserveInjectionCacheUntilConsumed: true,
@@ -0,0 +1,47 @@
1
+ import {
2
+ runManagedWrapup2
3
+ } from "./index-95s8xaj1.js";
4
+ import"./index-05n6ykca.js";
5
+ import"./index-yx5kgp2x.js";
6
+ import"./index-f71thw8j.js";
7
+ import"./index-6sz25c3s.js";
8
+ import"./index-wqs4q74r.js";
9
+ import"./index-sd3egckz.js";
10
+ import"./index-fx90bvjd.js";
11
+ import"./index-n78avt2p.js";
12
+ import"./index-7zd5asz9.js";
13
+ import"./index-gf0psee3.js";
14
+ import"./index-4dhv7mqz.js";
15
+ import"./index-8ketfacn.js";
16
+ import"./index-2pgxcncf.js";
17
+ import"./index-qt1qqasc.js";
18
+ import"./index-x8a7jmkh.js";
19
+ import"./index-y9f76s3f.js";
20
+ import"./index-9vqb5p1s.js";
21
+ import"./index-fkx2qnvw.js";
22
+ import"./index-x2xjyq8f.js";
23
+ import"./index-tdn0zkw4.js";
24
+ import"./index-fb3zxn06.js";
25
+ import"./index-fr0wbhdn.js";
26
+ import"./index-a8bvhwqs.js";
27
+ import"./index-dyvbsvga.js";
28
+ import"./index-nj7yykkx.js";
29
+ import"./index-b16gpywn.js";
30
+ import"./index-fwefky9w.js";
31
+ import"./index-1zx87sdm.js";
32
+ import"./index-1d289pq2.js";
33
+ import"./index-mmfa86mt.js";
34
+ import"./index-v0p37hm2.js";
35
+ import"./index-1sarmj9z.js";
36
+ import"./index-n6m03s3n.js";
37
+ import"./index-bp5083x2.js";
38
+ import"./index-58e3y90n.js";
39
+ import"./index-k29z4aqh.js";
40
+ import"./index-hqkczed7.js";
41
+ import"./index-wafzvyhg.js";
42
+ import"./index-j75v2476.js";
43
+ import"./index-g2q4htwp.js";
44
+ import"./index-pavzsdc6.js";
45
+ export {
46
+ runManagedWrapup2 as runManagedWrapup
47
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/opencode-magic-context",
3
- "version": "0.49.11",
3
+ "version": "0.49.12",
4
4
  "type": "module",
5
5
  "description": "OpenCode plugin for Magic Context — cross-session memory and context management",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,171 @@
1
+ /**
2
+ * Shared harness for the smart-note/dreamer tool-surface differential.
3
+ *
4
+ * `gateCases` draws a deterministic, seeded set of raw configs that vary every
5
+ * setting the ctx_* tool list depends on. `renderToolSurfaces` renders the
6
+ * OpenCode 1 registry and the OpenCode 2 registration plus per-request rewrite
7
+ * for one parsed config and returns, per host, a short digest of ctx_note and
8
+ * one of every other tool together.
9
+ *
10
+ * The committed golden (`smart-notes-dreamer-gate.golden.json`) holds these
11
+ * digests as produced by the code before the dreamer gate existed, so the test
12
+ * can prove that every config with a runnable dreamer still gets those exact
13
+ * bytes. The OpenCode 2 per-request smart-note flag is a parameter because the
14
+ * production call site computes it: the golden was rendered with the old
15
+ * `config.smart_notes.enabled` argument.
16
+ */
17
+ import { createHash } from "node:crypto";
18
+ import { tool } from "@opencode-ai/plugin";
19
+ import type { MagicContextPluginConfig } from "../config";
20
+ import { createToolRegistry } from "../plugin/tool-registry";
21
+ import { createPromptSurfaceRuntime } from "../shared/prompt-surface-runtime";
22
+ import type { Database } from "../shared/sqlite";
23
+ import { applyV2PromptSurfaceTools } from "../v2/hooks/context";
24
+ import { registerTools } from "../v2/hooks/tools";
25
+
26
+ export const GATE_CASE_COUNT = 240;
27
+ const GATE_SEED = 715;
28
+
29
+ /** mulberry32: a tiny deterministic PRNG so the case list is reproducible. */
30
+ function prng(seed: number): () => number {
31
+ let state = seed >>> 0;
32
+ return () => {
33
+ state = (state + 0x6d2b79f5) >>> 0;
34
+ let t = state;
35
+ t = Math.imul(t ^ (t >>> 15), t | 1);
36
+ t ^= t + Math.imul(t ^ (t >>> 7), t | 61);
37
+ return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
38
+ };
39
+ }
40
+
41
+ const SMART_NOTES = [undefined, { enabled: true }, { enabled: false }];
42
+ const DREAMERS = [
43
+ undefined,
44
+ {},
45
+ { disable: false },
46
+ { disable: true },
47
+ { inject_docs: false },
48
+ { disable: true, inject_docs: false },
49
+ { tasks: { "review-user-memories": { schedule: "" } } },
50
+ { disable: true, tasks: { "evaluate-smart-notes": { schedule: "" } } },
51
+ ];
52
+ const MEMORY = [undefined, { enabled: true }, { enabled: false }];
53
+ const COMPACTION = [undefined, { enabled: true }, { enabled: false }];
54
+ const PROMPT_SURFACE = [
55
+ undefined,
56
+ { default: "full" },
57
+ { default: "light" },
58
+ { default: "full", models: { "mock/model": "light" } },
59
+ ];
60
+
61
+ export function gateCases(): Record<string, unknown>[] {
62
+ const next = prng(GATE_SEED);
63
+ const pick = <T>(values: readonly T[]): T => values[Math.floor(next() * values.length)] as T;
64
+ return Array.from({ length: GATE_CASE_COUNT }, () => {
65
+ const raw: Record<string, unknown> = {};
66
+ const entries: Array<[string, unknown]> = [
67
+ ["smart_notes", pick(SMART_NOTES)],
68
+ ["dreamer", pick(DREAMERS)],
69
+ ["memory", pick(MEMORY)],
70
+ ["compaction", pick(COMPACTION)],
71
+ ["prompt_surface", pick(PROMPT_SURFACE)],
72
+ ];
73
+ for (const [key, value] of entries)
74
+ if (value !== undefined) raw[key] = structuredClone(value);
75
+ return raw;
76
+ });
77
+ }
78
+
79
+ const shortDigest = (value: unknown) =>
80
+ createHash("sha256").update(JSON.stringify(value)).digest("hex").slice(0, 16);
81
+
82
+ /** `note` digests ctx_note's { description, schema }; `other` digests every other tool. */
83
+ export interface HostDigests {
84
+ note: string;
85
+ other: string;
86
+ }
87
+
88
+ export interface ToolSurfaceDigests {
89
+ /** OpenCode 1 registry. */
90
+ oc1: HostDigests;
91
+ /** OpenCode 2 registration after the per-request description rewrite. */
92
+ oc2: HostDigests;
93
+ /** Full text per host, kept out of the golden; used for content checks. */
94
+ text: { oc1: string; oc2: string };
95
+ }
96
+
97
+ export async function renderToolSurfaces(args: {
98
+ config: MagicContextPluginConfig;
99
+ directory: string;
100
+ db: Database;
101
+ /** The smart-note flag the OpenCode 2 per-request rewrite receives. */
102
+ oc2SmartNotes: boolean;
103
+ }): Promise<ToolSurfaceDigests> {
104
+ const { config, directory, db } = args;
105
+ const warn = () => {};
106
+ const registry = createToolRegistry({
107
+ ctx: { directory } as never,
108
+ pluginConfig: config,
109
+ promptSurfaceRuntime: createPromptSurfaceRuntime({ harness: "opencode", directory, warn }),
110
+ });
111
+ const oc1Surfaces = Object.fromEntries(
112
+ Object.entries(registry)
113
+ .sort(([left], [right]) => (left < right ? -1 : left > right ? 1 : 0))
114
+ .map(([name, definition]) => {
115
+ return [
116
+ name,
117
+ {
118
+ description: definition.description,
119
+ schema: tool.schema.toJSONSchema(tool.schema.object(definition.args)),
120
+ },
121
+ ];
122
+ }),
123
+ );
124
+
125
+ const registered: Array<{ name: string; description: string; input: unknown }> = [];
126
+ await registerTools(
127
+ {
128
+ location: { directory },
129
+ tool: {
130
+ transform: async (callback: (editor: unknown) => void) =>
131
+ callback({ add: (definition: never) => registered.push(definition) }),
132
+ },
133
+ } as never,
134
+ db,
135
+ config,
136
+ );
137
+ const draft = {
138
+ sessionID: "ses-gate",
139
+ model: { providerID: "mock", id: "model" },
140
+ tools: Object.fromEntries(
141
+ registered.map((definition) => [
142
+ definition.name,
143
+ {
144
+ description: definition.description,
145
+ input: structuredClone(definition.input),
146
+ },
147
+ ]),
148
+ ),
149
+ };
150
+ applyV2PromptSurfaceTools(
151
+ draft as never,
152
+ createPromptSurfaceRuntime({ harness: "opencode2", directory, warn }),
153
+ config.prompt_surface,
154
+ args.oc2SmartNotes,
155
+ );
156
+ const oc2Surfaces = Object.fromEntries(
157
+ Object.keys(draft.tools)
158
+ .sort()
159
+ .map((name) => [name, draft.tools[name]]),
160
+ );
161
+
162
+ const digests = (surfaces: Record<string, unknown>): HostDigests => {
163
+ const { ctx_note: note, ...other } = surfaces;
164
+ return { note: shortDigest(note ?? null), other: shortDigest(other) };
165
+ };
166
+ return {
167
+ oc1: digests(oc1Surfaces),
168
+ oc2: digests(oc2Surfaces),
169
+ text: { oc1: JSON.stringify(oc1Surfaces), oc2: JSON.stringify(oc2Surfaces) },
170
+ };
171
+ }