@cortexkit/opencode-magic-context 0.49.57 → 0.49.60

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 (162) hide show
  1. package/dist/{announcement-9pr71hd5.js → announcement-p41dde4h.js} +2 -2
  2. package/dist/auto-search-worker.js +5 -5
  3. package/dist/chunk-embedding-write-worker.js +13 -13
  4. package/dist/{compaction-marker-candidates-8hazqfvj.js → compaction-marker-candidates-1ndjqh9k.js} +2 -2
  5. package/dist/compaction-marker-candidates-worker.js +1 -1
  6. package/dist/{compartment-chunk-embedding-gfd093f8.js → compartment-chunk-embedding-ymc9mtwv.js} +7 -7
  7. package/dist/{conflict-warning-hook-56qpq7ws.js → conflict-warning-hook-m8yezwdj.js} +7 -7
  8. package/dist/{context-a617pcqe.js → context-45fde2p4.js} +41 -40
  9. package/dist/{derive-budgets-z53424qx.js → derive-budgets-def8genf.js} +2 -2
  10. package/dist/{embedding-backfill-2dvf3rcn.js → embedding-backfill-sk7agn5v.js} +12 -12
  11. package/dist/embedding-worker-process.js +1 -1
  12. package/dist/embedding-worker.js +4 -4
  13. package/dist/{history-owner-n50e0e8y.js → history-owner-xqfsvf9k.js} +2 -2
  14. package/dist/hooks/magic-context/command-handler.d.ts +2 -0
  15. package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
  16. package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
  17. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  18. package/dist/{index-5ptp2de1.js → index-0cz8bsyx.js} +9 -9
  19. package/dist/{index-r9agn061.js → index-1sq1krqw.js} +4 -4
  20. package/dist/{index-b6rdv8re.js → index-3hk445am.js} +4 -4
  21. package/dist/{index-x8e50d8f.js → index-3wq9btxt.js} +5 -5
  22. package/dist/{index-by14cr73.js → index-3yyfftqq.js} +11 -11
  23. package/dist/{index-3600gm9z.js → index-4yjn3er4.js} +113 -73
  24. package/dist/{index-0tz2fzpq.js → index-5vsk2cpp.js} +1 -1
  25. package/dist/{index-90z05d0p.js → index-832w615x.js} +1 -1
  26. package/dist/{index-sk6p6esd.js → index-8sc7vqt7.js} +4 -4
  27. package/dist/{index-cd3vp8xa.js → index-98qy103c.js} +1 -1
  28. package/dist/{index-29ff546v.js → index-d0feqcs5.js} +6 -6
  29. package/dist/{index-gz001bx7.js → index-e6ncz7a6.js} +1 -1
  30. package/dist/{index-reyws9fy.js → index-esqcwes7.js} +1 -1
  31. package/dist/{index-h62j8z2r.js → index-ev2rrjfc.js} +4 -4
  32. package/dist/{index-sx1sppd6.js → index-gq1g9a3a.js} +8 -8
  33. package/dist/{index-ga5q492k.js → index-gqf8r04r.js} +1 -1
  34. package/dist/{index-qperbvjn.js → index-jg7sbt3v.js} +2 -2
  35. package/dist/{index-9mggb1nv.js → index-jrj95cce.js} +2 -2
  36. package/dist/{index-1wsb0e8h.js → index-kv4ntrr6.js} +5 -5
  37. package/dist/{index-tad3can2.js → index-m0pwswv9.js} +1 -1
  38. package/dist/{index-pdh4tdcq.js → index-n6aye6ny.js} +2 -2
  39. package/dist/{index-gapnh6tk.js → index-ngwmx6nt.js} +8 -3
  40. package/dist/{index-hsyczpn7.js → index-pxnzyvjc.js} +2 -2
  41. package/dist/{index-kn1bx21r.js → index-pzvdf7sr.js} +3 -3
  42. package/dist/{index-36wseasx.js → index-q7q6qp1f.js} +1 -1
  43. package/dist/{index-0r2jk2na.js → index-qdver0af.js} +14 -14
  44. package/dist/{index-zyanqxtc.js → index-s2jdky2x.js} +3 -3
  45. package/dist/{index-pdnan1e3.js → index-s2qsd3w9.js} +7 -7
  46. package/dist/{index-2ny9xwdn.js → index-s32f8y67.js} +2 -2
  47. package/dist/{index-hexdee98.js → index-snbpdpa3.js} +4 -4
  48. package/dist/{index-dhdv88e5.js → index-tebcx987.js} +1 -1
  49. package/dist/{index-5gqszjq9.js → index-tq20edcs.js} +3 -3
  50. package/dist/{index-0k283v27.js → index-tzy5h4x6.js} +1 -1
  51. package/dist/{index-em92bp7f.js → index-x40zr813.js} +2 -2
  52. package/dist/{index-sv5tn72j.js → index-xx05vta0.js} +4 -4
  53. package/dist/{index-82dfe8en.js → index-ywrz4wy2.js} +9 -4
  54. package/dist/{index-bev3zks1.js → index-ywxvdwmj.js} +9 -9
  55. package/dist/{index-xstbytjn.js → index-zb4h9nrk.js} +2 -2
  56. package/dist/{index-2vsd5064.js → index-zxj39ba2.js} +4 -4
  57. package/dist/{index-wpcjxzrm.js → index-zz4k3f65.js} +39 -39
  58. package/dist/index.js +51 -50
  59. package/dist/{logger-sw7z6sjz.js → logger-d7c8akh9.js} +1 -1
  60. package/dist/{message-fts-rowid-map-kx1bsdyg.js → message-fts-rowid-map-0xx8ge09.js} +4 -4
  61. package/dist/{message-index-bounded-xav3h8qe.js → message-index-bounded-f6yz4xq8.js} +10 -10
  62. package/dist/{message-time-backfill-hp2jgn49.js → message-time-backfill-pz5981mf.js} +2 -2
  63. package/dist/migration-worker.js +10 -10
  64. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  65. package/dist/{project-embedding-registry-f2azrq24.js → project-embedding-registry-c2sfnamh.js} +11 -11
  66. package/dist/raw-ordinal-warmup-worker.js +8 -8
  67. package/dist/{read-session-chunk-70aam2c1.js → read-session-chunk-8b1g06nz.js} +8 -8
  68. package/dist/{read-session-raw-04ger9zt.js → read-session-raw-3sc9231y.js} +2 -2
  69. package/dist/{recomp-orchestrator-xwsjrqcs.js → recomp-orchestrator-7s8nyzhy.js} +29 -29
  70. package/dist/{render-22ebrmep.js → render-nrfbtkkw.js} +19 -19
  71. package/dist/{safe-notification-target-mx5khyxf.js → safe-notification-target-d21swr3n.js} +2 -2
  72. package/dist/{search-archive-bqqf5p7f.js → search-archive-1ppdjfm9.js} +10 -10
  73. package/dist/{search-jfwb4ms3.js → search-xha0r30f.js} +22 -22
  74. package/dist/{send-session-notification-gamjee2f.js → send-session-notification-ykvt5k2s.js} +5 -5
  75. package/dist/shared/data-path.d.ts +31 -36
  76. package/dist/shared/data-path.d.ts.map +1 -1
  77. package/dist/shared/models-dev-cache.d.ts.map +1 -1
  78. package/dist/shared/test-temp-dir.d.ts +28 -0
  79. package/dist/shared/test-temp-dir.d.ts.map +1 -1
  80. package/dist/shared/window-geometry.d.ts.map +1 -1
  81. package/dist/{storage-tags-arnkn5t1.js → storage-tags-spet01yb.js} +5 -5
  82. package/dist/{transform-postprocess-phase-nejydt3q.js → transform-postprocess-phase-fxp1atm1.js} +30 -30
  83. package/dist/v2/auto-search-worker.js +5 -5
  84. package/dist/v2/chunk-embedding-write-worker.js +13 -13
  85. package/dist/v2/{compaction-marker-candidates-re14353a.js → compaction-marker-candidates-bp1bn579.js} +2 -2
  86. package/dist/v2/compaction-marker-candidates-worker.js +1 -1
  87. package/dist/v2/{compartment-chunk-embedding-0pxsrzrt.js → compartment-chunk-embedding-x6qw6mjk.js} +7 -7
  88. package/dist/v2/{context-4gxr2xd4.js → context-77g3jhf2.js} +43 -42
  89. package/dist/v2/{derive-budgets-w0815q82.js → derive-budgets-z93fdnp7.js} +3 -3
  90. package/dist/v2/{embedding-backfill-48qbnh7p.js → embedding-backfill-j2xj86zn.js} +12 -12
  91. package/dist/v2/embedding-worker-process.js +1 -1
  92. package/dist/v2/embedding-worker.js +4 -4
  93. package/dist/v2/{history-owner-ep91wgqj.js → history-owner-260djmv5.js} +2 -2
  94. package/dist/v2/hooks/claude-agent-instructions.d.ts +27 -0
  95. package/dist/v2/hooks/claude-agent-instructions.d.ts.map +1 -0
  96. package/dist/v2/hooks/context.d.ts.map +1 -1
  97. package/dist/v2/hooks/hidden-child.d.ts +15 -2
  98. package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
  99. package/dist/v2/{logger-xnscpj6w.js → logger-zyf43np1.js} +1 -1
  100. package/dist/v2/{message-fts-rowid-map-57jh6xpb.js → message-fts-rowid-map-n8mcvcpz.js} +4 -4
  101. package/dist/v2/{message-index-bounded-sw8hyqw1.js → message-index-bounded-0w8eh8fc.js} +10 -10
  102. package/dist/v2/{message-time-backfill-baxebka0.js → message-time-backfill-ynb3vg6r.js} +2 -2
  103. package/dist/v2/migration-worker.js +10 -10
  104. package/dist/v2/{project-embedding-registry-kwahtjgg.js → project-embedding-registry-k0hjqt11.js} +11 -11
  105. package/dist/v2/raw-ordinal-warmup-worker.js +8 -8
  106. package/dist/v2/{read-session-chunk-nqkn0yb4.js → read-session-chunk-dxs1tgt9.js} +8 -8
  107. package/dist/v2/{read-session-raw-3e482h3c.js → read-session-raw-wg5zc29f.js} +2 -2
  108. package/dist/v2/{recomp-orchestrator-1de5c0zr.js → recomp-orchestrator-zc1wdv9q.js} +30 -30
  109. package/dist/v2/{render-g44ksejs.js → render-9knrdrjs.js} +19 -19
  110. package/dist/v2/{safe-notification-target-9r79xnbt.js → safe-notification-target-y55z2zat.js} +2 -2
  111. package/dist/v2/{search-8dc9ex0a.js → search-a2a0qs3t.js} +21 -21
  112. package/dist/v2/{search-archive-5ycchnyp.js → search-archive-2jmyvj69.js} +10 -10
  113. package/dist/v2/{send-session-notification-95p89k7q.js → send-session-notification-8g4r97bp.js} +5 -5
  114. package/dist/v2/{server-sa1fdt41.js → server-2adwe0be.js} +8 -3
  115. package/dist/v2/{server-7vrtk78d.js → server-3ap5dmhc.js} +1 -1
  116. package/dist/v2/{server-avfc9ezb.js → server-4r86tcs2.js} +3 -3
  117. package/dist/v2/{server-np27dgyt.js → server-5sbsnpkn.js} +1 -1
  118. package/dist/v2/{server-rz5jnhnv.js → server-6ash6z8z.js} +1 -1
  119. package/dist/v2/{server-beydmd68.js → server-88n85n60.js} +4 -4
  120. package/dist/v2/{server-dqwx9pdh.js → server-8hcxmt1w.js} +115 -75
  121. package/dist/v2/{server-g61hgy1y.js → server-8pdfmc27.js} +4 -4
  122. package/dist/v2/{server-gge95a03.js → server-8ycacd59.js} +6 -6
  123. package/dist/v2/{server-t5c8awdm.js → server-9ab9jnpq.js} +3 -3
  124. package/dist/v2/{server-r7nj8ga0.js → server-9m5r04ws.js} +5 -5
  125. package/dist/v2/{server-5p0bjk3y.js → server-9sf3qp02.js} +2 -2
  126. package/dist/v2/{server-5kgesxck.js → server-aewxmvnf.js} +2 -2
  127. package/dist/v2/{server-3yk44ddz.js → server-afsz3cmx.js} +1 -1
  128. package/dist/v2/{server-c8z2grq0.js → server-at0v0z4t.js} +1 -1
  129. package/dist/v2/{server-v817sf79.js → server-d07yxksx.js} +2 -2
  130. package/dist/v2/{server-kwtnrhv3.js → server-d706s5xn.js} +2 -2
  131. package/dist/v2/{server-ycvqg2s3.js → server-d9aayyxk.js} +4 -4
  132. package/dist/v2/{server-966dq3pd.js → server-ds8vpfkr.js} +2 -2
  133. package/dist/v2/{server-bb6kf05j.js → server-j8376q08.js} +9 -4
  134. package/dist/v2/{server-7waad75d.js → server-ja6swvmb.js} +11 -11
  135. package/dist/v2/{server-tmf0ayqp.js → server-jdfe07mp.js} +1 -1
  136. package/dist/v2/{server-6k0rnwbd.js → server-jn4pktdk.js} +4 -4
  137. package/dist/v2/{server-qp5sj6n5.js → server-jtq03rkb.js} +2 -2
  138. package/dist/v2/{server-91gb0vh8.js → server-npdey91q.js} +1 -1
  139. package/dist/v2/{server-vqq3g1t7.js → server-qjff96a6.js} +4 -4
  140. package/dist/v2/{server-4x0xq8a1.js → server-rbtx6q5v.js} +1 -1
  141. package/dist/v2/{server-jwydbwcx.js → server-svx20ra2.js} +4 -4
  142. package/dist/v2/{server-v57wr0r9.js → server-t8tmrtcg.js} +9 -9
  143. package/dist/v2/{server-0ayyh3mx.js → server-tzh55x6d.js} +9 -9
  144. package/dist/v2/{server-mxsy9h1d.js → server-x6fn9x8q.js} +2 -2
  145. package/dist/v2/{server-b0357as4.js → server-xepx8t43.js} +2 -2
  146. package/dist/v2/{server-3jc6qmdz.js → server-y8xjr8rx.js} +1 -1
  147. package/dist/v2/{server-rpmkz5ta.js → server-z5255w05.js} +8 -8
  148. package/dist/v2/server.js +5 -5
  149. package/dist/v2/{storage-tags-19da4c0m.js → storage-tags-50wsqg3t.js} +5 -5
  150. package/dist/v2/{v2-archive-reader-tgydjgfy.js → v2-archive-reader-ycjh6a2d.js} +1 -1
  151. package/dist/v2/{wrapup-orchestrator-3871zj7c.js → wrapup-orchestrator-fyyb28jf.js} +30 -30
  152. package/dist/{v2-archive-reader-2czwvyc9.js → v2-archive-reader-wec0a8fx.js} +1 -1
  153. package/dist/wrapup-orchestrator-560v99mk.js +54 -0
  154. package/package.json +1 -1
  155. package/src/shared/data-path.test.ts +27 -10
  156. package/src/shared/data-path.ts +39 -39
  157. package/src/shared/models-dev-cache.test.ts +11 -0
  158. package/src/shared/models-dev-cache.ts +7 -1
  159. package/src/shared/test-temp-dir.ts +59 -0
  160. package/src/shared/window-geometry.test.ts +20 -0
  161. package/src/shared/window-geometry.ts +3 -0
  162. package/dist/wrapup-orchestrator-m1yzmgq4.js +0 -54
