@cortexkit/opencode-magic-context 0.49.72 → 0.49.74

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 (51) hide show
  1. package/dist/{context-830ksymq.js → context-966c0vdq.js} +86 -11
  2. package/dist/features/magic-context/transform-decision-log.d.ts +1 -1
  3. package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
  4. package/dist/hooks/magic-context/command-handler.d.ts +4 -0
  5. package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
  6. package/dist/hooks/magic-context/event-resolvers.d.ts +12 -0
  7. package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
  8. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  9. package/dist/hooks/magic-context/inject-compartments.d.ts +4 -0
  10. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
  11. package/dist/hooks/magic-context/pending-materialization.d.ts +4 -1
  12. package/dist/hooks/magic-context/pending-materialization.d.ts.map +1 -1
  13. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  14. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  15. package/dist/hooks/magic-context/wrapup-orchestrator.d.ts +0 -1
  16. package/dist/hooks/magic-context/wrapup-orchestrator.d.ts.map +1 -1
  17. package/dist/{index-64qpnmjb.js → index-238xbkhk.js} +1 -1
  18. package/dist/{index-yh7hxjxm.js → index-6qqc8ef2.js} +56 -21
  19. package/dist/{index-y6q5qvdz.js → index-cpmqvc1c.js} +15 -13
  20. package/dist/{index-q5rcetym.js → index-h2w3kzkt.js} +2 -2
  21. package/dist/{index-sc5segqg.js → index-k2rk6z1y.js} +2 -2
  22. package/dist/{index-cw3j0pwy.js → index-ne2awfqp.js} +10 -1
  23. package/dist/{index-2m1j98fj.js → index-ypm4aa3h.js} +2 -2
  24. package/dist/{index-w8sv1v0j.js → index-ztjgymb9.js} +15 -6
  25. package/dist/index.js +30 -27
  26. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  27. package/dist/plugin/rpc-handlers.d.ts +4 -0
  28. package/dist/plugin/rpc-handlers.d.ts.map +1 -1
  29. package/dist/raw-ordinal-warmup-worker.js +2 -2
  30. package/dist/{recomp-orchestrator-sa4f2mkj.js → recomp-orchestrator-z0m2vgbe.js} +3 -3
  31. package/dist/{render-qkjgrg31.js → render-rf6dmb9v.js} +1 -1
  32. package/dist/{search-archive-cmfs3myg.js → search-archive-myb6n35b.js} +2 -2
  33. package/dist/{transform-postprocess-phase-ecrcsc2w.js → transform-postprocess-phase-r6t8m6qq.js} +3 -3
  34. package/dist/v2/{context-q846asea.js → context-f4v3ptyh.js} +140 -26
  35. package/dist/v2/hooks/context.d.ts.map +1 -1
  36. package/dist/v2/hooks/generate.d.ts +1 -0
  37. package/dist/v2/hooks/generate.d.ts.map +1 -1
  38. package/dist/v2/raw-ordinal-warmup-worker.js +2 -2
  39. package/dist/v2/{recomp-orchestrator-egbf57qa.js → recomp-orchestrator-14bek576.js} +2 -2
  40. package/dist/v2/{render-47vjswds.js → render-rw6tk2fj.js} +1 -1
  41. package/dist/v2/{search-archive-3tpaqkg4.js → search-archive-w33x2z9z.js} +2 -2
  42. package/dist/v2/{server-canf6f29.js → server-11rbew2r.js} +10 -1
  43. package/dist/v2/{server-4nh02tdw.js → server-ds7y8nmk.js} +1 -1
  44. package/dist/v2/{server-3jggqcpa.js → server-kya7jvx5.js} +2 -2
  45. package/dist/v2/{server-wb00e7b0.js → server-yspcz6v9.js} +2 -2
  46. package/dist/v2/server.js +2 -2
  47. package/dist/v2/{v2-archive-reader-x1yvzqs8.js → v2-archive-reader-cw9fm88j.js} +1 -1
  48. package/dist/v2/{wrapup-orchestrator-5bccsgy0.js → wrapup-orchestrator-sk2zx55m.js} +14 -12
  49. package/dist/{v2-archive-reader-xnnwexnw.js → v2-archive-reader-42chk89p.js} +1 -1
  50. package/dist/{wrapup-orchestrator-yrpqmwc7.js → wrapup-orchestrator-4sfkj8z4.js} +4 -4
  51. package/package.json +1 -1
package/dist/v2/server.js CHANGED
@@ -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.72",
7878
+ version: "0.49.74",
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-q846asea.js");
8199
+ const { registerContext } = await import("./context-f4v3ptyh.js");
8200
8200
  setHarness2("opencode2");
8201
8201
  bindStaleBuildNotice({}, import.meta.url, "opencode2");
8202
8202
  const duties = await registerContext(context);
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  readV2ArchiveOffThread2,
3
3
  serveV2ArchiveReads2
4
- } from "./server-wb00e7b0.js";
4
+ } from "./server-yspcz6v9.js";
5
5
  import"./server-v0p37hm2.js";
6
6
  import"./server-gzy5w8ya.js";
7
7
  import"./server-1d042x6w.js";
