@cortexkit/opencode-magic-context 0.49.43 → 0.49.45

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 (147) hide show
  1. package/dist/auto-search-worker.js +4 -4
  2. package/dist/chunk-embedding-write-worker.js +7 -7
  3. package/dist/{compaction-marker-candidates-5c44h1m9.js → compaction-marker-candidates-dkfp1q9j.js} +12 -2
  4. package/dist/compaction-marker-candidates-worker.js +5 -2
  5. package/dist/{compartment-chunk-embedding-ypktm0tk.js → compartment-chunk-embedding-snj51nmg.js} +5 -5
  6. package/dist/{conflict-warning-hook-b75jn458.js → conflict-warning-hook-w1aw6w5t.js} +4 -4
  7. package/dist/{context-zf1yj1g0.js → context-y85dvs6j.js} +28 -28
  8. package/dist/{embedding-backfill-rma0v2ct.js → embedding-backfill-kpy5shsa.js} +9 -9
  9. package/dist/embedding-worker.js +4 -4
  10. package/dist/features/magic-context/compaction-marker-candidates.d.ts +57 -4
  11. package/dist/features/magic-context/compaction-marker-candidates.d.ts.map +1 -1
  12. package/dist/features/magic-context/compaction-marker.d.ts +18 -3
  13. package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
  14. package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -1
  15. package/dist/features/magic-context/memory/embedding-query-deadline.d.ts +8 -0
  16. package/dist/features/magic-context/memory/embedding-query-deadline.d.ts.map +1 -0
  17. package/dist/features/magic-context/overflow-detection.d.ts +16 -6
  18. package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
  19. package/dist/features/magic-context/scheduler.d.ts.map +1 -1
  20. package/dist/hooks/auto-update-checker/index.d.ts +6 -0
  21. package/dist/hooks/auto-update-checker/index.d.ts.map +1 -1
  22. package/dist/hooks/magic-context/apply-operations.d.ts +5 -4
  23. package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
  24. package/dist/hooks/magic-context/cache-busting-signals.d.ts +4 -4
  25. package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -1
  26. package/dist/hooks/magic-context/compaction-marker-manager.d.ts +7 -1
  27. package/dist/hooks/magic-context/compaction-marker-manager.d.ts.map +1 -1
  28. package/dist/hooks/magic-context/compaction-marker-publication.d.ts.map +1 -1
  29. package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
  30. package/dist/hooks/magic-context/inject-compartments.d.ts +7 -2
  31. package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
  32. package/dist/hooks/magic-context/local-wire-reading.d.ts +54 -0
  33. package/dist/hooks/magic-context/local-wire-reading.d.ts.map +1 -0
  34. package/dist/hooks/magic-context/read-session-formatting.d.ts +2 -1
  35. package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -1
  36. package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -1
  37. package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
  38. package/dist/hooks/magic-context/system-date-refresh.d.ts +1 -2
  39. package/dist/hooks/magic-context/system-date-refresh.d.ts.map +1 -1
  40. package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
  41. package/dist/hooks/magic-context/transform-context-state.d.ts +38 -6
  42. package/dist/hooks/magic-context/transform-context-state.d.ts.map +1 -1
  43. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +5 -2
  44. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  45. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  46. package/dist/{index-ayk4we2k.js → index-0a79y98x.js} +41 -31
  47. package/dist/{index-jggt5gf2.js → index-1hwn96x1.js} +1 -1
  48. package/dist/{index-ae1ar4v1.js → index-25ka1jza.js} +1 -1
  49. package/dist/{index-c5dzns43.js → index-4dpvnp8k.js} +1 -1
  50. package/dist/{index-n8bsqg7b.js → index-7na94cjf.js} +3 -3
  51. package/dist/{index-fas76dft.js → index-980brvjr.js} +8 -8
  52. package/dist/{index-4xyjr62e.js → index-ak11t3gm.js} +4 -0
  53. package/dist/{index-vd2ywmfe.js → index-brj6was5.js} +1 -1
  54. package/dist/{index-gsqz39wk.js → index-bzq05g00.js} +3 -3
  55. package/dist/{index-ty4vhe4n.js → index-d4qw2h43.js} +4 -4
  56. package/dist/{index-5m2azs6v.js → index-dcdvyaeh.js} +4 -4
  57. package/dist/{index-g4t7850m.js → index-dj2p8653.js} +1 -1
  58. package/dist/{index-adt3jghq.js → index-fs3zfby1.js} +169 -61
  59. package/dist/{index-xjw9rres.js → index-gf1vx3bn.js} +3 -3
  60. package/dist/{index-3w1pbn85.js → index-gn6gfz4y.js} +64 -12
  61. package/dist/{index-8jjjmhab.js → index-gxqr0sbd.js} +1 -1
  62. package/dist/{index-b1ydbp95.js → index-h9m41624.js} +1 -1
  63. package/dist/{index-xd2p95m7.js → index-hkh8x221.js} +2 -2
  64. package/dist/{index-rdx17j04.js → index-jwa5t1s4.js} +6 -6
  65. package/dist/{index-dcjkw41m.js → index-qcz1fy7h.js} +3 -3
  66. package/dist/{index-1zv08avf.js → index-qdx8dq60.js} +5 -5
  67. package/dist/{index-z6v8086q.js → index-rk5hyc41.js} +5 -5
  68. package/dist/{index-21fgrfrf.js → index-s79g172v.js} +64 -22
  69. package/dist/{index-xnm0wq1r.js → index-sd2s4t4p.js} +1 -1
  70. package/dist/{index-jkanybgq.js → index-smtbdmc3.js} +1 -1
  71. package/dist/{index-p2e7j9p1.js → index-tvd2j34s.js} +2 -2
  72. package/dist/{index-zqsp3z0d.js → index-wwg1je98.js} +9 -6
  73. package/dist/{index-r2epb000.js → index-xa9mmq6c.js} +2 -1
  74. package/dist/{index-xmqj3cf5.js → index-xejh7cqv.js} +136 -63
  75. package/dist/{index-kfsqk1q7.js → index-z8dacvkt.js} +3 -3
  76. package/dist/index.d.ts.map +1 -1
  77. package/dist/index.js +44 -40
  78. package/dist/{message-fts-rowid-map-t6qsyg9s.js → message-fts-rowid-map-msffhkve.js} +2 -2
  79. package/dist/{message-index-bounded-5mj8p6nq.js → message-index-bounded-d8xt6q5c.js} +9 -9
  80. package/dist/migration-worker.js +5 -5
  81. package/dist/{project-embedding-registry-3yyegjma.js → project-embedding-registry-r6xfsrbe.js} +8 -8
  82. package/dist/raw-ordinal-warmup-worker.js +7 -7
  83. package/dist/{read-session-chunk-k70bhfjm.js → read-session-chunk-k3fqshw8.js} +7 -7
  84. package/dist/{read-session-raw-j7c9w57v.js → read-session-raw-x7a9b3jm.js} +1 -1
  85. package/dist/{recomp-orchestrator-2q4rmerf.js → recomp-orchestrator-y75thsc3.js} +21 -21
  86. package/dist/{render-36fvvwz6.js → render-3psbedzk.js} +14 -14
  87. package/dist/{search-archive-jwb2ctnq.js → search-archive-rvr7j5gx.js} +9 -9
  88. package/dist/{search-6v2na3af.js → search-hd16c8gq.js} +17 -17
  89. package/dist/{send-session-notification-14p3yje4.js → send-session-notification-j93pn2hn.js} +3 -3
  90. package/dist/shared/status-view.d.ts.map +1 -1
  91. package/dist/{storage-tags-vj0yj7ed.js → storage-tags-ye9aqrqy.js} +2 -2
  92. package/dist/tools/ctx-search/tools.d.ts.map +1 -1
  93. package/dist/{transform-postprocess-phase-0ms3ga4h.js → transform-postprocess-phase-1rzxmkhb.js} +22 -22
  94. package/dist/v2/auto-search-worker.js +4 -4
  95. package/dist/v2/chunk-embedding-write-worker.js +7 -7
  96. package/dist/v2/compaction-marker-candidates-worker.js +5 -2
  97. package/dist/v2/{compaction-marker-candidates-jy65jt49.js → compaction-marker-candidates-y737qb1v.js} +12 -2
  98. package/dist/v2/{compartment-chunk-embedding-qfk791bd.js → compartment-chunk-embedding-nj5nrnbj.js} +5 -5
  99. package/dist/v2/{context-2xr6vbt2.js → context-0e946t63.js} +194 -76
  100. package/dist/v2/{embedding-backfill-00tw59rx.js → embedding-backfill-360efh1t.js} +9 -9
  101. package/dist/v2/embedding-worker.js +4 -4
  102. package/dist/v2/hooks/context.d.ts.map +1 -1
  103. package/dist/v2/{message-fts-rowid-map-z86avy0n.js → message-fts-rowid-map-qe7cpksd.js} +2 -2
  104. package/dist/v2/{message-index-bounded-5341qsqd.js → message-index-bounded-wt64v2rn.js} +8 -8
  105. package/dist/v2/migration-worker.js +5 -5
  106. package/dist/v2/{project-embedding-registry-jqq2qeqb.js → project-embedding-registry-ek0cy0d5.js} +8 -8
  107. package/dist/v2/raw-ordinal-warmup-worker.js +7 -7
  108. package/dist/v2/{read-session-chunk-dgmq3ntm.js → read-session-chunk-4b31z6bz.js} +6 -6
  109. package/dist/v2/{read-session-raw-qpp6x9kg.js → read-session-raw-yss2ev98.js} +1 -1
  110. package/dist/v2/{recomp-orchestrator-2vmyhtst.js → recomp-orchestrator-6qrm2nea.js} +19 -19
  111. package/dist/v2/{render-kz0f40ws.js → render-f8mw16pp.js} +13 -13
  112. package/dist/v2/{search-archive-wajxd01m.js → search-archive-7d0xdp54.js} +8 -8
  113. package/dist/v2/{search-a9hwy1sw.js → search-ecjd7e50.js} +15 -15
  114. package/dist/v2/{send-session-notification-kxp47tsw.js → send-session-notification-na3q825m.js} +1 -1
  115. package/dist/v2/{server-09td1wgc.js → server-0ymsgh0j.js} +3 -3
  116. package/dist/v2/{server-nmyganc8.js → server-131h608x.js} +1 -1
  117. package/dist/v2/{server-7acq7815.js → server-2gjqhmn9.js} +64 -22
  118. package/dist/v2/{server-xy7w7hrd.js → server-2j87594q.js} +1 -1
  119. package/dist/v2/{server-7qc9tk6z.js → server-2qyfev3b.js} +5 -5
  120. package/dist/v2/{server-qehn6btp.js → server-39kzpp8q.js} +4 -4
  121. package/dist/v2/{server-969cdpmg.js → server-7vb38e51.js} +4 -0
  122. package/dist/v2/{server-sfcp13bn.js → server-an1ff8d8.js} +3 -3
  123. package/dist/v2/{server-tnzbk64q.js → server-b3r080cm.js} +2 -1
  124. package/dist/v2/{server-zzgtgqmd.js → server-ddw42d76.js} +1 -1
  125. package/dist/v2/{server-3m7p4g9w.js → server-ftyc8awt.js} +3 -3
  126. package/dist/v2/{server-xfjjbrkt.js → server-gwqfwtzq.js} +1 -1
  127. package/dist/v2/{server-dwpgzm0t.js → server-gwxys0d0.js} +64 -12
  128. package/dist/v2/{server-dqs8e4yt.js → server-hq7fdqfm.js} +7 -7
  129. package/dist/v2/{server-7zacmty5.js → server-p9s40wfa.js} +1 -1
  130. package/dist/v2/{server-nq3cb7be.js → server-pej5rnye.js} +1 -1
  131. package/dist/v2/{server-6vzh6wej.js → server-sg2qjkrb.js} +2 -2
  132. package/dist/v2/{server-gkse1wyz.js → server-sr8tf5dt.js} +4 -4
  133. package/dist/v2/{server-avdveykk.js → server-vjhk8v41.js} +1 -1
  134. package/dist/v2/{server-kqrpt2ht.js → server-vnpnmrsv.js} +8 -5
  135. package/dist/v2/{server-p78wdf43.js → server-wbxbk3za.js} +3 -3
  136. package/dist/v2/{server-cp1a03vc.js → server-y8n33d9j.js} +3 -3
  137. package/dist/v2/{server-5ydn39x3.js → server-zqzh2ybj.js} +135 -62
  138. package/dist/v2/server.js +4 -4
  139. package/dist/v2/{storage-tags-cw07ky67.js → storage-tags-8nttt1sk.js} +2 -2
  140. package/dist/v2/{v2-archive-reader-ag6sk771.js → v2-archive-reader-53kp5mme.js} +1 -1
  141. package/dist/v2/{wrapup-orchestrator-2a077zew.js → wrapup-orchestrator-bng0dfxy.js} +19 -19
  142. package/dist/{v2-archive-reader-chk95syc.js → v2-archive-reader-0fcxs5e9.js} +1 -1
  143. package/dist/{wrapup-orchestrator-rhs675kj.js → wrapup-orchestrator-r5cqgyrg.js} +22 -22
  144. package/package.json +1 -1
  145. package/src/config/schema/magic-context.ts +1 -1
  146. package/src/shared/status-view.ts +3 -5
  147. package/src/tui/dialogs/status-dialog-render.test.ts +1 -1
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_LOCAL_EMBEDDING_MODEL
3
- } from "./server-7zacmty5.js";
3
+ } from "./server-p9s40wfa.js";
4
4
  import {
5
5
  embedPauseBySession,
6
6
  activeEmbeddingSessions,
@@ -39,10 +39,10 @@ import {
39
39
  isSynapseEmbeddingTruncated,
40
40
  getSynapseBatchRequestKey,
41
41
  SynapseEmbeddingProvider
42
- } from "./server-zzgtgqmd.js";
42
+ } from "./server-ddw42d76.js";
43
43
  import {
44
44
  estimateTokens
45
- } from "./server-969cdpmg.js";
45
+ } from "./server-7vb38e51.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-cp1a03vc.js";
63
+ } from "./server-y8n33d9j.js";
64
64
  import {
65
65
  acquireGitSweepLease,
66
66
  renewGitSweepLease,
@@ -83,7 +83,7 @@ import {
83
83
  logLocalEmbeddingPoolingUnavailableOnce,
84
84
  getEmbeddingProviderIdentity,
85
85
  LocalEmbeddingProvider
86
- } from "./server-6vzh6wej.js";
86
+ } from "./server-sg2qjkrb.js";
87
87
  import {
88
88
  isKnownAutocommit
89
89
  } from "./server-8ajstryz.js";