@@ -15,7 +15,7 @@ import {
15
15
  } from "./server-gzy5w8ya.js";
16
16
  import {
17
17
  setBootQuietPeriodForTests
18
- } from "./server-3yk44ddz.js";
18
+ } from "./server-afsz3cmx.js";
19
19
  import {
20
20
  isEmbeddingHostBusy2
21
21
  } from "./server-qt1qqasc.js";
@@ -24,7 +24,7 @@ import {
24
24
  } from "./server-pavzsdc6.js";
25
25
  import {
26
26
  log2
27
- } from "./server-bb6kf05j.js";
27
+ } from "./server-j8376q08.js";
28
28
  import {
29
29
  sanitizeDiagnosticText
30
30
  } from "./server-z4p0ry94.js";
@@ -39,10 +39,10 @@ import {
39
39
  isSynapseEmbeddingTruncated,
40
40
  getSynapseBatchRequestKey,
41
41
  SynapseEmbeddingProvider
42
- } from "./server-mxsy9h1d.js";
42
+ } from "./server-x6fn9x8q.js";
43
43
  import {
44
44
  estimateTokens
45
- } from "./server-3jc6qmdz.js";
45
+ } from "./server-y8xjr8rx.js";
46
46
  import {
47
47
  DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS2,
48
48
  CHUNK_WINDOW_SAFETY_RATIO2,
@@ -60,7 +60,7 @@ import {
60
60
  countSessionCompartmentEmbedCoverage2,
61
61
  countSessionCompartmentEmbedCoveragePolite2,
62
62
  countUnembeddedSessionCompartmentsPolite2
63
- } from "./server-g61hgy1y.js";
63
+ } from "./server-8pdfmc27.js";
64
64
  import {
65
65
  acquireGitSweepLease,
66
66
  renewGitSweepLease,
@@ -68,7 +68,7 @@ import {
68
68
  findMisScopedCompartmentChunkEmbeddingIdsForProject,
69
69
  recordSessionProjectIdentity,
70
70
  repairMisScopedCompartmentChunkEmbeddingsForProject
71
- } from "./server-qp5sj6n5.js";
71
+ } from "./server-jtq03rkb.js";
72
72
  import {
73
73
  saveEmbeddingIfHashMatches,
74
74
  getMemoryEmbedCoverage,
@@ -83,13 +83,13 @@ import {
83
83
  logLocalEmbeddingPoolingUnavailableOnce,
84
84
  getEmbeddingProviderIdentity,
85
85
  LocalEmbeddingProvider
86
- } from "./server-kwtnrhv3.js";
86
+ } from "./server-d706s5xn.js";
87
87
  import {
88
88
  isKnownAutocommit
89
89
  } from "./server-8ajstryz.js";
