@cortexkit/opencode-magic-context 0.49.85 → 0.49.87

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 (148) hide show
  1. package/dist/auto-search-worker.js +13 -7
  2. package/dist/chunk-embedding-write-worker.js +4 -4
  3. package/dist/{compartment-chunk-embedding-ymc9mtwv.js → compartment-chunk-embedding-fey2bsyf.js} +3 -1
  4. package/dist/{conflict-warning-hook-a0wrnzch.js → conflict-warning-hook-kbq6ppjf.js} +2 -2
  5. package/dist/{context-bjfwzbts.js → context-gnk68pyy.js} +126 -46
  6. package/dist/{embedding-backfill-v6sw58m8.js → embedding-backfill-9khxv6a9.js} +4 -4
  7. package/dist/{embedding-cache-mgyr73ef.js → embedding-cache-zn4r1c31.js} +5 -1
  8. package/dist/features/magic-context/compartment-chunk-embedding.d.ts +1 -0
  9. package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
  10. package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
  11. package/dist/features/magic-context/dreamer/token-budget.d.ts +8 -3
  12. package/dist/features/magic-context/dreamer/token-budget.d.ts.map +1 -1
  13. package/dist/features/magic-context/memory/embedding-cache.d.ts +7 -0
  14. package/dist/features/magic-context/memory/embedding-cache.d.ts.map +1 -1
  15. package/dist/features/magic-context/memory/verification-paths.d.ts.map +1 -1
  16. package/dist/features/magic-context/search.d.ts +6 -0
  17. package/dist/features/magic-context/search.d.ts.map +1 -1
  18. package/dist/features/magic-context/tool-definition-tokens.d.ts +2 -0
  19. package/dist/features/magic-context/tool-definition-tokens.d.ts.map +1 -1
  20. package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
  21. package/dist/hooks/magic-context/auto-search-worker-probe.fixture.d.ts +2 -0
  22. package/dist/hooks/magic-context/auto-search-worker-probe.fixture.d.ts.map +1 -0
  23. package/dist/hooks/magic-context/dropped-input-guard.d.ts.map +1 -1
  24. package/dist/hooks/magic-context/emergency-fail-closed.d.ts +2 -0
  25. package/dist/hooks/magic-context/emergency-fail-closed.d.ts.map +1 -1
  26. package/dist/hooks/magic-context/send-session-notification.d.ts +11 -1
  27. package/dist/hooks/magic-context/send-session-notification.d.ts.map +1 -1
  28. package/dist/hooks/magic-context/transform.d.ts +1 -0
  29. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  30. package/dist/{index-7j2zv9nm.js → index-2qsca7h7.js} +47 -11
  31. package/dist/{index-9fsxmjs6.js → index-3jgzd7nz.js} +7 -7
  32. package/dist/{index-snbpdpa3.js → index-3pdknr07.js} +4 -4
  33. package/dist/{index-k0tb2z28.js → index-3x4qvp29.js} +2 -2
  34. package/dist/{index-0rge5rkh.js → index-5nmqgvz2.js} +21 -14
  35. package/dist/{index-xrnhxkz7.js → index-60wnwcwz.js} +1 -1
  36. package/dist/{index-g6hfh4h4.js → index-6zewd2n5.js} +14 -8
  37. package/dist/{index-nny4gm06.js → index-74sh122g.js} +2 -2
  38. package/dist/{index-70cv85b0.js → index-78t37mcq.js} +2 -2
  39. package/dist/{index-stx8zd81.js → index-83qd3n7s.js} +2 -2
  40. package/dist/{index-jjvbk92s.js → index-9emdjcb5.js} +1 -1
  41. package/dist/{index-sbr58jaf.js → index-awyqqnd8.js} +585 -82
  42. package/dist/{index-qvn3q9f1.js → index-b364vr04.js} +109 -505
  43. package/dist/{index-4w5rx7de.js → index-bxrfq3mv.js} +1 -1
  44. package/dist/{index-pw279hmt.js → index-c1s40xmj.js} +6 -5
  45. package/dist/{index-05bm2ndp.js → index-chpzb6xy.js} +1 -1
  46. package/dist/{index-tzbcb8yt.js → index-csztadkj.js} +46 -17
  47. package/dist/{index-798s7c8s.js → index-hdyfvdag.js} +1 -1
  48. package/dist/{index-4ntnt8ee.js → index-jka4y6mv.js} +1 -1
  49. package/dist/{index-w6v4dw5f.js → index-kmrv1fw3.js} +4 -4
  50. package/dist/{index-jrj95cce.js → index-m6dnydf8.js} +9 -2
  51. package/dist/{index-kqnef2tg.js → index-pmcvg3k1.js} +4 -4
  52. package/dist/{v2/server-4dhv7mqz.js → index-qjwpqvnf.js} +48 -1
  53. package/dist/{index-xccywqdj.js → index-rvf1726x.js} +3 -3
  54. package/dist/{index-1pf5qrx4.js → index-vyfrgwhk.js} +3 -3
  55. package/dist/{index-s8ks5nz4.js → index-watde7a1.js} +2 -2
  56. package/dist/{v2/server-fzgyvsb1.js → index-y14pawe1.js} +3 -0
  57. package/dist/index.d.ts.map +1 -1
  58. package/dist/index.js +61 -52
  59. package/dist/{message-index-bounded-6fr624zf.js → message-index-bounded-r1qys471.js} +4 -4
  60. package/dist/migration-worker.js +3 -3
  61. package/dist/plugin/messages-transform.d.ts +3 -4
  62. package/dist/plugin/messages-transform.d.ts.map +1 -1
  63. package/dist/plugin/refusal-notice.d.ts +3 -0
  64. package/dist/plugin/refusal-notice.d.ts.map +1 -0
  65. package/dist/{project-embedding-registry-q80scexh.js → project-embedding-registry-8t0gwf59.js} +3 -3
  66. package/dist/raw-ordinal-warmup-worker.js +4 -4
  67. package/dist/{read-session-chunk-6wedfths.js → read-session-chunk-xv9f0wgb.js} +3 -3
  68. package/dist/{recomp-orchestrator-xzs0a455.js → recomp-orchestrator-2ztmtxt2.js} +18 -18
  69. package/dist/{render-yqp7q79f.js → render-d6q6h9hy.js} +10 -10
  70. package/dist/{rpc-notifications-t9q0ynq7.js → rpc-notifications-ta2zsxpq.js} +1 -1
  71. package/dist/{search-archive-r4h96j2z.js → search-archive-g96jn6p0.js} +5 -5
  72. package/dist/{search-ztgy3ya6.js → search-d5aajhs3.js} +14 -14
  73. package/dist/{send-session-notification-7x518gew.js → send-session-notification-gzxz88vq.js} +1 -1
  74. package/dist/shared/assistant-message-extractor.d.ts +2 -0
  75. package/dist/shared/assistant-message-extractor.d.ts.map +1 -1
  76. package/dist/shared/prompt-async-transport.d.ts.map +1 -1
  77. package/dist/shared/rpc-notifications.d.ts +1 -1
  78. package/dist/shared/rpc-notifications.d.ts.map +1 -1
  79. package/dist/{storage-memory-e6a7mb0k.js → storage-memory-hhrvfw0x.js} +2 -2
  80. package/dist/{storage-tags-y2mrb8e6.js → storage-tags-f1ftvjpw.js} +2 -2
  81. package/dist/{transform-postprocess-phase-39a5hm2a.js → transform-postprocess-phase-b2yjw8by.js} +19 -19
  82. package/dist/v2/auto-search-worker.js +13 -7
  83. package/dist/v2/chunk-embedding-write-worker.js +4 -4
  84. package/dist/v2/{compartment-chunk-embedding-x6qw6mjk.js → compartment-chunk-embedding-knt2468v.js} +3 -1
  85. package/dist/v2/{context-k2rrqzf4.js → context-s86114yy.js} +219 -62
  86. package/dist/v2/{embedding-backfill-k8kqnwfq.js → embedding-backfill-tazkbpyg.js} +4 -4
  87. package/dist/v2/{embedding-cache-mgyr73ef.js → embedding-cache-zn4r1c31.js} +5 -1
  88. package/dist/v2/fold/native-replay.d.ts +3 -1
  89. package/dist/v2/fold/native-replay.d.ts.map +1 -1
  90. package/dist/v2/hidden-child-record.d.ts +1 -0
  91. package/dist/v2/hidden-child-record.d.ts.map +1 -1
  92. package/dist/v2/hidden-completion.d.ts.map +1 -1
  93. package/dist/v2/hooks/context.d.ts.map +1 -1
  94. package/dist/v2/{message-index-bounded-jqy7283g.js → message-index-bounded-b07r9cjv.js} +4 -4
  95. package/dist/v2/migration-worker.js +3 -3
  96. package/dist/v2/{project-embedding-registry-2jp1antr.js → project-embedding-registry-ah3gsg48.js} +3 -3
  97. package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
  98. package/dist/v2/{read-session-chunk-n3nhfvd7.js → read-session-chunk-38wdy8nd.js} +3 -3
  99. package/dist/v2/{recomp-orchestrator-jnbxbsc8.js → recomp-orchestrator-kc62xgb9.js} +17 -17
  100. package/dist/v2/{render-fezgh7pa.js → render-j05per51.js} +10 -10
  101. package/dist/v2/{rpc-notifications-t9q0ynq7.js → rpc-notifications-ta2zsxpq.js} +1 -1
  102. package/dist/v2/{search-archive-zz1kza50.js → search-archive-b4ptw02k.js} +5 -5
  103. package/dist/v2/{search-h5w7510x.js → search-kg31ad2s.js} +13 -13
  104. package/dist/v2/{send-session-notification-p52rhjzy.js → send-session-notification-zazaxxpf.js} +1 -1
  105. package/dist/v2/{server-ps6rz88g.js → server-2p0qayr1.js} +1 -1
  106. package/dist/v2/{server-s76ty4ws.js → server-2r9btf0g.js} +46 -17
  107. package/dist/v2/{server-wdq85mxj.js → server-6250cxzs.js} +14 -8
  108. package/dist/v2/{server-brgandk4.js → server-6vnbz81n.js} +2 -2
  109. package/dist/v2/{server-jjvbk92s.js → server-9emdjcb5.js} +1 -1
  110. package/dist/v2/{server-ap81bk3c.js → server-9n2qgk29.js} +1 -1
  111. package/dist/v2/{server-mbkwcwgw.js → server-axdmkvd5.js} +2 -2
  112. package/dist/v2/{server-2k8tkbhz.js → server-c7awk5s2.js} +10 -4
  113. package/dist/v2/{server-4wwwm2ya.js → server-ct0gs8fc.js} +4 -4
  114. package/dist/v2/{server-97w51d8n.js → server-ff5wcfy4.js} +3 -3
  115. package/dist/v2/{server-x77hd658.js → server-gqrw0br5.js} +20 -13
  116. package/dist/v2/{server-98hsp35q.js → server-gwhj0362.js} +6 -5
  117. package/dist/v2/{server-w7mpvkpj.js → server-pbp58w5x.js} +1 -1
  118. package/dist/v2/{server-s15knz0w.js → server-pmws7we9.js} +1 -1
  119. package/dist/{index-4dhv7mqz.js → v2/server-qjwpqvnf.js} +48 -1
  120. package/dist/v2/{server-a2f1bhyj.js → server-stjy5dxv.js} +9 -2
  121. package/dist/v2/{server-hn8b7sfe.js → server-xn7zqs4j.js} +2 -2
  122. package/dist/{index-fzgyvsb1.js → v2/server-y14pawe1.js} +3 -0
  123. package/dist/v2/{server-8pdfmc27.js → server-y17r5ryz.js} +4 -4
  124. package/dist/v2/{server-n5zr7190.js → server-yh2z4gg2.js} +3 -3
  125. package/dist/v2/{server-sxfbjdye.js → server-yx0nyj1q.js} +2 -2
  126. package/dist/v2/server.js +3 -3
  127. package/dist/v2/{storage-memory-e6a7mb0k.js → storage-memory-hhrvfw0x.js} +2 -2
  128. package/dist/v2/{storage-tags-xq81zgt2.js → storage-tags-pmw33chf.js} +2 -2
  129. package/dist/v2/{v2-archive-reader-e2w39c3p.js → v2-archive-reader-2ayz16s4.js} +1 -1
  130. package/dist/v2/{wrapup-orchestrator-mmje3etf.js → wrapup-orchestrator-e20sjbdz.js} +17 -17
  131. package/dist/{v2-archive-reader-8dsngf2j.js → v2-archive-reader-x39mzvwn.js} +1 -1
  132. package/dist/{wrapup-orchestrator-sm6pwf3p.js → wrapup-orchestrator-h3s905vs.js} +19 -19
  133. package/package.json +1 -1
  134. package/src/shared/assistant-message-extractor.test.ts +22 -0
  135. package/src/shared/assistant-message-extractor.ts +13 -0
  136. package/src/shared/model-suggestion-retry.test.ts +43 -12
  137. package/src/shared/prompt-async-transport.test.ts +275 -8
  138. package/src/shared/prompt-async-transport.ts +41 -2
  139. package/src/shared/reusable-worker.fixture.ts +15 -3
  140. package/src/shared/reusable-worker.test.ts +20 -10
  141. package/src/shared/rpc-notifications.ts +4 -1
  142. package/src/shared/sqlite-foreground-wait.test.ts +2 -2
  143. package/src/shared/startup-maintenance-policy.test.ts +4 -2
  144. package/src/tui/compaction-off.ts +2 -2
  145. package/src/tui/slots/sidebar-content-render.test.ts +309 -0
  146. package/src/tui/slots/sidebar-content.tsx +134 -99
  147. package/src/tui-compiled/compaction-off.ts +2 -2
  148. package/src/tui-compiled/slots/sidebar-content.tsx +321 -247