@@ -402,6 +402,36 @@ function enforceProjectCap(db, projectPath, maxCommits) {
402
402
  // src/features/magic-context/memory/embedding-openai.ts
403
403
  import { createHash } from "node:crypto";
404
404
 
405
+ // src/features/magic-context/memory/embedding-query-deadline.ts
406
+ var QUERY_EMBEDDING_TIMEOUT_MS = 5000;
407
+
408
+ class EmbeddingQueryTimeoutError extends Error {
409
+ timeoutMs = QUERY_EMBEDDING_TIMEOUT_MS;
410
+ constructor() {
411
+ super(`query embedding timed out after ${QUERY_EMBEDDING_TIMEOUT_MS}ms`);
412
+ this.name = "EmbeddingQueryTimeoutError";
413
+ }
414
+ }
415
+ async function withQueryEmbeddingDeadline(embed, signal) {
416
+ if (signal?.aborted)
417
+ return null;
418
+ const deadline = new AbortController;
419
+ const combined = signal ? AbortSignal.any([signal, deadline.signal]) : deadline.signal;
420
+ let onAbort;
421
+ const aborted = new Promise((resolve) => {
422
+ onAbort = () => resolve(null);
423
+ combined.addEventListener("abort", onAbort, { once: true });
424
+ });
425
+ const timer = setTimeout(() => deadline.abort(new EmbeddingQueryTimeoutError), QUERY_EMBEDDING_TIMEOUT_MS);
426
+ try {
427
+ return await Promise.race([embed(combined), aborted]);
428
+ } finally {
429
+ clearTimeout(timer);
430
+ if (onAbort)
431
+ combined.removeEventListener("abort", onAbort);
432
+ }
433
+ }
434
+
405
435
  // src/features/magic-context/memory/embedding-ssrf.ts
406
436
  var METADATA_HOSTNAMES = new Set(["metadata.google.internal", "metadata.goog"]);
407
437
  var IPV6_METADATA_HOSTS = new Set(["fd00:ec2::254"]);
@@ -498,9 +528,9 @@ function normalizeEndpoint(endpoint) {
498
528
  return endpoint?.trim().replace(/\/+$/, "") ?? "";
499
529
  }
500
530
  var FAILURE_THRESHOLD = 3;
501
- var FAILURE_WINDOW_MS = 60000;
502
531
  var OPEN_DURATION_MS = 5 * 60000;
503
532
  var FETCH_TIMEOUT_MS = 30000;
533
+ var FAILURE_WINDOW_MS = FAILURE_THRESHOLD * FETCH_TIMEOUT_MS;
504
534
  var RETRY_AFTER_CAP_MS = 60000;
505
535
  var RATE_LIMIT_BACKOFF_BASE_MS = 1000;
506
536
  var RATE_LIMIT_BACKOFF_CAP_MS = 30000;
@@ -672,6 +702,8 @@ class OpenAICompatibleEmbeddingProvider {
672
702
  let internalController;
673
703
  let timeoutHandle;
674
704
  let onOuterAbort;
705
+ let rateLimitedResponse = false;
706
+ const requestStartedAt = Date.now();
675
707
  try {
676
708
  const claim = this.claimProbeOrShortCircuit();
677
709
  if (claim === "short_circuit") {
@@ -680,7 +712,14 @@ class OpenAICompatibleEmbeddingProvider {
680
712
  isProbe = claim === "probe";
681
713
  internalController = new AbortController;
682
714
  timeoutHandle = setTimeout(() => internalController?.abort(), FETCH_TIMEOUT_MS);
683
- onOuterAbort = () => internalController?.abort();
715
+ onOuterAbort = () => {
716
+ if (signal?.reason instanceof EmbeddingQueryTimeoutError && !rateLimitedResponse) {
717
+ const timeoutMs = signal.reason.timeoutMs;
718
+ log2(`[magic-context] openai-compatible embedding request timed out after ${timeoutMs}ms`);
719
+ this.recordFailure(requestStartedAt, isProbe, this.failure("transport_error", `request timed out after ${timeoutMs}ms`, true));
720
+ }
721
+ internalController?.abort();
722
+ };
684
723
  if (signal) {
685
724
  signal.addEventListener("abort", onOuterAbort, { once: true });
686
725
  }
@@ -701,22 +740,25 @@ class OpenAICompatibleEmbeddingProvider {
701
740
  signal: internalController.signal
702
741
  });
703
742
  if (response.status === 429) {
743
+ rateLimitedResponse = true;
704
744
  await response.text().catch(() => "");
705
745
  this.noteRateLimit(response.headers.get("retry-after"));
706
746
  return RATE_LIMITED;
707
747
  }
708
748
  if (!response.ok) {
709
749
  const excerpt = await response.text().catch(() => "");
750
+ if (signal?.aborted)
751
+ return Array.from({ length: texts.length }, () => null);
710
752
  const failure = this.failure("http_error", `HTTP ${response.status} from endpoint${this.bodyExcerpt(excerpt)}`, response.status >= 500 || response.status === 408);
711
753
  log2(`[magic-context] openai-compatible embedding request failed: ${failure.reason}`);
712
- this.recordFailure(isProbe, failure);
754
+ this.recordFailure(requestStartedAt, isProbe, failure);
713
755
  return Array.from({ length: texts.length }, () => null);
714
756
  }
715
757
  const rawBody = await response.text();
716
758
  if (rawBody.trim().length === 0) {
717
759
  const failure = this.failure("invalid_envelope", "response body was empty", false);
718
760
  log2(`[magic-context] openai-compatible embedding request failed: ${failure.reason}`);
719
- this.recordFailure(isProbe, failure);
761
+ this.recordFailure(requestStartedAt, isProbe, failure);
720
762
  return Array.from({ length: texts.length }, () => null);
721
763
  }
722
764
  let body;
@@ -725,7 +767,7 @@ class OpenAICompatibleEmbeddingProvider {
725
767
  } catch {
726
768
  const failure = this.failure("invalid_envelope", `response body was not valid JSON${this.bodyExcerpt(rawBody)}`, false);
727
769
  log2(`[magic-context] openai-compatible embedding request failed: ${failure.reason}`);
728
- this.recordFailure(isProbe, failure);
770
+ this.recordFailure(requestStartedAt, isProbe, failure);
729
771
  return Array.from({ length: texts.length }, () => null);
730
772
  }
731
773
  const servedModel = typeof body.model === "string" ? body.model : "";
@@ -734,27 +776,27 @@ class OpenAICompatibleEmbeddingProvider {
734
776
  log2(`[magic-context] embedding endpoint served a DIFFERENT model than requested — refusing the substituted vectors (they have the wrong dimensions/space). requested="${sanitizeDiagnosticText(this.model)}" served="${sanitizeDiagnosticText(servedModel)}". Check that the endpoint serves the requested model; variant suffixes and vendor prefixes are matched automatically.`);
735
777
  this.modelMismatchLogged = true;
736
778
  }
737
- this.recordFailure(isProbe, this.failure("substitution_rejected", `served model '${sanitizeDiagnosticText(servedModel)}' does not match requested '${sanitizeDiagnosticText(this.model)}' (substitution guard)`, false));
779
+ this.recordFailure(requestStartedAt, isProbe, this.failure("substitution_rejected", `served model '${sanitizeDiagnosticText(servedModel)}' does not match requested '${sanitizeDiagnosticText(this.model)}' (substitution guard)`, false));
738
780
  return Array.from({ length: texts.length }, () => null);
739
781
  }
740
782
  const responseKeys = Object.keys(body).sort();
741
783
  if (!Array.isArray(body.data)) {
742
784
  const failure = this.failure("invalid_envelope", `response had keys [${responseKeys.join(", ")}] but data[] was absent`, false);
743
785
  log2(`[magic-context] openai-compatible embedding request failed: ${failure.reason}`);
744
- this.recordFailure(isProbe, failure);
786
+ this.recordFailure(requestStartedAt, isProbe, failure);
745
787
  return Array.from({ length: texts.length }, () => null);
746
788
  }
747
789
  if (body.data.length === 0) {
748
790
  const failure = this.failure("empty_result", "response data[] was empty", true);
749
791
  log2(`[magic-context] openai-compatible embedding request failed: ${failure.reason}`);
750
- this.recordFailure(isProbe, failure);
792
+ this.recordFailure(requestStartedAt, isProbe, failure);
751
793
  return Array.from({ length: texts.length }, () => null);
752
794
  }
753
795
  const slots = responseSlots(body.data, texts.length);
754
796
  if (!slots) {
755
797
  const failure = this.failure("invalid_envelope", "response data[].index values were missing, duplicated or out of range", false);
756
798
  log2(`[magic-context] openai-compatible embedding request failed: ${failure.reason}`);
757
- this.recordFailure(isProbe, failure);
799
+ this.recordFailure(requestStartedAt, isProbe, failure);
758
800
  return Array.from({ length: texts.length }, () => null);
759
801
  }
760
802
  const results = Array.from({ length: texts.length }, () => null);
@@ -768,7 +810,7 @@ class OpenAICompatibleEmbeddingProvider {
768
810
  if (results.every((r) => r === null)) {
769
811
  const failure = this.failure("invalid_envelope", `response had keys [${responseKeys.join(", ")}] but data[].embedding was absent`, false);
770
812
  log2(`[magic-context] openai-compatible embedding request failed: ${failure.reason}`);
771
- this.recordFailure(isProbe, failure);
813
+ this.recordFailure(requestStartedAt, isProbe, failure);
772
814
  } else {
773
815
  this.recordSuccess();
774
816
  }
@@ -779,13 +821,13 @@ class OpenAICompatibleEmbeddingProvider {
779
821
  if (signal?.aborted) {} else {
780
822
  log2(`[magic-context] openai-compatible embedding request timed out after ${FETCH_TIMEOUT_MS}ms`);
781
823
  const failure = this.failure("transport_error", `request timed out after ${FETCH_TIMEOUT_MS}ms`, true);
782
- this.recordFailure(isProbe, failure);
824
+ this.recordFailure(requestStartedAt, isProbe, failure);
783
825
  }
784
826
  } else {
785
827
  const detail = error instanceof Error ? error.message : String(error);
786
828
  const failure = this.failure("transport_error", `transport error: ${sanitizeDiagnosticText(detail)}`, true);
787
829
  log2(`[magic-context] openai-compatible embedding request failed: ${failure.reason}`);
788
- this.recordFailure(isProbe, failure);
830
+ this.recordFailure(requestStartedAt, isProbe, failure);
789
831
  }
790
832
  return Array.from({ length: texts.length }, () => null);
791
833
  } finally {
@@ -857,7 +899,7 @@ class OpenAICompatibleEmbeddingProvider {
857
899
  const excerpt = sanitizeDiagnosticText(body).replace(/\s+/g, " ").trim().slice(0, 200);
858
900
  return excerpt ? `: ${excerpt}` : "";
859
901
  }
860
- recordFailure(isProbe, failure) {
902
+ recordFailure(requestStartedAt, isProbe, failure) {
861
903
  if (failure)
862
904
  this.lastFailureReason = failure;
863
905
  if (isProbe) {
@@ -870,9 +912,9 @@ class OpenAICompatibleEmbeddingProvider {
870
912
  return;
871
913
  }
872
914
  const now = Date.now();
873
- const cutoff = now - FAILURE_WINDOW_MS;
874
- this.failureTimes = this.failureTimes.filter((t) => t > cutoff);
875
- this.failureTimes.push(now);
915
+ const cutoff = requestStartedAt - FAILURE_WINDOW_MS;
916
+ this.failureTimes = this.failureTimes.filter((t) => t >= cutoff);
917
+ this.failureTimes.push(requestStartedAt);
876
918
  if (this.failureTimes.length >= FAILURE_THRESHOLD) {
877
919
  this.circuitOpenUntil = now + OPEN_DURATION_MS;
878
920
  if (!this.openLogged) {
@@ -3102,4 +3144,4 @@ function _resetProjectEmbeddingRegistryForTests2() {
3102
3144
  setBootQuietPeriodForTests(null);
3103
3145
  }
3104
3146
 
3105
- export { saveCommitEmbedding, loadProjectCommitEmbeddings, loadUnembeddedCommits, countEmbeddedCommits, upsertCommits, getLatestIndexedCommitSha, enforceProjectCap, OpenAICompatibleEmbeddingProvider, describeShadowBackfillWriteRefusal2, listShadowBackfillStalls2, retainProjectEmbedding2, getShadowBackfillStopReason2, markProjectLoadUntrusted2, contentSha2562, drainProjectEmbeddingIdentityMaintenance2, drainStaleEmbeddingIdentitiesForProject2, registerProjectEmbedding2, registerProjectShadowEmbedding2, getShadowEmbeddingMeasurementCohort2, getPrimaryEmbeddingMeasurementCohort2, embedShadowTextForProject2, enqueueShadowEmbeddingItems2, getShadowBackfillRemaining2, flushShadowEmbeddingBacklog2, registerProjectInObservationMode2, unregisterProjectShadowEmbedding2, unregisterProjectEmbedding2, getProjectEmbeddingSnapshot2, installProjectEmbeddingSearchBridge2, getProjectChunkEmbeddingModelId2, getProjectEmbeddingMaxInputTokens2, embedTextForProject2, embedBatchForProject2, embedItemsForProject2, embedUnembeddedMemoriesForProject2, embedUnembeddedMemoriesForProjectOutcome2, drainCommitBacklogForProject2, embedUnembeddedCompartmentChunksForProject2, embedSessionCompartmentChunks2, getEmbeddingCoverageStatus2, getAutoEmbeddingSessionCoverage2, sweepAllRegisteredProjects2, _setTestProviderFactoryForProject2, _resetProjectEmbeddingRegistryForTests2 };
3147
+ export { saveCommitEmbedding, loadProjectCommitEmbeddings, loadUnembeddedCommits, countEmbeddedCommits, upsertCommits, getLatestIndexedCommitSha, enforceProjectCap, withQueryEmbeddingDeadline, OpenAICompatibleEmbeddingProvider, describeShadowBackfillWriteRefusal2, listShadowBackfillStalls2, retainProjectEmbedding2, getShadowBackfillStopReason2, markProjectLoadUntrusted2, contentSha2562, drainProjectEmbeddingIdentityMaintenance2, drainStaleEmbeddingIdentitiesForProject2, registerProjectEmbedding2, registerProjectShadowEmbedding2, getShadowEmbeddingMeasurementCohort2, getPrimaryEmbeddingMeasurementCohort2, embedShadowTextForProject2, enqueueShadowEmbeddingItems2, getShadowBackfillRemaining2, flushShadowEmbeddingBacklog2, registerProjectInObservationMode2, unregisterProjectShadowEmbedding2, unregisterProjectEmbedding2, getProjectEmbeddingSnapshot2, installProjectEmbeddingSearchBridge2, getProjectChunkEmbeddingModelId2, getProjectEmbeddingMaxInputTokens2, embedTextForProject2, embedBatchForProject2, embedItemsForProject2, embedUnembeddedMemoriesForProject2, embedUnembeddedMemoriesForProjectOutcome2, drainCommitBacklogForProject2, embedUnembeddedCompartmentChunksForProject2, embedSessionCompartmentChunks2, getEmbeddingCoverageStatus2, getAutoEmbeddingSessionCoverage2, sweepAllRegisteredProjects2, _setTestProviderFactoryForProject2, _resetProjectEmbeddingRegistryForTests2 };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  estimateTokens
3
- } from "./server-969cdpmg.js";
3
+ } from "./server-7vb38e51.js";
4
4
  import {
5
5
  stableStringify
6
6
  } from "./server-tpt7bwq8.js";
@@ -18,10 +18,10 @@ import {
18
18
  } from "./server-gzy5w8ya.js";
19
19
  import {
20
20
  deleteUnmappedMessageFtsRows2
21
- } from "./server-nmyganc8.js";
21
+ } from "./server-131h608x.js";
22
22
  import {
23
23
  deleteChunkEmbedBackoffForSession2
24
- } from "./server-cp1a03vc.js";
24
+ } from "./server-y8n33d9j.js";
25
25
  import {
26
26
  isPidAlive,
27
27
  readProcessStartTime
@@ -53,7 +53,7 @@ import {
53
53
  serializeProcessedImageMarkers,
54
54
  getPendingPiCompactionMarkerState,
55
55
  logPiCompactionMarkerClear
56
- } from "./server-kqrpt2ht.js";
56
+ } from "./server-vnpnmrsv.js";
57
57
  import {
58
58
  getTableColumnNames,
59
59
  tagTombstoneOwnerRange,
@@ -66,14 +66,14 @@ import {
66
66
  stripTagPrefix,
67
67
  isRecord,
68
68
  providerVisibleMessage
69
- } from "./server-xfjjbrkt.js";
69
+ } from "./server-gwqfwtzq.js";
70
70
  import {
71
71
  withReadOnlySessionDb
72
72
  } from "./server-mfn1yf9d.js";
73
73
  import {
74
74
  BoundedSessionMap,
75
75
  getMeasuredToolDefinitionTokens
76
- } from "./server-xy7w7hrd.js";
76
+ } from "./server-2j87594q.js";
77
77
  import {
78
78
  layoutLkgPrefix,
79
79
  assembleLkgPrefix
@@ -6,10 +6,10 @@ import {
6
6
  } from "./server-gzy5w8ya.js";
7
7
  import {
8
8
  runSessionWarmupWorker
9
- } from "./server-tnzbk64q.js";
9
+ } from "./server-b3r080cm.js";
10
10
  import {
11
11
  estimateTokens
12
- } from "./server-969cdpmg.js";
12
+ } from "./server-7vb38e51.js";
13
13
  import {
14
14
  openCodeDbExists,
15
15
  withReadOnlySessionDb
@@ -19,10 +19,10 @@ import {
19
19
  rawMessageWorkerSource2,
20
20
  rawMessageOffThreadRangeReader2,
21
21
  readRawSessionMessageIdOrdinalsForRange2
22
- } from "./server-kqrpt2ht.js";
22
+ } from "./server-vnpnmrsv.js";
23
23
  import {
24
24
  readV2ArchiveOffThread2
25
- } from "./server-sfcp13bn.js";
25
+ } from "./server-an1ff8d8.js";
26
26
 
27
27
  // src/tools/ctx-expand/search-archive.ts
28
28
  var archiveReadsOnThisThread = 0;
@@ -393,6 +393,7 @@ function extractToolCallSummaries(parts) {
393
393
  }
394
394
  return summaries;
395
395
  }
396
+ var COMMAND_ARG_MAX_CHARS = 200;
396
397
  function extractKeyArg(_toolName, input) {
397
398
  if (!input)
398
399
  return null;
@@ -410,6 +411,9 @@ function extractKeyArg(_toolName, input) {
410
411
  return input.module;
411
412
  if (typeof input.action === "string")
412
413
  return input.action;
414
+ if (typeof input.command === "string") {
415
+ return truncateArg(normalizeText(input.command), COMMAND_ARG_MAX_CHARS);
416
+ }
413
417
  return null;
414
418
  }
415
419
  function truncateArg(value, maxLen = 60) {
@@ -139,9 +139,9 @@ async function serveV2ArchiveReads2(port, openConnections) {
139
139
  import("./sqlite-zdgm52sv.js"),
140
140
  import("./store-reader-cgx47zkp.js"),
141
141
  import("./store-pebs9m52.js"),
142
- import("./read-session-chunk-dgmq3ntm.js"),
143
- import("./render-kz0f40ws.js"),
144
- import("./search-archive-wajxd01m.js"),
142
+ import("./read-session-chunk-4b31z6bz.js"),
143
+ import("./render-f8mw16pp.js"),
144
+ import("./search-archive-7d0xdp54.js"),
145
145
  import("./expand-attachments-h33jbgyz.js")
146
146
  ]);
147
147
  const pool = new V2StoreReaderPool;
@@ -236,7 +236,8 @@ var RAW_SUMMARY_TOOL_INPUT_KEYS = [
236
236
  "query",
237
237
  "symbol",
238
238
  "module",
239
- "action"
239
+ "action",
240
+ "command"
240
241
  ];
241
242
  function summaryStringField(jsonPath) {
242
243
  return `CASE WHEN json_type(data, '${jsonPath}') = 'text' THEN substr(json_extract(data, '${jsonPath}'), 1, ${RAW_SUMMARY_ARG_MAX_CHARS}) END`;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  estimateTokens
3
- } from "./server-969cdpmg.js";
3
+ } from "./server-7vb38e51.js";
4
4
  import {
5
5
  getHarness2
6
6
  } from "./server-pavzsdc6.js";
@@ -3,19 +3,19 @@ import {
3
3
  removeNestedBlocks,
4
4
  hasMeaningfulUserText2,
5
5
  extractTexts2
6
- } from "./server-969cdpmg.js";
6
+ } from "./server-7vb38e51.js";
7
7
  import {
8
8
  getHarness2
9
9
  } from "./server-pavzsdc6.js";