90
90
  import {
91
91
  logSlowWriteTransaction
92
- } from "./server-np27dgyt.js";
92
+ } from "./server-5sbsnpkn.js";
93
93
 
94
94
  // src/features/magic-context/project-embedding-registry.ts
95
95
  import { createHash as createHash2, randomUUID } from "node:crypto";
package/dist/v2/server.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  loadPluginConfigDetailed
3
- } from "./server-5p0bjk3y.js";
3
+ } from "./server-9sf3qp02.js";
4
4
  import {
5
5
  setHarness2
6
6
  } from "./server-pavzsdc6.js";
@@ -11,9 +11,9 @@ import {
11
11
  registerStalePluginBuildHost,
12
12
  log2,
13
13
  flushLogger2
14
- } from "./server-bb6kf05j.js";
14
+ } from "./server-j8376q08.js";
15
15
  import"./server-z4p0ry94.js";
16
- import"./server-sa1fdt41.js";
16
+ import"./server-2adwe0be.js";
17
17
  import {
18
18
  string,
19
19
  unknown,
@@ -7875,7 +7875,7 @@ var require_src2 = __commonJS(function(exports, module) {
7875
7875
  // package.json
7876
7876
  var package_default = {
7877
7877
  name: "@cortexkit/opencode-magic-context",
7878
- version: "0.49.57",
7878
+ version: "0.49.60",
7879
7879
  type: "module",
7880
7880
  description: "OpenCode plugin for Magic Context — cross-session memory and context management",
7881
7881
  main: "dist/index.js",
@@ -8196,7 +8196,7 @@ async function setup(context) {
8196
8196
  if (claimStorageBackupWarningCheck() && isMagicContextStorageOutsideEngram(storageDir)) {
8197
8197
  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.`);
8198
8198
  }
8199
- const { registerContext } = await import("./context-4gxr2xd4.js");
8199
+ const { registerContext } = await import("./context-77g3jhf2.js");
8200
8200
  setHarness2("opencode2");
8201
8201
  bindStaleBuildNotice({}, import.meta.url, "opencode2");
8202
8202
  const duties = await registerContext(context);
@@ -64,14 +64,14 @@ import {
64
64
  adoptNullOwnerToolTag2,
65
65
  getCandidateToolOwners2,
66
66
  pickNearestPriorOwner2
67
- } from "./server-beydmd68.js";
67
+ } from "./server-88n85n60.js";
68
68
  import"./server-1zx87sdm.js";
69
69
  import"./server-rz6g5xne.js";
70
- import"./server-b0357as4.js";
71
- import"./server-np27dgyt.js";
72
- import"./server-3jc6qmdz.js";
70
+ import"./server-xepx8t43.js";
71
+ import"./server-5sbsnpkn.js";
72
+ import"./server-y8xjr8rx.js";
73
73
  import"./server-gzy5w8ya.js";
74
- import"./server-bb6kf05j.js";
74
+ import"./server-j8376q08.js";
75
75
  import"./server-pavzsdc6.js";
76
76
  import"./server-z4p0ry94.js";
77
77
  export {
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  readV2ArchiveOffThread2,
3
3
  serveV2ArchiveReads2
4
- } from "./server-t5c8awdm.js";
4
+ } from "./server-9ab9jnpq.js";
5
5
  import"./server-v0p37hm2.js";
6
6
  import"./server-gzy5w8ya.js";
7
7
  import"./server-1d042x6w.js";
@@ -1,9 +1,9 @@
1
1
  import"./server-pavzsdc6.js";
2
2
  import {
3
3
  sessionLog2
4
- } from "./server-bb6kf05j.js";
4
+ } from "./server-j8376q08.js";
5
5
  import"./server-z4p0ry94.js";
6
- import"./server-tmf0ayqp.js";
6
+ import"./server-jdfe07mp.js";
7
7
  import {
8
8
  COMPARTMENT_LEASE_RENEWAL_MS,
9
9
  acquireCompartmentLease,
@@ -11,20 +11,20 @@ import {
11
11
  releaseCompartmentLeaseBestEffort,
12
12
  getCompartments,
13
13
  getLastCompartmentEndMessage
14
- } from "./server-v57wr0r9.js";
14
+ } from "./server-t8tmrtcg.js";
15
15
  import"./server-2amn2s73.js";
16
- import"./server-3jc6qmdz.js";
17
- import"./server-mxsy9h1d.js";
16
+ import"./server-y8xjr8rx.js";
17
+ import"./server-x6fn9x8q.js";
18
18
  import {
19
19
  inRootAsyncContext2
20
20
  } from "./server-gzy5w8ya.js";
21
21
  import"./server-v0p37hm2.js";
22
22
  import"./server-96ztjvkn.js";
23
23
  import"./server-1d042x6w.js";
24
- import"./server-rz5jnhnv.js";
25
- import"./server-966dq3pd.js";
26
- import"./server-g61hgy1y.js";
27
- import"./server-jwydbwcx.js";
24
+ import"./server-6ash6z8z.js";
25
+ import"./server-ds8vpfkr.js";
26
+ import"./server-8pdfmc27.js";
27
+ import"./server-svx20ra2.js";
28
28
  import {
29
29
  getWrapupInProgressState,
30
30
  acquireWrapupInProgress,
@@ -32,27 +32,27 @@ import {
32
32
  releaseWrapupInProgress,
33
33
  getHistorianFailureState,
34
34
  clearEmergencyRecovery
35
- } from "./server-beydmd68.js";
36
- import"./server-b0357as4.js";
37
- import"./server-0ayyh3mx.js";
35
+ } from "./server-88n85n60.js";
36
+ import"./server-xepx8t43.js";
37
+ import"./server-tzh55x6d.js";
38
38
  import"./server-1zx87sdm.js";
39
39
  import"./server-rz6g5xne.js";
40
40
  import"./server-2ra6pwf3.js";
41
- import"./server-7vrtk78d.js";
41
+ import"./server-3ap5dmhc.js";
42
42
  import {
43
43
  prepareRawSessionOrdinals2
44
- } from "./server-gge95a03.js";
44
+ } from "./server-8ycacd59.js";
45
45
  import"./server-fr0wbhdn.js";
46
- import"./server-6k0rnwbd.js";
47
- import"./server-3yk44ddz.js";
46
+ import"./server-jn4pktdk.js";
47
+ import"./server-afsz3cmx.js";
48
48
  import"./server-rthnpmbp.js";
49
49
  import"./server-fb3zxn06.js";
50
50
  import"./server-468mya5v.js";
51
- import"./server-4x0xq8a1.js";
51
+ import"./server-rbtx6q5v.js";
52
52
  import {
53
53
  pushNotification2
54
54
  } from "./server-x8a7jmkh.js";
55
- import"./server-c8z2grq0.js";
55
+ import"./server-at0v0z4t.js";
56
56
  import {
57
57
  describeBoundaryDiagnostics,
58
58
  resolveWrapupProtectedTailBoundary,
@@ -63,23 +63,23 @@ import {
63
63
  registerActiveCompartmentRun,
64
64
  setRecompStarting2,
65
65
  setRecompTerminal2
66
- } from "./server-dqwx9pdh.js";
66
+ } from "./server-8hcxmt1w.js";
67
67
  import"./server-qt1qqasc.js";
68
- import"./server-rpmkz5ta.js";
69
- import"./server-qp5sj6n5.js";
68
+ import"./server-z5255w05.js";
69
+ import"./server-jtq03rkb.js";
70
70
  import"./server-4dhv7mqz.js";
71
- import"./server-kwtnrhv3.js";
72
- import"./server-ycvqg2s3.js";
71
+ import"./server-d706s5xn.js";
72
+ import"./server-d9aayyxk.js";
73
73
  import"./server-jjvbk92s.js";
74
- import"./server-v817sf79.js";
75
- import"./server-5p0bjk3y.js";
76
- import"./server-sa1fdt41.js";
77
- import"./server-5kgesxck.js";
78
- import"./server-91gb0vh8.js";
74
+ import"./server-d07yxksx.js";
75
+ import"./server-9sf3qp02.js";
76
+ import"./server-2adwe0be.js";
77
+ import"./server-aewxmvnf.js";
78
+ import"./server-npdey91q.js";
79
79
  import {
80
80
  sendStatusNotification2
81
- } from "./server-vqq3g1t7.js";
82
- import"./server-np27dgyt.js";
81
+ } from "./server-qjff96a6.js";
82
+ import"./server-5sbsnpkn.js";
83
83
 
84
84
  // src/hooks/magic-context/wrapup-orchestrator.ts
85
85
  import * as crypto from "node:crypto";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  readV2ArchiveOffThread2,
3
3
  serveV2ArchiveReads2
4
- } from "./index-zyanqxtc.js";
4
+ } from "./index-s2jdky2x.js";
5
5
  import"./index-v0p37hm2.js";
6
6
  import"./index-gzy5w8ya.js";
7
7
  import"./index-1d042x6w.js";
@@ -0,0 +1,54 @@
1
+ import {
2
+ runManagedWrapup2
3
+ } from "./index-s2qsd3w9.js";
4
+ import"./index-3wq9btxt.js";
5
+ import"./index-4yjn3er4.js";
6
+ import"./index-832w615x.js";
7
+ import"./index-sd3egckz.js";
8
+ import"./index-n6aye6ny.js";
9
+ import"./index-zxj39ba2.js";
10
+ import"./index-jjvbk92s.js";
11
+ import"./index-gq1g9a3a.js";
12
+ import"./index-4dhv7mqz.js";
13
+ import"./index-ywxvdwmj.js";
14
+ import"./index-tebcx987.js";
15
+ import"./index-ev2rrjfc.js";
16
+ import"./index-2amn2s73.js";
17
+ import"./index-6athgjba.js";
18
+ import"./index-ngwmx6nt.js";
19
+ import"./index-1sq1krqw.js";
20
+ import"./index-qt1qqasc.js";
21
+ import"./index-d0feqcs5.js";
22
+ import"./index-8sc7vqt7.js";
23
+ import"./index-1zx87sdm.js";
24
+ import"./index-x40zr813.js";
25
+ import"./index-x8a7jmkh.js";
26
+ import"./index-e6ncz7a6.js";
27
+ import"./index-zb4h9nrk.js";
28
+ import"./index-6nqz8hsz.js";
29
+ import"./index-jg7sbt3v.js";
30
+ import"./index-snbpdpa3.js";
31
+ import"./index-pxnzyvjc.js";
32
+ import"./index-0cz8bsyx.js";
33
+ import"./index-fb3zxn06.js";
34
+ import"./index-xx05vta0.js";
35
+ import"./index-fr0wbhdn.js";
36
+ import"./index-tzy5h4x6.js";
37
+ import"./index-s32f8y67.js";
38
+ import"./index-wh9fxds5.js";
39
+ import"./index-gqf8r04r.js";
40
+ import"./index-jrj95cce.js";
41
+ import"./index-q7q6qp1f.js";
42
+ import"./index-96ztjvkn.js";
43
+ import"./index-v0p37hm2.js";
44
+ import"./index-58e3y90n.js";
45
+ import"./index-m0pwswv9.js";
46
+ import"./index-5vsk2cpp.js";
47
+ import"./index-gzy5w8ya.js";
48
+ import"./index-ywrz4wy2.js";
49
+ import"./index-pavzsdc6.js";
50
+ import"./index-z4p0ry94.js";
51
+ import"./index-1d042x6w.js";
52
+ export {
53
+ runManagedWrapup2 as runManagedWrapup
54
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/opencode-magic-context",
3
- "version": "0.49.57",
3
+ "version": "0.49.60",
4
4
  "type": "module",
5
5
  "description": "OpenCode plugin for Magic Context — cross-session memory and context management",
6
6
  "main": "dist/index.js",
@@ -15,13 +15,14 @@ import {
15
15
  getCacheDir,
16
16
  getDataDir,
17
17
  getLegacyOpenCodeMagicContextStorageDir,
18
+ getMagicContextHistorianDir,
19
+ getMagicContextHistorianSessionDir,
18
20
  getMagicContextLogPath,
19
21
  getMagicContextStorageDir,
20
22
  getMagicContextStorageResolution,
21
23
  getOpenCodeCacheDir,
22
24
  getOpenCodeStorageDir,
23
25
  getProjectMagicContextDir,
24
- getProjectMagicContextHistorianDir,
25
26
  isMagicContextStorageOutsideEngram,
26
27
  } from "./data-path";
27
28
  import * as logger from "./logger";
@@ -271,19 +272,35 @@ describe("data-path", () => {
271
272
  });
272
273
 
273
274
  test("getProjectMagicContextDir composes <project>/.cortexkit/magic-context", () => {
274
- // Project-local artifacts (historian state file, failure dumps) live
275
- // inside the project so OpenCode's external_directory permission system
276
- // treats them as project-internal. Without this, historian's Read tool
277
- // would trigger a permission prompt on every run when artifacts lived
278
- // under os.tmpdir(). Moved from .opencode/ to the shared .cortexkit/.
275
+ // Project-local artifacts (the dreamer's docs-update proposals) live
276
+ // inside the project because they target the project's own docs.
277
+ // Moved from .opencode/ to the shared .cortexkit/.
279
278
  expect(getProjectMagicContextDir("/Users/me/Work/proj")).toBe(
280
279
  path.join("/Users/me/Work/proj", ".cortexkit", "magic-context"),
281
280
  );
282
281
  });
283
282
 
284
- test("getProjectMagicContextHistorianDir appends historian/", () => {
285
- expect(getProjectMagicContextHistorianDir("/Users/me/Work/proj")).toBe(
286
- path.join("/Users/me/Work/proj", ".cortexkit", "magic-context", "historian"),
283
+ test("historian dumps live per session under the harness temp dir, not in a project", () => {
284
+ expect(getMagicContextHistorianDir("opencode")).toBe(
285
+ path.join(os.tmpdir(), "opencode", "magic-context", "historian"),
286
+ );
287
+ expect(getMagicContextHistorianSessionDir("ses_abc123", "pi")).toBe(
288
+ path.join(os.tmpdir(), "pi", "magic-context", "historian", "ses_abc123"),
289
+ );
290
+ });
291
+
292
+ test("the historian session dir keeps unsafe session ids inside the historian root", () => {
293
+ const root = getMagicContextHistorianDir("opencode");
294
+ expect(getMagicContextHistorianSessionDir("a/b\\c:d", "opencode")).toBe(
295
+ path.join(root, "a-b-c-d"),
296
+ );
297
+ for (const id of ["", ".", ".."]) {
298
+ expect(getMagicContextHistorianSessionDir(id, "opencode")).toBe(
299
+ path.join(root, "unknown-session"),
300
+ );
301
+ }
302
+ expect(getMagicContextHistorianSessionDir("../..", "opencode")).toBe(
303
+ path.join(root, "..-.."),
287
304
  );
288
305
  });
289
306
 
@@ -291,7 +308,7 @@ describe("data-path", () => {
291
308
  // Project-local paths anchor to the project directory the caller
292
309
  // passes in, NOT to any user-config env var. Setting XDG_DATA_HOME
293
310
  // (which changes the shared storage dir) must not change the
294
- // project-local historian dir.
311
+ // project-local artifact dir.
295
312
  process.env.XDG_DATA_HOME = "/tmp/custom-data";
296
313
  expect(getProjectMagicContextDir("/some/project")).toBe(
297
314
  path.join("/some/project", ".cortexkit", "magic-context"),
@@ -67,42 +67,60 @@ export function getMagicContextLogPath(harness: HarnessId = getHarness()): strin
67
67
  }
68
68
 
69
69
  /**
70
- * Directory used for both historian validation-failure dumps and the
71
- * existing-state offload XMLs that large historian/recomp passes write
72
- * before invoking the model. Per-harness so dumps from different
73
- * harnesses don't collide on filename and so `doctor --issue` for each
74
- * harness reports only its own historian artifacts.
70
+ * Root directory for historian response dumps: debug copies of one historian
71
+ * pass's raw output, kept only when the pass fails validation. Each session
72
+ * writes into its own subdirectory (see getMagicContextHistorianSessionDir).
73
+ *
74
+ * The dumps belong to the session, not to a project, and the model never
75
+ * reads them, so they live in the per-harness temp subtree next to the log.
76
+ * Per-harness so `doctor --issue` for each harness reports only its own
77
+ * historian artifacts. Plugin versions before 0.18 wrote dumps directly into
78
+ * this directory without a session subdirectory; doctor lists those as legacy.
75
79
  */
76
80
  export function getMagicContextHistorianDir(harness: HarnessId = getHarness()): string {
77
81
  return path.join(getMagicContextTempDir(harness), "historian");
78
82
  }
79
83
 
84
+ /**
85
+ * Per-session historian dump directory:
86
+ * `${os.tmpdir()}/<harness>/magic-context/historian/<session-id>/`.
87
+ *
88
+ * The session id is reduced to filename-safe characters, and an id that would
89
+ * resolve to the historian root or its parent (empty, `.` or `..`) is replaced
90
+ * with a fixed name, so a dump can never land outside its session directory.
91
+ */
92
+ export function getMagicContextHistorianSessionDir(
93
+ sessionId: string,
94
+ harness: HarnessId = getHarness(),
95
+ ): string {
96
+ const safeSessionId = sessionId.replace(/[^a-zA-Z0-9._-]/g, "-");
97
+ const directoryName = /^\.*$/.test(safeSessionId) ? "unknown-session" : safeSessionId;
98
+ return path.join(getMagicContextHistorianDir(harness), directoryName);
99
+ }
100
+
80
101
  /**
81
102
  * Project-local magic-context artifact directory.
82
103
  *
83
104
  * Layout: `<project-directory>/.cortexkit/magic-context/`
84
105
  *
85
- * Used for artifacts that the historian/recomp pipeline writes during a run
86
- * and that the model is asked to read via its native Read tool. OpenCode's
87
- * `external_directory` permission system asks the user before reading any
88
- * file outside the project directory or its worktree, which interrupts every
89
- * historian run when artifacts live under `os.tmpdir()`. Writing under the
90
- * project's own `.cortexkit/` subtree falls inside the project boundary and
91
- * never triggers a permission prompt.
106
+ * Used for the dreamer's docs-update proposals, which target the project's own
107
+ * ARCHITECTURE.md and STRUCTURE.md and so are project files by design.
92
108
  *
93
109
  * `.cortexkit/` is the shared CortexKit per-project dir (also holds the
94
- * project config `magic-context.jsonc`). Because these artifacts are transient
95
- * debug dumps that shouldn't dirty the user's repo, each writer ensures a
96
- * self-ignoring `.gitignore` inside this subdir (see
97
- * ensureCortexKitArtifactGitignore) while leaving `*.jsonc` config tracked.
110
+ * project config `magic-context.jsonc`). Because the generated artifacts
111
+ * shouldn't dirty the user's repo, each writer ensures a self-ignoring
112
+ * `.gitignore` inside this subdir (see ensureCortexKitArtifactGitignore) while
113
+ * leaving `*.jsonc` config tracked.
98
114
  *
99
- * Migration note: artifacts used to live under `.opencode/magic-context/`. We
100
- * cut the write path forward only — old transient dumps are git-ignored and
101
- * regenerated, so they are intentionally NOT migrated (left to be cleaned).
115
+ * Historian response dumps used to be written to `historian/` under this
116
+ * directory. They now go to the per-harness temp subtree (see
117
+ * getMagicContextHistorianSessionDir) because they belong to a session, not a
118
+ * project, and the model never reads them. Old dumps already in projects are
119
+ * left in place; `doctor` still lists them.
102
120
  *
103
121
  * Logger does NOT use this — log files stay in the per-harness tmp subtree
104
- * because they are written by the plugin process itself (no model-side Read
105
- * tool call, no permission prompt) and span sessions/projects.
122
+ * because they are written by the plugin process itself and span
123
+ * sessions/projects.
106
124
  */
107
125
  export function getProjectMagicContextDir(directory: string): string {
108
126
  return path.join(directory, ".cortexkit", "magic-context");
@@ -143,24 +161,6 @@ export function ensureCortexKitArtifactGitignore(directory: string): void {
143
161
  }
144
162
  }
145
163
 
146
- /**
147
- * Project-local historian artifact directory.
148
- *
149
- * Layout: `<project-directory>/.cortexkit/magic-context/historian/`
150
- *
151
- * Used for:
152
- * - existing-state offload XMLs that long historian/recomp passes write
153
- * before invoking the model (the model reads the file via Read tool)
154
- * - validation-failure dump XMLs preserved for debugging
155
- *
156
- * Callers must `mkdirSync(dir, { recursive: true })` before writing — the
157
- * `.cortexkit/` parent may not exist on a fresh project, and write failures
158
- * here must degrade gracefully (e.g. historian falls back to inline state).
159
- */
160
- export function getProjectMagicContextHistorianDir(directory: string): string {
161
- return path.join(getProjectMagicContextDir(directory), "historian");
162
- }
163
-
164
164
  export function getOpenCodeStorageDir(): string {
165
165
  return path.join(getDataDir(), "opencode", "storage");
166
166
  }
@@ -88,6 +88,17 @@ describe("output-token reservation", () => {
88
88
  ).toBe(1_048_576);
89
89
  });
90
90
 
91
+ test("keeps Oh My Pi's antigravity-cli provider at the full window (issue 939)", () => {
92
+ // The agy default model's catalog pair in Oh My Pi 18.22.0.
93
+ expect(
94
+ resolveLimit(
95
+ { context: 1_048_576, output: 262_144 },
96
+ "antigravity-cli",
97
+ "gemini-4-carbon",
98
+ ),
99
+ ).toBe(1_048_576);
100
+ });
101
+
91
102
  test("output_reserve accepts both harness provider spellings with canonical precedence", () => {
92
103
  const limit = { context: 100_000, output: 20_000 };
93
104
  expect(
@@ -81,7 +81,13 @@ interface CachedModelMetadata {
81
81
 
82
82
  // Proven-separate allowlist only. Unknown providers reserve by default because
83
83
  // wasting some input capacity is safer than a shared-window hard rejection.
84
- const SEPARATE_OUTPUT_QUOTA_PROVIDERS = new Set(["google", "google-antigravity"]);
84
+ // `antigravity-cli` is Oh My Pi's driver for Google's Antigravity CLI, serving
85
+ // the same models with the same limits as `google-antigravity`.
86
+ const SEPARATE_OUTPUT_QUOTA_PROVIDERS = new Set([
87
+ "google",
88
+ "google-antigravity",
89
+ "antigravity-cli",
90
+ ]);
85
91
  const MIN_PLAUSIBLE_CONTEXT_LIMIT = 1024;
86
92
  const OUTPUT_RESERVE_CAP_RATIO = 0.25;
87
93
  let outputReserveConfig: OutputReserveConfig | undefined;
@@ -58,6 +58,13 @@ const registeredTempDirs = new Set<string>();
58
58
  let lifecycleCleanupInstalled = false;
59
59
  let exitCleanupInstalled = false;
60
60
 
61
+ // os.tmpdir() reads TMPDIR on POSIX and TEMP, then TMP, on Windows, on every
62
+ // call. Setting all three moves it on every platform.
63
+ const TEMP_DIR_ENV_KEYS = ["TMPDIR", "TMP", "TEMP"] as const;
64
+ // The temp directory in effect before redirectTempDirForTests ran, while that
65
+ // redirect is active.
66
+ let originalTempDir: string | undefined;
67
+
61
68
  function hasRecognizedPrefix(name: string): boolean {
62
69
  return (
63
70
  name.startsWith(OWNED_PREFIX) ||
@@ -158,6 +165,58 @@ export function installTestTempDirCleanup(afterAll: AfterAll): void {
158
165
  }
159
166
  }
160
167
 
168
+ /**
169
+ * Points os.tmpdir() at `directory` for this process and the child processes it
170
+ * starts afterwards. Returns a function that puts back the previous values,
171
+ * including unsetting variables that were unset.
172
+ */
173
+ export function setProcessTempDirForTests(directory: string): () => void {
174
+ const previous = TEMP_DIR_ENV_KEYS.map((key) => [key, process.env[key]] as const);
175
+ for (const key of TEMP_DIR_ENV_KEYS) process.env[key] = directory;
176
+ return () => {
177
+ for (const [key, value] of previous) {
178
+ if (value === undefined) delete process.env[key];
179
+ else process.env[key] = value;
180
+ }
181
+ };
182
+ }
183
+
184
+ /**
185
+ * Moves os.tmpdir() to a fresh test-owned root for the rest of the test run, so
186
+ * nothing a test writes there reaches the machine's temp directory.
187
+ *
188
+ * Production code writes the plugin log and historian response dumps under
189
+ * os.tmpdir(), and the CLI doctor counts the dumps it finds there. Without the
190
+ * redirect, a test that makes the historian dump a response leaves files in the
191
+ * machine's temp directory, and a doctor test that runs later on the same
192
+ * machine reports them as an extra warning.
193
+ *
194
+ * The previous values come back in `afterAll`. Under `bun test --parallel`, Bun
195
+ * runs the preload and its afterAll hooks once per test file in the same
196
+ * process, and the next file's preload creates its roots under os.tmpdir().
197
+ * By then the cleanup has deleted this root, so the restore must run first.
198
+ */
199
+ export function redirectTempDirForTests(afterAll: AfterAll): string {
200
+ const machineTempDir = tmpdir();
201
+ const { dir } = createTestTempDir("mc-test-tmpdir-");
202
+ const restore = setProcessTempDirForTests(dir);
203
+ originalTempDir = machineTempDir;
204
+ afterAll(() => {
205
+ restore();
206
+ originalTempDir = undefined;
207
+ });
208
+ return dir;
209
+ }
210
+
211
+ /**
212
+ * The temp directory this process had before redirectTempDirForTests moved
213
+ * os.tmpdir(), so a test can check that nothing reached it. Without an active
214
+ * redirect it is the current os.tmpdir().
215
+ */
216
+ export function getOriginalTempDirForTests(): string {
217
+ return originalTempDir ?? tmpdir();
218
+ }
219
+
161
220
  /**
162
221
  * Removes only old, recognized test roots from one temp directory. The scan does
163
222
  * one directory read, ignores non-directories, and leaves fresh roots and every
@@ -79,6 +79,25 @@ describe("window geometry", () => {
79
79
  },
80
80
  },
81
81
  },
82
+ {
83
+ // Oh My Pi's driver for Google's Antigravity CLI (`agy`).
84
+ provider: "antigravity-cli",
85
+ model: "gemini-4-carbon",
86
+ limit: { context: 1_048_576, output: 262_144 },
87
+ expected: {
88
+ usableSoft: 1_048_576,
89
+ usableHard: 1_048_576,
90
+ geometry: "separate",
91
+ derivation: {
92
+ window: 1_048_576,
93
+ reserve: 0,
94
+ reserveSource: "none",
95
+ geometry: "separate",
96
+ windowSource: "catalog",
97
+ absoluteWall: 1_048_576,
98
+ },
99
+ },
100
+ },
82
101
  {
83
102
  provider: "xai",
84
103
  model: "grok-3",
@@ -317,6 +336,7 @@ describe("window geometry", () => {
317
336
  ["openai", "zero", { context: 200_000, output: 0 }],
318
337
  ["xai", "placeholder", { context: 500_000, output: 500_000 }],
319
338
  ["google", "separate", { context: 1_000_000, output: 65_536 }],
339
+ ["antigravity-cli", "gemini-4-carbon", { context: 1_048_576, output: 262_144 }],
320
340
  ["anthropic", "input", { context: 1_000_000, input: 900_000, output: 128_000 }],
321
341
  ] as const;
322
342
  for (const [provider, model, limit] of corpus) {
@@ -61,6 +61,9 @@ const PROVIDER_GEOMETRY: Readonly<Record<string, WindowGeometry>> = {
61
61
  xai: "shared_truncating",
62
62
  google: "separate",
63
63
  "google-antigravity": "separate",
64
+ // Oh My Pi's driver for Google's Antigravity CLI (`agy`): the same account,
65
+ // model roster and window/output pairs as google-antigravity.
66
+ "antigravity-cli": "separate",
64
67
  };
65
68
 
66
69
  const geometryClampLogSeen = new Set<string>();