@@ -60,7 +60,7 @@ import {
60
60
  countSessionCompartmentEmbedCoverage2,
61
61
  countSessionCompartmentEmbedCoveragePolite2,
62
62
  countUnembeddedSessionCompartmentsPolite2
63
- } from "./server-8pdfmc27.js";
63
+ } from "./server-y17r5ryz.js";
64
64
  import {
65
65
  acquireGitSweepLease,
66
66
  renewGitSweepLease,
@@ -73,7 +73,7 @@ import {
73
73
  saveEmbeddingIfHashMatches,
74
74
  getMemoryEmbedCoverage,
75
75
  invalidateProject2
76
- } from "./server-4dhv7mqz.js";
76
+ } from "./server-qjwpqvnf.js";
77
77
  import {
78
78
  dominantEmbeddingFailure,
79
79
  embeddingModelsMatch,
@@ -17,13 +17,16 @@ function notificationMatchesSink(notification, sink) {
17
17
  }
18
18
  function pushLiveNotification2(type, payload, sessionId) {
19
19
  const notification = { id: nextNotificationId++, type, payload, sessionId };
20
+ let delivered = false;
20
21
  for (const sink of sinks) {
21
22
  if (sink.sessionId !== sessionId)
22
23
  continue;
23
24
  try {
24
25
  sink.send(notification);
26
+ delivered = true;
25
27
  } catch {}
26
28
  }
29
+ return delivered;
27
30
  }
28
31
  function pushNotification2(type, payload, sessionId, options) {
29
32
  const notification = { id: nextNotificationId++, type, payload, sessionId };
@@ -954,7 +954,7 @@ async function loadCompartmentChunkEmbeddingsForSearch2(db, sessionId, projectPa
954
954
  var CHUNK_POOL_FULL_PROBE_INTERVAL_MS = 60000;
955
955
  var TRACKED_SEARCH_POOL_LIMIT = 8;
956
956
  var trackedSearchPools = new WeakMap;
957
- function trackSearchPool(db, sessionId, projectPath, modelId) {
957
+ function trackCompartmentChunkSearchPool2(db, sessionId, projectPath, modelId) {
958
958
  let tracked = trackedSearchPools.get(db);
959
959
  if (!tracked) {
960
960
  tracked = new Map;
@@ -981,7 +981,7 @@ function peekCompartmentChunkSearchPool2(db, sessionId, projectPath, modelId, da
981
981
  diagnostic.peek = "no-model";
982
982
  return null;
983
983
  }
984
- trackSearchPool(db, sessionId, projectPath, modelId);
984
+ trackCompartmentChunkSearchPool2(db, sessionId, projectPath, modelId);
985
985
  const entry = getDecodedSearchPool(db).get(searchPoolKey(sessionId, projectPath, modelId));
986
986
  if (!entry || searchPoolInTransaction(db)) {
987
987
  if (diagnostic)
@@ -1009,7 +1009,7 @@ async function warmCompartmentChunkSearchPool2(db, sessionId, projectPath, model
1009
1009
  });
1010
1010
  if (!modelId)
1011
1011
  return report("current");
1012
- trackSearchPool(db, sessionId, projectPath, modelId);
1012
+ trackCompartmentChunkSearchPool2(db, sessionId, projectPath, modelId);
1013
1013
  const key = searchPoolKey(sessionId, projectPath, modelId);
1014
1014
  try {
1015
1015
  if (pendingSearchPools.get(db)?.has(key))
@@ -1466,4 +1466,4 @@ async function countUnembeddedSessionCompartmentsPolite2(db, projectPath, sessio
1466
1466
  return count;
1467
1467
  }
1468
1468
 
1469
- export { DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS2, CHUNK_WINDOW_SAFETY_RATIO2, normalizeCompartmentChunkMaxInputTokens2, buildCanonicalChunkTextFromFts2, buildCompartmentSummaryFallbackText2, canonicalizeInMemoryChunkTextForEmbedding2, chunkCanonicalText2, chunkEmbeddingWindowsAreCurrent2, replaceCompartmentChunkEmbeddings2, loadCompartmentChunkEmbeddingsForSearch2, getLastCompartmentChunkPoolWarm2, peekCompartmentChunkSearchPool2, warmCompartmentChunkSearchPool2, maintainCompartmentChunkSearchPools2, loadUnembeddedShadowChunkCandidates2, loadUnembeddedCompartmentChunkCandidatesPolite2, deleteChunkEmbedBackoffForSession2, recordChunkEmbedBackoff2, chunkWindowSourceKey2, loadUnembeddedSessionChunkCandidates2, loadUnembeddedSessionChunkCandidatesPolite2, countUnembeddedSessionCompartments2, countSessionCompartmentEmbedCoverage2, countSessionCompartmentEmbedCoveragePolite2, countUnembeddedSessionCompartmentsPolite2 };
1469
+ export { DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS2, CHUNK_WINDOW_SAFETY_RATIO2, normalizeCompartmentChunkMaxInputTokens2, buildCanonicalChunkTextFromFts2, buildCompartmentSummaryFallbackText2, canonicalizeInMemoryChunkTextForEmbedding2, chunkCanonicalText2, chunkEmbeddingWindowsAreCurrent2, replaceCompartmentChunkEmbeddings2, loadCompartmentChunkEmbeddingsForSearch2, trackCompartmentChunkSearchPool2, getLastCompartmentChunkPoolWarm2, peekCompartmentChunkSearchPool2, warmCompartmentChunkSearchPool2, maintainCompartmentChunkSearchPools2, loadUnembeddedShadowChunkCandidates2, loadUnembeddedCompartmentChunkCandidatesPolite2, deleteChunkEmbedBackoffForSession2, recordChunkEmbedBackoff2, chunkWindowSourceKey2, loadUnembeddedSessionChunkCandidates2, loadUnembeddedSessionChunkCandidatesPolite2, countUnembeddedSessionCompartments2, countSessionCompartmentEmbedCoverage2, countSessionCompartmentEmbedCoveragePolite2, countUnembeddedSessionCompartmentsPolite2 };
@@ -65,14 +65,14 @@ import {
65
65
  hasPendingMigrations,
66
66
  getMainThreadMigrationBodyCount,
67
67
  runMigrations
68
- } from "./server-ps6rz88g.js";
68
+ } from "./server-2p0qayr1.js";
69
69
  import {
70
70
  ensureColumn,
71
71
  setDatabase,
72
72
  loadToolDefinitionMeasurements,
73
73
  installV95PerfSchema,
74
74
  installTagIdentityRevisionTrigger
75
- } from "./server-a2f1bhyj.js";
75
+ } from "./server-stjy5dxv.js";
76
76
  import {
77
77
  resolveOpenCodeDbPath,
78
78
  hasV1MessageTables
@@ -1021,7 +1021,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
1021
1021
  state.running = startMessageFtsRowidMapBackfill2(db, signal).then(async () => {
1022
1022
  if (signal.aborted || !readsOpenCodeStore)
1023
1023
  return;
1024
- const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-n3nhfvd7.js"));
1024
+ const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-38wdy8nd.js"));
1025
1025
  const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-ynb3vg6r.js"));
1026
1026
  if (signal.aborted)
1027
1027
  return;
@@ -3,12 +3,12 @@ import {
3
3
  } from "./server-y8xjr8rx.js";
4
4
  import {
5
5
  getTagById2
6
- } from "./server-s15knz0w.js";
6
+ } from "./server-pmws7we9.js";
7
7
  import {
8
8
  expandToolPart,
9
9
  visitRawSessionMessages2,
10
10
  readRawSessionMessageById2
11
- } from "./server-2k8tkbhz.js";
11
+ } from "./server-c7awk5s2.js";
12
12
 
13
13
  // src/tools/ctx-expand/render.ts
14
14
  import { createHash } from "node:crypto";
package/dist/v2/server.js CHANGED
@@ -27,7 +27,7 @@ import {
27
27
  } from "./server-rz6g5xne.js";
28
28
  import {
29
29
  pushNotification2
30
- } from "./server-fzgyvsb1.js";
30
+ } from "./server-y14pawe1.js";
31
31
  import"./server-gzy5w8ya.js";
32
32
  import {
33
33
  compareSemverCore
@@ -7877,7 +7877,7 @@ var require_src2 = __commonJS(function(exports, module) {
7877
7877
  // package.json
7878
7878
  var package_default = {
7879
7879
  name: "@cortexkit/opencode-magic-context",
7880
- version: "0.49.85",
7880
+ version: "0.49.87",
7881
7881
  type: "module",
7882
7882
  description: "OpenCode plugin for Magic Context — cross-session memory and context management",
7883
7883
  main: "dist/index.js",
@@ -8198,7 +8198,7 @@ async function setup(context) {
8198
8198
  if (claimStorageBackupWarningCheck() && isMagicContextStorageOutsideEngram(storageDir)) {
8199
8199
  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.`);
8200
8200
  }
8201
- const { registerContext } = await import("./context-k2rrqzf4.js");
8201
+ const { registerContext } = await import("./context-s86114yy.js");
8202
8202
  setHarness2("opencode2");
8203
8203
  bindStaleBuildNotice({}, import.meta.url, "opencode2");
8204
8204
  const duties = await registerContext(context);
@@ -31,8 +31,8 @@ import {
31
31
  deleteMemory2,
32
32
  getMemoryCount2,
33
33
  getMemoryCountsByStatus2
34
- } from "./server-jjvbk92s.js";
35
- import"./server-4dhv7mqz.js";
34
+ } from "./server-9emdjcb5.js";
35
+ import"./server-qjwpqvnf.js";
36
36
  import"./server-fr0wbhdn.js";
37
37
  import"./server-gzy5w8ya.js";
38
38
  export {
@@ -64,10 +64,10 @@ import {
64
64
  adoptNullOwnerToolTag2,
65
65
  getCandidateToolOwners2,
66
66
  pickNearestPriorOwner2
67
- } from "./server-s15knz0w.js";
67
+ } from "./server-pmws7we9.js";
68
68
  import"./server-1zx87sdm.js";
69
69
  import"./server-rz6g5xne.js";
70
- import"./server-a2f1bhyj.js";
70
+ import"./server-stjy5dxv.js";
71
71
  import"./server-5sbsnpkn.js";
72
72
  import"./server-y8xjr8rx.js";
73
73
  import"./server-gzy5w8ya.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  readV2ArchiveOffThread2,
3
3
  serveV2ArchiveReads2
4
- } from "./server-97w51d8n.js";
4
+ } from "./server-ff5wcfy4.js";
5
5
  import"./server-v0p37hm2.js";
6
6
  import"./server-gzy5w8ya.js";
7
7
  import"./server-1d042x6w.js";
@@ -12,7 +12,7 @@ import {
12
12
  getCompartments,
13
13
  getLastCompartmentEndMessage,
14
14
  requestPendingMaterialization
15
- } from "./server-4wwwm2ya.js";
15
+ } from "./server-ct0gs8fc.js";
16
16
  import"./server-2amn2s73.js";
17
17
  import"./server-y8xjr8rx.js";
18
18
  import"./server-x6fn9x8q.js";
@@ -24,8 +24,8 @@ import"./server-96ztjvkn.js";
24
24
  import"./server-1d042x6w.js";
25
25
  import"./server-6ash6z8z.js";
26
26
  import"./server-ds8vpfkr.js";
27
- import"./server-8pdfmc27.js";
28
- import"./server-ap81bk3c.js";
27
+ import"./server-y17r5ryz.js";
28
+ import"./server-9n2qgk29.js";
29
29
  import {
30
30
  getWrapupInProgressState,
31
31
  acquireWrapupInProgress,
@@ -33,27 +33,27 @@ import {
33
33
  releaseWrapupInProgress,
34
34
  getHistorianFailureState,
35
35
  clearEmergencyRecovery
36
- } from "./server-s15knz0w.js";
37
- import"./server-a2f1bhyj.js";
38
- import"./server-n5zr7190.js";
36
+ } from "./server-pmws7we9.js";
37
+ import"./server-stjy5dxv.js";
38
+ import"./server-yh2z4gg2.js";
39
39
  import"./server-1zx87sdm.js";
40
40
  import"./server-rz6g5xne.js";
41
41
  import"./server-2ra6pwf3.js";
42
42
  import"./server-3ap5dmhc.js";
43
43
  import {
44
44
  prepareRawSessionOrdinals2
45
- } from "./server-2k8tkbhz.js";
45
+ } from "./server-c7awk5s2.js";
46
46
  import"./server-fr0wbhdn.js";
47
- import"./server-ps6rz88g.js";
47
+ import"./server-2p0qayr1.js";
48
48
  import"./server-r2es6zt7.js";
49
49
  import"./server-rz4snd3x.js";
50
50
  import"./server-qyazxy92.js";
51
51
  import"./server-fb3zxn06.js";
52
52
  import"./server-39bcszk4.js";
53
- import"./server-w7mpvkpj.js";
53
+ import"./server-pbp58w5x.js";
54
54
  import {
55
55
  pushNotification2
56
- } from "./server-fzgyvsb1.js";
56
+ } from "./server-y14pawe1.js";
57
57
  import"./server-at0v0z4t.js";
58
58
  import {
59
59
  describeBoundaryDiagnostics,
@@ -65,22 +65,22 @@ import {
65
65
  registerActiveCompartmentRun,
66
66
  setRecompStarting2,
67
67
  setRecompTerminal2
68
- } from "./server-s76ty4ws.js";
68
+ } from "./server-2r9btf0g.js";
69
69
  import"./server-qt1qqasc.js";
70
- import"./server-hn8b7sfe.js";
70
+ import"./server-xn7zqs4j.js";
71
71
  import"./server-3p6b0qya.js";
72
- import"./server-4dhv7mqz.js";
72
+ import"./server-qjwpqvnf.js";
73
73
  import"./server-b93f0bqh.js";
74
- import"./server-98hsp35q.js";
75
- import"./server-mbkwcwgw.js";
76
- import"./server-jjvbk92s.js";
74
+ import"./server-gwhj0362.js";
75
+ import"./server-axdmkvd5.js";
76
+ import"./server-9emdjcb5.js";
77
77
  import"./server-e2k9mt86.js";
78
78
  import"./server-xa8fefhw.js";
79
79
  import"./server-cwtehwbb.js";
80
80
  import"./server-npdey91q.js";
81
81
  import {
82
82
  sendStatusNotification2
83
- } from "./server-wdq85mxj.js";
83
+ } from "./server-6250cxzs.js";
84
84
  import"./server-5sbsnpkn.js";
85
85
 
86
86
  // src/hooks/magic-context/wrapup-orchestrator.ts
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  readV2ArchiveOffThread2,
3
3
  serveV2ArchiveReads2
4
- } from "./index-1pf5qrx4.js";
4
+ } from "./index-vyfrgwhk.js";
5
5
  import"./index-v0p37hm2.js";
6
6
  import"./index-gzy5w8ya.js";
7
7
  import"./index-1d042x6w.js";
@@ -1,42 +1,42 @@
1
1
  import {
2
2
  runManagedWrapup2
3
- } from "./index-9fsxmjs6.js";
4
- import"./index-kqnef2tg.js";
5
- import"./index-tzbcb8yt.js";
3
+ } from "./index-3jgzd7nz.js";
4
+ import"./index-pmcvg3k1.js";
5
+ import"./index-csztadkj.js";
6
6
  import"./index-832w615x.js";
7
7
  import"./index-sd3egckz.js";
8
- import"./index-pw279hmt.js";
9
- import"./index-k0tb2z28.js";
10
- import"./index-jjvbk92s.js";
11
- import"./index-s8ks5nz4.js";
12
- import"./index-4dhv7mqz.js";
13
- import"./index-w6v4dw5f.js";
14
- import"./index-4ntnt8ee.js";
15
- import"./index-05bm2ndp.js";
8
+ import"./index-c1s40xmj.js";
9
+ import"./index-3x4qvp29.js";
10
+ import"./index-9emdjcb5.js";
11
+ import"./index-watde7a1.js";
12
+ import"./index-qjwpqvnf.js";
13
+ import"./index-kmrv1fw3.js";
14
+ import"./index-jka4y6mv.js";
15
+ import"./index-chpzb6xy.js";
16
16
  import"./index-2amn2s73.js";
17
17
  import"./index-1y4y98r1.js";
18
18
  import"./index-zmqx48vt.js";
19
- import"./index-g6hfh4h4.js";
19
+ import"./index-6zewd2n5.js";
20
20
  import"./index-qt1qqasc.js";
21
- import"./index-7j2zv9nm.js";
22
- import"./index-xrnhxkz7.js";
21
+ import"./index-2qsca7h7.js";
22
+ import"./index-60wnwcwz.js";
23
23
  import"./index-1zx87sdm.js";
24
24
  import"./index-x40zr813.js";
25
- import"./index-fzgyvsb1.js";
25
+ import"./index-y14pawe1.js";
26
26
  import"./index-e6ncz7a6.js";
27
27
  import"./index-k50xhjw1.js";
28
28
  import"./index-6nqz8hsz.js";
29
29
  import"./index-3dtzyred.js";
30
- import"./index-snbpdpa3.js";
30
+ import"./index-3pdknr07.js";
31
31
  import"./index-pxnzyvjc.js";
32
- import"./index-xccywqdj.js";
32
+ import"./index-rvf1726x.js";
33
33
  import"./index-fb3zxn06.js";
34
- import"./index-4w5rx7de.js";
34
+ import"./index-bxrfq3mv.js";
35
35
  import"./index-fr0wbhdn.js";
36
36
  import"./index-7svecf3m.js";
37
37
  import"./index-s32f8y67.js";
38
38
  import"./index-wh9fxds5.js";
39
- import"./index-jrj95cce.js";
39
+ import"./index-m6dnydf8.js";
40
40
  import"./index-q7q6qp1f.js";
41
41
  import"./index-96ztjvkn.js";
42
42
  import"./index-v0p37hm2.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/opencode-magic-context",
3
- "version": "0.49.85",
3
+ "version": "0.49.87",
4
4
  "type": "module",
5
5
  "description": "OpenCode plugin for Magic Context — cross-session memory and context management",
6
6
  "main": "dist/index.js",
@@ -3,6 +3,7 @@ import {
3
3
  describeAssistantSettlement,
4
4
  extractLatestAssistantText,
5
5
  hasLengthCappedOutput,
6
+ isLatestAssistantLengthCapped,
6
7
  } from "./assistant-message-extractor";
7
8
 
8
9
  test("reasoning-only and tool-only turns stay out of manifest text and retain finish diagnostics", () => {
@@ -45,3 +46,24 @@ describe("hasLengthCappedOutput", () => {
45
46
  expect(hasLengthCappedOutput({ role: "assistant", stopReason: "length" })).toBe(true);
46
47
  });
47
48
  });
49
+
50
+ test("only the latest assistant's settlement counts on a reused child", () => {
51
+ const capped = {
52
+ info: { role: "assistant", time: { created: 1 }, finish: "length" },
53
+ parts: [],
54
+ };
55
+ const stopped = {
56
+ info: { role: "assistant", time: { created: 2 }, finish: "stop" },
57
+ parts: [{ type: "tool", state: { input: { finish: "length" } } }],
58
+ };
59
+ expect(isLatestAssistantLengthCapped([capped, stopped])).toBe(false);
60
+ expect(isLatestAssistantLengthCapped([capped])).toBe(true);
61
+ expect(
62
+ isLatestAssistantLengthCapped([
63
+ {
64
+ ...stopped,
65
+ parts: [{ type: "step-finish", reason: "max_tokens" }],
66
+ },
67
+ ]),
68
+ ).toBe(true);
69
+ });
@@ -128,6 +128,19 @@ export function hasLengthCappedOutput(value: unknown): boolean {
128
128
  return Object.values(value).some((item) => hasLengthCappedOutput(item));
129
129
  }
130
130
 
131
+ /** A reused child may still have a capped answer from an earlier turn or model. */
132
+ export function isLatestAssistantLengthCapped(messages: unknown): boolean {
133
+ const latest = getLatestAssistantMessage(messages);
134
+ return (
135
+ hasLengthCappedOutput(latest?.info?.finish ? { finish: latest.info.finish } : null) ||
136
+ (Array.isArray(latest?.parts) &&
137
+ latest.parts.some(
138
+ (part) =>
139
+ isRecord(part) && part.type === "step-finish" && hasLengthCappedOutput(part),
140
+ ))
141
+ );
142
+ }
143
+
131
144
  /** Settlement metadata for diagnostics, never private reasoning as task output. */
132
145
  export function describeAssistantSettlement(output: unknown): string {
133
146
  if (isRecord(output) && isRecord(output.tokenLog)) {
@@ -1,4 +1,4 @@
1
- import { describe, expect, mock, spyOn, test } from "bun:test";
1
+ import { afterEach, describe, expect, jest, mock, spyOn, test } from "bun:test";
2
2
  import { recordedGeminiQuotaMessages } from "../features/magic-context/dreamer/provider-output-failure.test-support";
3
3
  import { HiddenAgentStepLimit } from "../v2/hooks/hidden-child";
4
4
  import { hiddenModelCooldowns } from "./hidden-model-cooldown";
@@ -817,6 +817,19 @@ describe("first-output deadline", () => {
817
817
  const primary = { providerID: "opencode", modelID: "free-model" };
818
818
  type Behaviour = "silent" | "partial" | "answer" | "unmonitored";
819
819
 
820
+ afterEach(() => jest.useRealTimers());
821
+
822
+ function freezeTime() {
823
+ jest.useFakeTimers({ doNotFake: ["setImmediate"] });
824
+ jest.setSystemTime(new Date("2026-08-11T12:00:00Z"));
825
+ }
826
+
827
+ async function advance(ms: number) {
828
+ jest.advanceTimersByTime(ms);
829
+ // Let the attempt's rejection and the next attempt's startup settle.
830
+ await new Promise<void>((resolve) => setImmediate(resolve));
831
+ }
832
+
820
833
  /**
821
834
  * A transport double that behaves per model. "silent" watches the child but the
822
835
  * model never answers; "partial" streams something and then hangs; "unmonitored"
@@ -874,18 +887,27 @@ describe("first-output deadline", () => {
874
887
  }
875
888
 
876
889
  test("a primary that streams nothing by the deadline moves on to the fallback", async () => {
877
- const outcome = await run(
890
+ freezeTime();
891
+ let settled = false;
892
+ const pending = run(
878
893
  { "opencode/free-model": "silent" },
879
894
  { timeoutMs: 2_000, firstOutputTimeoutMs: 40 },
880
- );
895
+ ).then((outcome) => {
896
+ settled = true;
897
+ return outcome;
898
+ });
899
+ await advance(39);
900
+ expect(settled).toBe(false);
901
+ await advance(1);
902
+ expect(settled).toBe(true);
903
+ const outcome = await pending;
881
904
  expect(outcome.caught).toBeUndefined();
882
905
  expect(outcome.result?.attempt.label).toBe("anthropic/claude-sonnet-5-5");
883
906
  expect(outcome.calls.map((call) => call.model)).toEqual([
884
907
  "opencode/free-model",
885
908
  "anthropic/claude-sonnet-5-5",
886
909
  ]);
887
- // The silent primary was cut at its first-output deadline, not its timeout.
888
- expect(outcome.elapsedMs).toBeLessThan(1_000);
910
+ expect(outcome.elapsedMs).toBe(40);
889
911
  });
890
912
 
891
913
  test("the unvalidated chain also moves on from a silent primary", async () => {
@@ -919,16 +941,25 @@ describe("first-output deadline", () => {
919
941
  test("a silent primary's time comes out of the fallback's timeout", async () => {
920
942
  // The fallback is the last model, so it gets no first-output cut of its own;
921
943
  // its timeout is what the silent primary left of the overall 300 ms.
922
- const outcome = await run(
944
+ freezeTime();
945
+ let settled = false;
946
+ const pending = run(
923
947
  { "opencode/free-model": "silent", "anthropic/claude-sonnet-5-5": "silent" },
924
948
  { timeoutMs: 300, firstOutputTimeoutMs: 100 },
925
- );
926
- const message = (outcome.caught as Error).message;
927
- const fallbackTimeoutMs = Number(/prompt timed out after (\d+)ms$/.exec(message)?.[1]);
949
+ ).then((outcome) => {
950
+ settled = true;
951
+ return outcome;
952
+ });
953
+ await advance(100);
954
+ await advance(199);
955
+ expect(settled).toBe(false);
956
+ await advance(1);
957
+ expect(settled).toBe(true);
958
+ const outcome = await pending;
928
959
  expect(outcome.calls).toHaveLength(2);
929
- expect(fallbackTimeoutMs).toBeLessThanOrEqual(200);
930
- expect(fallbackTimeoutMs).toBeGreaterThan(100);
931
- expect(outcome.elapsedMs).toBeLessThan(300 + 150);
960
+ expect(outcome.calls[1]!.startedAt - outcome.calls[0]!.startedAt).toBe(100);
961
+ expect((outcome.caught as Error).message).toBe("prompt timed out after 200ms");
962
+ expect(outcome.elapsedMs).toBe(300);
932
963
  });
933
964
 
934
965
  test("the last model in the chain is never cut for silence", async () => {