10
10
  import {
11
11
  cleanUserText2
12
- } from "./server-kqrpt2ht.js";
12
+ } from "./server-vnpnmrsv.js";
13
13
  import {
14
14
  recordMessageFtsRowid2,
15
15
  recordIndexedMessageTime2,
16
16
  messageFtsOrdinalRangeIsMapped2,
17
17
  deleteUnmappedMessageFtsRows2
18
- } from "./server-nmyganc8.js";
18
+ } from "./server-131h608x.js";
19
19
  import {
20
20
  logSlowWriteTransaction
21
21
  } from "./server-qmmkhz2z.js";
@@ -4,7 +4,7 @@ import {
4
4
  } from "./server-1zx87sdm.js";
5
5
  import {
6
6
  estimateTokens
7
- } from "./server-969cdpmg.js";
7
+ } from "./server-7vb38e51.js";
8
8
  import {
9
9
  getHarness2
10
10
  } from "./server-pavzsdc6.js";
@@ -26,9 +26,10 @@ var missingWorkerWarnings = new Set;
26
26
  var ownWriteRevisions = new Map;
27
27
  var exitRegistered = false;
28
28
  function reportWorkerUnavailable(entry, detail) {
29
- if (missingWorkerWarnings.has(entry.href))
29
+ const key = `${entry.href}\x00${detail}`;
30
+ if (missingWorkerWarnings.has(key))
30
31
  return;
31
- missingWorkerWarnings.add(entry.href);
32
+ missingWorkerWarnings.add(key);
32
33
  const path = entry.protocol === "file:" ? fileURLToPath(entry) : entry.href;
33
34
  log2(`[magic-context] [ERROR] compaction-marker: candidate worker unavailable ${path}: ${detail}; marker unchanged, advancement deferred`);
34
35
  }