@@ -10,8 +10,9 @@ import {
10
10
  renewCompartmentLease,
11
11
  releaseCompartmentLeaseBestEffort,
12
12
  getCompartments,
13
- getLastCompartmentEndMessage
14
- } from "./server-canf6f29.js";
13
+ getLastCompartmentEndMessage,
14
+ requestPendingMaterialization
15
+ } from "./server-11rbew2r.js";
15
16
  import"./server-2amn2s73.js";
16
17
  import"./server-y8xjr8rx.js";
17
18
  import"./server-x6fn9x8q.js";
@@ -63,7 +64,7 @@ import {
63
64
  registerActiveCompartmentRun,
64
65
  setRecompStarting2,
65
66
  setRecompTerminal2
66
- } from "./server-3jggqcpa.js";
67
+ } from "./server-kya7jvx5.js";
67
68
  import"./server-qt1qqasc.js";
68
69
  import"./server-t091cjj4.js";
69
70
  import"./server-jtq03rkb.js";
@@ -118,11 +119,6 @@ function formatAlreadyRunningMessage(state) {
118
119
  const through = state.lastCompartmentEnd > 0 ? ` through message ${state.lastCompartmentEnd}` : "";
119
120
  return `/ctx-wrapup is already running for this session${chunk}${through}. Wait for it to finish, then run /ctx-wrapup again if more history remains.`;
120
121
  }
121
- function appendFlushHint(ctx, sessionId, message) {
122
- if (ctx.hasPendingNaturalBust?.(sessionId))
123
- return message;
124
- return `${message} If you want it applied on the very next message, run /ctx-flush first.`;
125
- }
126
122
  function buildPlan(ctx, sessionId, messagesToKeep, anchorRawMessageCount) {
127
123
  return resolveWrapupProtectedTailBoundary({
128
124
  db: ctx.db,
@@ -308,8 +304,8 @@ ${message}`;
308
304
 
309
305
  ${message}`;
310
306
  }
311
- const startLastEnd = getLastCompartmentEndMessage(ctx.db, sessionId);
312
- const startCompartmentCount = getCompartments(ctx.db, sessionId).length;
307
+ let startLastEnd = getLastCompartmentEndMessage(ctx.db, sessionId);
308
+ let startCompartmentCount = getCompartments(ctx.db, sessionId).length;
313
309
  let chunkIndex = 0;
314
310
  let lastEnd = startLastEnd;
315
311
  let stoppedForFailure = false;
@@ -353,6 +349,9 @@ ${message}`;
353
349
  if (activeAtStart === "timeout") {
354
350
  stoppedForFailure = true;
355
351
  stoppedReason = "Timed out waiting for the active historian run.";
352
+ } else {
353
+ startLastEnd = lastEnd = getLastCompartmentEndMessage(ctx.db, sessionId);
354
+ startCompartmentCount = getCompartments(ctx.db, sessionId).length;
356
355
  }
357
356
  if (!stoppedForFailure) {
358
357
  try {
@@ -460,8 +459,11 @@ ${message}`;
460
459
  try {
461
460
  clearEmergencyRecovery(ctx.db, sessionId);
462
461
  } catch {}
463
- const base = `Wrapped up ${messagesWrapped} messages into ${compartmentsCreated} compartments. The compacted history is queued and materializes on your next message.`;
464
- const message = appendFlushHint(ctx, sessionId, base);
462
+ let message = `Wrapped up ${messagesWrapped} messages into ${compartmentsCreated} compartments.`;
463
+ if (compartmentsCreated > 0) {
464
+ requestPendingMaterialization(ctx.liveSessionState.pendingMaterializationSessions, sessionId, "user_wrapup");
465
+ message += " The compacted history applies on your next message, or on the next rebuild if the host restarts first.";
466
+ }
465
467
  setRecompTerminal2(ctx.liveSessionState, sessionId, "done", message);
466
468
  return message;
467
469
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  readV2ArchiveOffThread2,
3
3
  serveV2ArchiveReads2
4
- } from "./index-2m1j98fj.js";
4
+ } from "./index-ypm4aa3h.js";
5
5
  import"./index-v0p37hm2.js";
6
6
  import"./index-gzy5w8ya.js";
7
7
  import"./index-1d042x6w.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  runManagedWrapup2
3
- } from "./index-y6q5qvdz.js";
4
- import"./index-q5rcetym.js";
5
- import"./index-sc5segqg.js";
3
+ } from "./index-cpmqvc1c.js";
4
+ import"./index-h2w3kzkt.js";
5
+ import"./index-k2rk6z1y.js";
6
6
  import"./index-832w615x.js";
7
7
  import"./index-sd3egckz.js";
8
8
  import"./index-ve863q40.js";
@@ -10,7 +10,7 @@ import"./index-q9ywd8b2.js";
10
10
  import"./index-jjvbk92s.js";
11
11
  import"./index-9swgykdd.js";
12
12
  import"./index-4dhv7mqz.js";
13
- import"./index-cw3j0pwy.js";
13
+ import"./index-ne2awfqp.js";
14
14
  import"./index-tebcx987.js";
15
15
  import"./index-etm62gd7.js";
16
16
  import"./index-2amn2s73.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/opencode-magic-context",
3
- "version": "0.49.72",
3
+ "version": "0.49.74",
4
4
  "type": "module",
5
5
  "description": "OpenCode plugin for Magic Context — cross-session memory and context management",
6
6
  "main": "dist/index.js",