@@ -64,6 +65,9 @@ function invalidateMarkerCandidateBasis2(db, sessionId) {
64
65
  if (revision !== undefined)
65
66
  ownWriteRevisions.set(key, revision + 1);
66
67
  }
68
+ function discardMarkerCandidateBasis2(db, sessionId) {
69
+ candidates.get(db)?.delete(sessionId);
70
+ }
67
71
  function readMarkerCandidateBasis2(db, sessionId, readConnection = db) {
68
72
  const basis = candidates.get(db)?.get(sessionId);
69
73
  if (basis) {
@@ -94,7 +98,7 @@ function prepareMarkerCandidateBasis2(db, sessionId, options = {}) {
94
98
  reportWorkerUnavailable(entry, "file missing");
95
99
  return Promise.resolve(false);
96
100
  }
97
- const preparation = runCandidateWorker(path, sessionId, options).then((snapshot) => {
101
+ const preparation = runCandidateWorker(path, sessionId, options.references !== false, options).then((snapshot) => {
98
102
  if (!snapshot)
99
103
  return false;
100
104
  const basis = {
@@ -124,7 +128,7 @@ function prepareMarkerCandidateBasis2(db, sessionId, options = {}) {
124
128
  function markerWorkerEntry() {
125
129
  return new URL(new URL(import.meta.url).pathname.endsWith(".ts") ? "./compaction-marker-candidates-worker.ts" : "./compaction-marker-candidates-worker.js", import.meta.url);
126
130
  }
127
- function runCandidateWorker(path, sessionId, options) {
131
+ function runCandidateWorker(path, sessionId, references, options) {
128
132
  if (!exitRegistered) {
129
133
  exitRegistered = true;
130
134
  const controller = new AbortController;
@@ -164,10 +168,14 @@ function runCandidateWorker(path, sessionId, options) {
164
168
  timer.unref?.();
165
169
  };
166
170
  try {
167
- worker = inRootAsyncContext2(() => options.entry ? new Worker(entry, { workerData: { path, sessionId } }) : reuseWorker(entry, { workerData: { path, sessionId } }));
171
+ const pooled = !options.entry || options.shareWorker === true;
172
+ worker = inRootAsyncContext2(() => pooled ? reuseWorker(entry, { workerData: { path, sessionId, references } }) : new Worker(entry, { workerData: { path, sessionId, references } }));
168
173
  workers.add(worker);
169
174
  worker.unref();
170
- deadline(options.acceptMs ?? 2000);
175
+ if (pooled)
176
+ worker.once("online", () => deadline(options.acceptMs ?? 2000));
177
+ else
178
+ deadline(options.acceptMs ?? 2000);
171
179
  worker.on("message", (reply) => {
172
180
  if (reply.kind === "accepted")
173
181
  deadline(options.resultMs ?? 600000);
@@ -205,20 +213,64 @@ function scanMarkerSummaryCandidates(db, sessionId) {
205
213
  db.exec("ROLLBACK");
206
214
  }
207
215
  }
208
- function scanMarkerCandidateSnapshot2(db, sessionId) {
216
+ function scanMarkerCandidateSnapshot2(db, sessionId, references = true) {
209
217
  const ownsSnapshot = !db.inTransaction;
210
218
  if (ownsSnapshot)
211
219
  db.exec("BEGIN");
212
220
  try {
213
221
  const ids = scanMarkerSummaryCandidates(db, sessionId);
214
- const frontier = db.prepare("SELECT rowid,id FROM message ORDER BY rowid DESC LIMIT 1").get() ?? null;
215
- if (frontier && !Number.isSafeInteger(frontier.rowid))
216
- throw new Error("marker frontier rowid is not a safe integer");
217
- return { ids, frontier };
222
+ const frontier = readMarkerFrontier(db, "message");
223
+ if (!references)
224
+ return { ids, frontier };
225
+ return {
226
+ ids,
227
+ frontier,
228
+ references: {
229
+ partIds: readMarkerReferenceRows2(db, sessionId, "part").map((row) => row.id),
230
+ partFrontiers: readMarkerFrontiers2(db, "part")
231
+ }
232
+ };
218
233
  } finally {
219
234
  if (ownsSnapshot)
220
235
  db.exec("ROLLBACK");
221
236
  }
222
237
  }
238
+ function readMarkerFrontier(db, table) {
239
+ const frontier = db.prepare(`SELECT rowid,id FROM ${table} ORDER BY rowid DESC LIMIT 1`).all()[0] ?? null;
240
+ if (frontier && !Number.isSafeInteger(frontier.rowid))
241
+ throw new Error(`marker ${table} frontier rowid is not a safe integer`);
242
+ return frontier;
243
+ }
244
+ var MARKER_FRONTIER_CANDIDATES = 3;
245
+ function readMarkerFrontiers2(db, table, count = MARKER_FRONTIER_CANDIDATES) {
246
+ const frontiers = db.prepare(`SELECT rowid,id FROM ${table} ORDER BY rowid DESC LIMIT ?`).all(count);
247
+ if (frontiers.some((frontier) => !Number.isSafeInteger(frontier.rowid)))
248
+ throw new Error(`marker ${table} frontier rowid is not a safe integer`);
249
+ return frontiers;
250
+ }
251
+ var MARKER_REFERENCE_FRONTIER_SQL = (table) => `SELECT rowid FROM ${table} WHERE id = ?`;
252
+ function certifiedMarkerReferenceFloor2(db, table, frontiers) {
253
+ if (frontiers.length === 0)
254
+ return 0;
255
+ const probe = db.prepare(MARKER_REFERENCE_FRONTIER_SQL(table));
256
+ for (const frontier of [...frontiers].sort((a, b) => b.rowid - a.rowid)) {
257
+ const current = probe.all(frontier.id);
258
+ if (current[0]?.rowid === frontier.rowid)
259
+ return frontier.rowid;
260
+ }
261
+ return;
262
+ }
263
+ var MARKER_TAIL_REFERENCE_COLUMNS = `id,
264
+ CASE WHEN data LIKE '%tail_start_id%' THEN json_extract(data, '$.tail_start_id') END AS direct,
265
+ CASE WHEN data LIKE '%tail_start_id%' THEN json_extract(data, '$.compaction.tail_start_id') END AS nested`;
266
+ function readMarkerReferenceRows2(db, sessionId, table, afterRowid) {
267
+ return db.prepare(`SELECT ${MARKER_TAIL_REFERENCE_COLUMNS} FROM ${table}
268
+ WHERE ${afterRowid === undefined ? "session_id = ?" : "rowid > ? AND +session_id = ?"}
269
+ AND ${table === "part" ? "data LIKE '%compaction%' AND json_valid(data) AND json_extract(data, '$.type') = 'compaction'" : "(data LIKE '%compaction%' OR data LIKE '%tail_start_id%') AND json_valid(data) AND (json_type(data, '$.compaction') IS NOT NULL OR json_type(data, '$.tail_start_id') IS NOT NULL)"}`).all(...afterRowid === undefined ? [sessionId] : [afterRowid, sessionId]);
270
+ }
271
+ function readKnownMarkerReferenceRows2(db, sessionId, table, ids) {
272
+ const byId = db.prepare(`SELECT ${MARKER_TAIL_REFERENCE_COLUMNS} FROM ${table} WHERE id = ? AND session_id = ?`);
273
+ return ids.flatMap((id) => byId.all(id, sessionId));
274
+ }
223
275
 
224
- export { isMarkerCandidateBasisCurrent2, invalidateMarkerCandidateBasis2, readMarkerCandidateBasis2, prepareMarkerCandidateBasis2, scanMarkerCandidateSnapshot2 };
276
+ export { isMarkerCandidateBasisCurrent2, invalidateMarkerCandidateBasis2, discardMarkerCandidateBasis2, readMarkerCandidateBasis2, prepareMarkerCandidateBasis2, scanMarkerCandidateSnapshot2, readMarkerFrontiers2, certifiedMarkerReferenceFloor2, readMarkerReferenceRows2, readKnownMarkerReferenceRows2 };
@@ -15,7 +15,7 @@ import {
15
15
  } from "./server-69m30b21.js";
16
16
  import {
17
17
  isRecord
18
- } from "./server-xfjjbrkt.js";
18
+ } from "./server-gwqfwtzq.js";
19
19
  import {
20
20
  cleanSearchText,
21
21
  hintKeywordRelevance,
@@ -25,7 +25,7 @@ import {
25
25
  isMessageIndexReconciledThrough,
26
26
  clearIndexedMessages,
27
27
  indexMessagesAfterOrdinal
28
- } from "./server-3m7p4g9w.js";
28
+ } from "./server-ftyc8awt.js";
29
29
  import {
30
30
  Priority,
31
31
  AdmissionClass,
@@ -34,13 +34,13 @@ import {
34
34
  StaleRouteHandleError,
35
35
  SubcClient,
36
36
  isConsumerReconnectTransient
37
- } from "./server-zzgtgqmd.js";
37
+ } from "./server-ddw42d76.js";
38
38
  import {
39
39
  buildCanonicalChunkTextFromFts2,
40
40
  loadCompartmentChunkEmbeddingsForSearch2,
41
41
  peekCompartmentChunkSearchPool2,
42
42
  warmCompartmentChunkSearchPool2
43
- } from "./server-cp1a03vc.js";
43
+ } from "./server-y8n33d9j.js";
44
44
  import {
45
45
  saveCommitEmbedding,
46
46
  loadProjectCommitEmbeddings,
@@ -56,7 +56,7 @@ import {
56
56
  enqueueShadowEmbeddingItems2,
57
57
  getProjectEmbeddingSnapshot2,
58
58
  embedItemsForProject2
59
- } from "./server-7acq7815.js";
59
+ } from "./server-2gjqhmn9.js";
60
60
  import {
61
61
  recordEmbeddingMeasurement
62
62
  } from "./server-2amn2s73.js";
@@ -68,7 +68,7 @@ import {
68
68
  isEmbeddingEnabled,
69
69
  embedText,
70
70
  ensureMemoryEmbeddings2
71
- } from "./server-gkse1wyz.js";
71
+ } from "./server-sr8tf5dt.js";
72
72
  import {
73
73
  ModuleMemoryAuthorityError2,
74
74
  getMemoriesByProject2,
@@ -81,7 +81,7 @@ import {
81
81
  sanitizeFtsQuery,
82
82
  searchMemoriesFTS,
83
83
  searchMemoriesFTSUnion
84
- } from "./server-nq3cb7be.js";
84
+ } from "./server-pej5rnye.js";
85
85
  import {
86
86
  MESSAGE_FTS_SESSION_FILTER_SQL,
87
87
  withMessageFtsSessionFilter
@@ -7002,7 +7002,7 @@ var MagicContextConfigSchema = object({
7002
7002
  enabled: boolean().default(true).describe("Enable smart-note authoring and condition evaluation. Needs a runnable dreamer, which evaluates the conditions: with dreamer.disable true (or no dreamer block) ctx_note offers no surface_condition whatever this says. User-level only: tool definitions are process-wide. Changes require a host restart and rebuild each session's cached prompt once. Pending notes remain stored and unchecked; already-ready notes still surface."),
7003
7003
  retina_handoff: boolean().default(false).describe("When true, dreamer skips smart notes whose surface conditions compiled to retina provider configs at authoring time. Default false keeps both paths active until the retina consumer is deployed.")
7004
7004
  }).default({ enabled: true, retina_handoff: false }).describe("Smart-note ownership transition controls."),
7005
- cache_ttl: union([string(), object({ default: string() }).catchall(string())]).default("5m").describe(`How long Magic Context assumes the provider's cached prefix stays valid. This is MC's own deferral gate — it does not change the provider's actual cache lifetime. String (e.g. "5m", "1h", "30s") or per-model object ({ default: "5m", "provider/model": "1h", "provider/*": "never" }); keys resolve most-specific first (exact provider/model, bare model ID, shorter dash-prefixes, then the provider/* wildcard, then default). User and project settings, including an explicit "5m" or object default, apply on the next pass. Only built-in defaults are frozen per session, including across restarts: when unset, GPT-5.6 and later (including gpt-6*, through any provider prefix) use 30m, other models use 5m. /ctx-status shows the effective TTL and whether it comes from your config or a frozen built-in default. Editing the TTL does not itself rewrite prompt bytes; a lowered TTL rebuilds only after normal idle expiry. OpenAI documents at least 30 minutes since the latest write or reuse: https://developers.openai.com/api/docs/guides/prompt-caching (Cache lifetime and Summary of model differences). Set to "never" to mean MC never assumes expiry (for lanes kept warm externally by a cache-keep tool) — disables the idle-TTL heuristic so MC never initiates a rebuild based on elapsed time. Provider-side extended TTL is a separate request-level concern (cache_control: { ttl } in the request body).`),
7005
+ cache_ttl: union([string(), object({ default: string() }).catchall(string())]).default("5m").describe(`How long Magic Context assumes the provider's cached prefix stays valid. It does not change the provider's actual cache lifetime, and it triggers no rebuild or fold: after an expiry the next request replays the same bytes. Magic Context uses it for diagnostics and, on OpenCode 2, to time an idle checkpoint in the host's session store (the experimental Rust transform still rebuilds on it). String (e.g. "5m", "1h", "30s") or per-model object ({ default: "5m", "provider/model": "1h", "provider/*": "never" }); keys resolve most-specific first (exact provider/model, bare model ID, shorter dash-prefixes, then the provider/* wildcard, then default). User and project settings, including an explicit "5m" or object default, apply on the next pass. Only built-in defaults are frozen per session, including across restarts: when unset, GPT-5.6 and later (including gpt-6*, through any provider prefix) use 30m, other models use 5m. /ctx-status shows the effective TTL and whether it comes from your config or a frozen built-in default. Editing the TTL never rewrites prompt bytes. OpenAI documents at least 30 minutes since the latest write or reuse: https://developers.openai.com/api/docs/guides/prompt-caching (Cache lifetime and Summary of model differences). Set to "never" to mean MC never assumes expiry (for a provider cache that an external cache-keep tool keeps warm). Provider-side extended TTL is a separate request-level concern (cache_control: { ttl } in the request body).`),
7006
7006
  prompt_surface: PromptSurfaceConfigSchema.default({ default: "full" }).describe("Prompt-surface presets: default is full; models use bare model IDs, provider/model, or provider/* routing keys. Guidance and tool-description overrides are user-level only. OpenCode 1.x, Pi, and OMP register tool descriptions once per process (they follow the default preset). OpenCode 2 rewrites the five ctx_* descriptions per request from the draft model."),
7007
7007
  output_reserve: union([
7008
7008
  number().min(0),
@@ -10,7 +10,7 @@ import {
10
10
  } from "./server-jb6tjyeb.js";
11
11
  import {
12
12
  embedTextForProject2
13
- } from "./server-7acq7815.js";
13
+ } from "./server-2gjqhmn9.js";
14
14
  import {
15
15
  saveEmbeddingIfHashMatches
16
16
  } from "./server-4dhv7mqz.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DEFAULT_LOCAL_EMBEDDING_MODEL
3
- } from "./server-7zacmty5.js";
3
+ } from "./server-p9s40wfa.js";
4
4
  import {
5
5
  getHarness2
6
6
  } from "./server-pavzsdc6.js";
@@ -11,7 +11,7 @@ import {
11
11
  } from "./server-jb6tjyeb.js";
12
12
  import {
13
13
  getSynapseLaneIdentity
14
- } from "./server-zzgtgqmd.js";
14
+ } from "./server-ddw42d76.js";
15
15
  import {
16
16
  inRootAsyncContext2
17
17
  } from "./server-gzy5w8ya.js";
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  DEFAULT_LOCAL_EMBEDDING_MODEL
3
- } from "./server-7zacmty5.js";
3
+ } from "./server-p9s40wfa.js";
4
4
  import {
5
5
  log2
6
6
  } from "./server-jb6tjyeb.js";
7
7
  import {
8
8
  isSynapseEmbeddingTruncated,
9
9
  SynapseEmbeddingProvider
10
- } from "./server-zzgtgqmd.js";
10
+ } from "./server-ddw42d76.js";
11
11
  import {
12
12
  LocalEmbeddingProvider
13
- } from "./server-6vzh6wej.js";
13
+ } from "./server-sg2qjkrb.js";
14
14
  import {
15
15
  OpenAICompatibleEmbeddingProvider,
16
16
  getProjectEmbeddingSnapshot2,
17
17
  embedBatchForProject2
18
- } from "./server-7acq7815.js";
18
+ } from "./server-2gjqhmn9.js";
19
19
  import {
20
20
  isEmbeddingHostBusy2
21
21
  } from "./server-qt1qqasc.js";