@cortexkit/opencode-magic-context 0.41.3 → 0.41.4

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 (119) hide show
  1. package/dist/config/index.d.ts +9 -0
  2. package/dist/config/index.d.ts.map +1 -1
  3. package/dist/{conflict-warning-hook-z5sd697e.js → conflict-warning-hook-ejkc9sjn.js} +2 -2
  4. package/dist/{derive-budgets-901a0pk0.js → derive-budgets-bc366cz8.js} +4 -2
  5. package/dist/features/magic-context/dreamer/classify.d.ts.map +1 -1
  6. package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts +13 -0
  7. package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts.map +1 -1
  8. package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
  9. package/dist/features/magic-context/dreamer/task-scheduler.d.ts +3 -0
  10. package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
  11. package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
  12. package/dist/features/magic-context/storage-meta-persisted.d.ts +2 -2
  13. package/dist/hooks/magic-context/command-handler.d.ts +5 -1
  14. package/dist/hooks/magic-context/command-handler.d.ts.map +1 -1
  15. package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
  16. package/dist/hooks/magic-context/compartment-runner-types.d.ts +4 -0
  17. package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
  18. package/dist/hooks/magic-context/derive-budgets.d.ts +1 -0
  19. package/dist/hooks/magic-context/derive-budgets.d.ts.map +1 -1
  20. package/dist/hooks/magic-context/emergency-drop.d.ts +3 -1
  21. package/dist/hooks/magic-context/emergency-drop.d.ts.map +1 -1
  22. package/dist/hooks/magic-context/execute-status.d.ts +7 -1
  23. package/dist/hooks/magic-context/execute-status.d.ts.map +1 -1
  24. package/dist/hooks/magic-context/heuristic-cleanup.d.ts +4 -3
  25. package/dist/hooks/magic-context/heuristic-cleanup.d.ts.map +1 -1
  26. package/dist/hooks/magic-context/hook-handlers.d.ts +2 -0
  27. package/dist/hooks/magic-context/hook-handlers.d.ts.map +1 -1
  28. package/dist/hooks/magic-context/hook.d.ts +5 -2
  29. package/dist/hooks/magic-context/hook.d.ts.map +1 -1
  30. package/dist/hooks/magic-context/issue-423-fixture.d.ts +37 -0
  31. package/dist/hooks/magic-context/issue-423-fixture.d.ts.map +1 -0
  32. package/dist/hooks/magic-context/issue-424-fixture.d.ts +11 -0
  33. package/dist/hooks/magic-context/issue-424-fixture.d.ts.map +1 -0
  34. package/dist/hooks/magic-context/producer-window-guard.d.ts +8 -0
  35. package/dist/hooks/magic-context/producer-window-guard.d.ts.map +1 -0
  36. package/dist/hooks/magic-context/protected-tail-boundary.d.ts +59 -0
  37. package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
  38. package/dist/hooks/magic-context/read-session-chunk.d.ts +2 -0
  39. package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
  40. package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts +4 -1
  41. package/dist/hooks/magic-context/read-session-true-raw-tokens.d.ts.map +1 -1
  42. package/dist/hooks/magic-context/recomp-orchestrator.d.ts +2 -0
  43. package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -1
  44. package/dist/hooks/magic-context/rust-mode-transform.d.ts +5 -2
  45. package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
  46. package/dist/hooks/magic-context/sentinel.d.ts +3 -3
  47. package/dist/hooks/magic-context/sentinel.d.ts.map +1 -1
  48. package/dist/hooks/magic-context/tag-messages.d.ts +2 -0
  49. package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
  50. package/dist/hooks/magic-context/tail-hygiene-walk.d.ts +8 -3
  51. package/dist/hooks/magic-context/tail-hygiene-walk.d.ts.map +1 -1
  52. package/dist/hooks/magic-context/tool-drop-target.d.ts +1 -0
  53. package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
  54. package/dist/hooks/magic-context/transform-compartment-phase.d.ts +2 -0
  55. package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
  56. package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
  57. package/dist/hooks/magic-context/transform.d.ts +4 -0
  58. package/dist/hooks/magic-context/transform.d.ts.map +1 -1
  59. package/dist/hooks/magic-context/wrapup-orchestrator.d.ts.map +1 -1
  60. package/dist/{index-vmmjdpc0.js → index-0y2mcg5y.js} +282 -41
  61. package/dist/{index-npx8vhmy.js → index-4avmwfp5.js} +1 -1
  62. package/dist/{index-kby1sng5.js → index-avwt563y.js} +8 -1
  63. package/dist/{index-0bycg0np.js → index-fz104x1j.js} +1 -1
  64. package/dist/{index-dn1rwpd8.js → index-mjv9je4e.js} +14 -10
  65. package/dist/index-sd3egckz.js +1583 -0
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +455 -1400
  68. package/dist/plugin/hooks/create-session-hooks.d.ts +3 -0
  69. package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
  70. package/dist/plugin/rpc-handlers.d.ts.map +1 -1
  71. package/dist/{recomp-orchestrator-f5m2wk74.js → recomp-orchestrator-q98r6rga.js} +4 -4
  72. package/dist/shared/cache-ttl-display.d.ts +23 -0
  73. package/dist/shared/cache-ttl-display.d.ts.map +1 -0
  74. package/dist/shared/cache-ttl-seed.d.ts +10 -0
  75. package/dist/shared/cache-ttl-seed.d.ts.map +1 -0
  76. package/dist/shared/config-diagnostics.d.ts +30 -0
  77. package/dist/shared/config-diagnostics.d.ts.map +1 -0
  78. package/dist/shared/config-warning-surface.d.ts +3 -0
  79. package/dist/shared/config-warning-surface.d.ts.map +1 -0
  80. package/dist/shared/data-path.d.ts +10 -9
  81. package/dist/shared/data-path.d.ts.map +1 -1
  82. package/dist/shared/harness-provider-map.d.ts +7 -0
  83. package/dist/shared/harness-provider-map.d.ts.map +1 -1
  84. package/dist/shared/jsonc-parser.d.ts +12 -0
  85. package/dist/shared/jsonc-parser.d.ts.map +1 -1
  86. package/dist/shared/model-suggestion-retry.d.ts +14 -10
  87. package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
  88. package/dist/shared/pi-executable.d.ts +6 -0
  89. package/dist/shared/pi-executable.d.ts.map +1 -0
  90. package/dist/shared/rpc-types.d.ts +6 -0
  91. package/dist/shared/rpc-types.d.ts.map +1 -1
  92. package/dist/shared/rpc-utils.d.ts.map +1 -1
  93. package/dist/shared/status-detail-text.d.ts.map +1 -1
  94. package/dist/shared/tag-transcript.d.ts.map +1 -1
  95. package/dist/{storage-meta-session-3rxx9ekm.js → storage-meta-session-dvwfw778.js} +1 -1
  96. package/package.json +1 -1
  97. package/src/config/index.test.ts +44 -0
  98. package/src/config/index.ts +96 -15
  99. package/src/shared/cache-ttl-display.test.ts +84 -0
  100. package/src/shared/cache-ttl-display.ts +64 -0
  101. package/src/shared/cache-ttl-seed.ts +23 -0
  102. package/src/shared/config-diagnostics.test.ts +29 -0
  103. package/src/shared/config-diagnostics.ts +64 -0
  104. package/src/shared/config-warning-surface.ts +28 -0
  105. package/src/shared/data-path.ts +10 -9
  106. package/src/shared/harness-provider-map.test.ts +16 -0
  107. package/src/shared/harness-provider-map.ts +15 -0
  108. package/src/shared/jsonc-parser.test.ts +14 -1
  109. package/src/shared/jsonc-parser.ts +93 -0
  110. package/src/shared/model-suggestion-retry.ts +143 -28
  111. package/src/shared/pi-executable.ts +20 -0
  112. package/src/shared/rpc-types.ts +6 -0
  113. package/src/shared/rpc-utils.ts +2 -3
  114. package/src/shared/status-detail-text.test.ts +2 -1
  115. package/src/shared/status-detail-text.ts +5 -1
  116. package/src/shared/tag-transcript.ts +21 -2
  117. package/src/tui/index.tsx +15 -1
  118. package/src/tui-compiled/index.tsx +234 -222
  119. package/dist/index-jfpk81yt.js +0 -146
@@ -11,7 +11,7 @@ import {
11
11
  SESSION_SCOPED_TABLES,
12
12
  deleteSessionScopedRows,
13
13
  updateSessionMeta2
14
- } from "./index-0bycg0np.js";
14
+ } from "./index-fz104x1j.js";
15
15
  import {
16
16
  detectSqliteRuntime,
17
17
  Database,
@@ -32,16 +32,16 @@ import {
32
32
  } from "./index-q264erdp.js";
33
33
  import {
34
34
  detectConfigFile
35
- } from "./index-jfpk81yt.js";
35
+ } from "./index-sd3egckz.js";
36
36
  import {
37
37
  shouldEnforcePrivateStoragePermissions,
38
38
  modelSupportsVision,
39
39
  deriveTriggerBudget2
40
- } from "./index-dn1rwpd8.js";
40
+ } from "./index-mjv9je4e.js";
41
41
  import {
42
42
  piModelRefToCanonical,
43
43
  modelRefLookupOrder
44
- } from "./index-kby1sng5.js";
44
+ } from "./index-avwt563y.js";
45
45
  import {
46
46
  getHarness,
47
47
  getDataDir,
@@ -683,6 +683,17 @@ import { execFileSync } from "node:child_process";
683
683
  import { createHash } from "node:crypto";
684
684
  import { readFileSync } from "node:fs";
685
685
  import { join } from "node:path";
686
+
687
+ // src/shared/pi-executable.ts
688
+ var PI_IMAGE_NAMES = new Set(["pi", "pi.cmd", "omp", "oh-my-pi"]);
689
+ function piHarnessKindFromExecutable(value) {
690
+ const executable = (value ?? "").trim().replace(/^['"]|['"]$/g, "").replaceAll("\\", "/").split("/").at(-1)?.toLowerCase().replace(/\.(?:exe|cmd)$/, "");
691
+ if (!executable || !PI_IMAGE_NAMES.has(executable))
692
+ return;
693
+ return executable === "pi" ? "pi" : "omp";
694
+ }
695
+
696
+ // src/shared/rpc-utils.ts
686
697
  function projectHash(directory) {
687
698
  const normalized = directory.replace(/\/+$/, "");
688
699
  return createHash("sha256").update(normalized).digest("hex").slice(0, 16);
@@ -721,7 +732,6 @@ var PI_HARNESS_ARC_MARKERS = [
721
732
  "cljs/dist",
722
733
  "dist/bundle/cli"
723
734
  ];
724
- var PI_IMAGE_NAMES = new Set(["pi", "pi.cmd", "omp", "oh-my-pi"]);
725
735
  var rpcIdentityReadFileSync = readFileSync;
726
736
  var rpcIdentityExecFileSync = execFileSync;
727
737
  var rpcIdentityProcessKill = process.kill;
@@ -899,7 +909,7 @@ function commandHasOpenCodeExecutable(tokens) {
899
909
  function commandHasPiExecutable(tokens) {
900
910
  for (let index = 0;index < tokens.length; index += 1) {
901
911
  const executable = executableName(tokens[index]).replace(/\.(?:exe|cmd)$/, "");
902
- if (["pi", "omp", "oh-my-pi"].includes(executable))
912
+ if (piHarnessKindFromExecutable(executable) !== undefined)
903
913
  return true;
904
914
  if (["node", "bun", "deno"].includes(executable)) {
905
915
  const script = executableName(tokens[index + 1]).replace(/\.(?:exe|cmd)$/, "");
@@ -9105,7 +9115,7 @@ function buildToolArcs(messages) {
9105
9115
  }
9106
9116
  return arcs.sort((a, b) => a.invOrdinal - b.invOrdinal || (a.resOrdinal ?? Number.MAX_SAFE_INTEGER) - (b.resOrdinal ?? Number.MAX_SAFE_INTEGER));
9107
9117
  }
9108
- function fenceBoundaryForCompletedToolArcs(candidate, arcs, publicationFloorOrdinal) {
9118
+ function fenceBoundaryForCompletedToolArcs(candidate, arcs, publicationFloorOrdinal, observeComponent) {
9109
9119
  const completed = arcs.filter((arc) => arc.resOrdinal !== null).map((arc) => ({ invocation: arc.invOrdinal, result: arc.resOrdinal }));
9110
9120
  const component = completed.filter((arc) => completedToolArcCrossesBoundary(arc.invocation, arc.result, candidate));
9111
9121
  if (component.length === 0)
@@ -9124,6 +9134,7 @@ function fenceBoundaryForCompletedToolArcs(candidate, arcs, publicationFloorOrdi
9124
9134
  }
9125
9135
  const minInvocation = Math.min(...component.map((arc) => arc.invocation));
9126
9136
  const maxResult = Math.max(...component.map((arc) => arc.result));
9137
+ observeComponent?.(component);
9127
9138
  return minInvocation < publicationFloorOrdinal ? maxResult + 1 : minInvocation;
9128
9139
  }
9129
9140
  function fenceBoundaryForToolArcs(candidate, arcs, lastCompartmentEndOrdinal, recentOpenArcCutoff) {
@@ -9580,6 +9591,13 @@ function clearThinkingParts(thinkingParts) {
9580
9591
  part.text = "[cleared]";
9581
9592
  }
9582
9593
  }
9594
+ function messageHasNativeReasoning(message) {
9595
+ return message.parts.some((part) => {
9596
+ if (!isRecord(part))
9597
+ return false;
9598
+ return ["thinking", "reasoning", "redacted_thinking"].includes(String(part.type));
9599
+ });
9600
+ }
9583
9601
  function partHasCompletedResult(part) {
9584
9602
  if (!isRecord(part))
9585
9603
  return false;
@@ -9703,6 +9721,7 @@ function createToolDropTarget(compositeKey, thinkingParts, index, batch, tagId)
9703
9721
  const entry = index.get(compositeKey);
9704
9722
  return !!entry && entry.occurrences.length > 0 && entry.hasResult;
9705
9723
  },
9724
+ requiresToolArcSkeleton: thinkingParts.length > 0 || (index.get(compositeKey)?.occurrences.some((occurrence) => messageHasNativeReasoning(occurrence.message)) ?? false),
9706
9725
  readInput: () => {
9707
9726
  const entry = index.get(compositeKey);
9708
9727
  if (!entry)
@@ -10008,6 +10027,7 @@ function readSessionChunk(sessionId, tokenBudget, offset = 1, eligibleEndOrdinal
10008
10027
  const messages = readRawSessionMessages(sessionId);
10009
10028
  const totalMessageCount = getCachedAbsoluteMessageCount(sessionId) ?? messages.length;
10010
10029
  const startOrdinal = Math.max(1, offset);
10030
+ const completedToolArcs = buildToolArcs(messages).flatMap((arc) => arc.resOrdinal === null ? [] : [{ start: arc.invOrdinal, end: arc.resOrdinal }]);
10011
10031
  const lines = [];
10012
10032
  const lineMeta = [];
10013
10033
  const flushedToolOnlyBlocks = [];
@@ -10033,7 +10053,9 @@ function readSessionChunk(sessionId, tokenBudget, offset = 1, eligibleEndOrdinal
10033
10053
  const blockText = formatBlock(currentBlock);
10034
10054
  const blockTokens = estimateBlockTokens(blockText);
10035
10055
  if (totalTokens + blockTokens > tokenBudget && totalTokens > 0) {
10036
- return false;
10056
+ const splitsCompletedArc = completedToolArcs.some((arc) => arc.start <= lastOrdinal && arc.end > lastOrdinal);
10057
+ if (!splitsCompletedArc)
10058
+ return false;
10037
10059
  }
10038
10060
  if (currentBlock.role === "A" && currentBlock.commitHashes.length > 0 && lastFlushedRole !== "A") {
10039
10061
  commitClusters++;
@@ -10137,7 +10159,9 @@ function readSessionChunk(sessionId, tokenBudget, offset = 1, eligibleEndOrdinal
10137
10159
  toolOnlyRanges.push({ start: range.start, end: range.end });
10138
10160
  }
10139
10161
  }
10140
- const completedToolArcs = buildToolArcs(messages).flatMap((arc) => arc.resOrdinal === null ? [] : [{ start: arc.invOrdinal, end: arc.resOrdinal }]);
10162
+ const text = lines.join(`
10163
+ `);
10164
+ const oversizeAtomicUnit = estimateBlockTokens(text) > tokenBudget && completedToolArcs.some((arc) => arc.start <= lastOrdinal && arc.end >= startOrdinal);
10141
10165
  return {
10142
10166
  startIndex: startOrdinal,
10143
10167
  endIndex: lastOrdinal,
@@ -10145,9 +10169,9 @@ function readSessionChunk(sessionId, tokenBudget, offset = 1, eligibleEndOrdinal
10145
10169
  endMessageId: lastMessageId,
10146
10170
  messageCount: messagesProcessed,
10147
10171
  tokenEstimate: totalTokens,
10172
+ ...oversizeAtomicUnit ? { oversizeAtomicUnit: true } : {},
10148
10173
  hasMore: Math.max(lastOrdinal, highestScannedOrdinal) < (eligibleEndOrdinal !== undefined ? Math.min(eligibleEndOrdinal - 1, totalMessageCount) : totalMessageCount),
10149
- text: lines.join(`
10150
- `),
10174
+ text,
10151
10175
  lines: lineMeta,
10152
10176
  commitClusterCount: commitClusters,
10153
10177
  toolOnlyRanges,
@@ -13703,12 +13727,33 @@ function fileContentAndTokens(part) {
13703
13727
  function contentSignature(parts) {
13704
13728
  return fnv1a32(parts.map((part) => `${part.key}:${part.contentHash}`).join("\x00"));
13705
13729
  }
13730
+ function structuralSize(value) {
13731
+ if (typeof value === "string")
13732
+ return value.length;
13733
+ if (Array.isArray(value)) {
13734
+ let size = value.length;
13735
+ for (let index = 0;index < value.length; index += 1) {
13736
+ size += structuralSize(value[index]);
13737
+ }
13738
+ return size;
13739
+ }
13740
+ if (value !== null && typeof value === "object") {
13741
+ let size = 0;
13742
+ for (const key in value) {
13743
+ if (Object.hasOwn(value, key)) {
13744
+ size += 1 + structuralSize(value[key]);
13745
+ }
13746
+ }
13747
+ return size;
13748
+ }
13749
+ return 0;
13750
+ }
13706
13751
  function tailHygieneStructuralSignature(messages) {
13707
13752
  const partCounts = [];
13708
13753
  let totalBytes = 0;
13709
13754
  for (const message of messages) {
13710
13755
  partCounts.push(message.parts.length);
13711
- totalBytes += byteSize(JSON.stringify(message) ?? "");
13756
+ totalBytes += structuralSize(message);
13712
13757
  }
13713
13758
  return { messageCount: messages.length, partCounts, totalBytes };
13714
13759
  }
@@ -14186,7 +14231,8 @@ function planEmergencyDrop(input) {
14186
14231
  if (reclaimTokens <= EMERGENCY_REARM_MIN_TOKENS) {
14187
14232
  return noop(`reclaim<=min (${reclaimTokens} <= ${EMERGENCY_REARM_MIN_TOKENS})`);
14188
14233
  }
14189
- const protectedCutoff = maxTag - protectedTags;
14234
+ const absoluteEmergency = (input.usagePercentage ?? 0) >= 95;
14235
+ const protectedCutoff = absoluteEmergency ? maxTag : maxTag - protectedTags;
14190
14236
  const tierActive = { 1: [], 2: [] };
14191
14237
  for (const tag of tags) {
14192
14238
  if (tag.status !== "active" || tag.type !== "tool")
@@ -14201,7 +14247,7 @@ function planEmergencyDrop(input) {
14201
14247
  if (nums.length === 0)
14202
14248
  continue;
14203
14249
  nums.sort((a, b) => b - a);
14204
- const reserveCount = Math.ceil(TIER_RECENCY_RESERVE * nums.length);
14250
+ const reserveCount = absoluteEmergency ? 0 : Math.ceil(TIER_RECENCY_RESERVE * nums.length);
14205
14251
  for (let i = 0;i < reserveCount && i < nums.length; i++) {
14206
14252
  reserved.add(nums[i]);
14207
14253
  }
@@ -15202,6 +15248,10 @@ var ABORT_CALL_TIMEOUT_MS = 3000;
15202
15248
  function copyPromptArgs(args, body) {
15203
15249
  return { ...args, body: { ...body } };
15204
15250
  }
15251
+ var promptFailureDetails = new WeakMap;
15252
+ function getPromptFailureDetail(error) {
15253
+ return error !== null && typeof error === "object" ? promptFailureDetails.get(error) ?? null : null;
15254
+ }
15205
15255
  function extractMessage(error) {
15206
15256
  if (typeof error === "string")
15207
15257
  return error;
@@ -15314,6 +15364,39 @@ function shortErr(error) {
15314
15364
  }
15315
15365
  return extractMessage(error);
15316
15366
  }
15367
+ function classifyPromptFailure(error, phase, externalSignal) {
15368
+ const message = extractMessage(error);
15369
+ if (externalSignal?.aborted || message === "prompt aborted by external signal") {
15370
+ return "child_aborted";
15371
+ }
15372
+ if (/^prompt timed out after \d+ms$/.test(message))
15373
+ return "provider_timeout";
15374
+ if (phase === "validation") {
15375
+ if (/returned no (?:assistant )?output|no assistant output/i.test(message)) {
15376
+ return "empty_completion";
15377
+ }
15378
+ if (error instanceof Error && error.name === "DreamerProviderOutputFailureError") {
15379
+ return "provider_error";
15380
+ }
15381
+ return "parse_failed";
15382
+ }
15383
+ return phase === "prompt" || phase === "output" ? "provider_error" : "unknown";
15384
+ }
15385
+ function throwWithPromptFailure(legacyError, failedAttempts, args, timeoutMs) {
15386
+ const error = legacyError instanceof Error ? legacyError : new Error(extractMessage(legacyError));
15387
+ const last = failedAttempts.at(-1);
15388
+ const failureClass = last?.failureClass ?? "unknown";
15389
+ const providerError = failureClass === "provider_error" ? sanitizeDiagnosticText(shortErr(last?.error ?? legacyError)).slice(0, 500) : null;
15390
+ promptFailureDetails.set(error, {
15391
+ failureClass,
15392
+ modelAttempted: last?.attempt.label ?? null,
15393
+ modelsTried: failedAttempts.map((failure) => failure.attempt.label),
15394
+ providerError,
15395
+ timeoutMs: failureClass === "provider_timeout" ? timeoutMs : null,
15396
+ childSessionId: args.path.id || null
15397
+ });
15398
+ throw error;
15399
+ }
15317
15400
  async function attemptOnce(client, args, timeoutMs, signal, callContext, label) {
15318
15401
  const originalBody = { ...args.body };
15319
15402
  const attemptArgs = copyPromptArgs(args, originalBody);
@@ -15392,10 +15475,35 @@ async function promptSyncWithModelSuggestionRetry(client, args, options = {}) {
15392
15475
  throw lastError ?? new Error("All fallback models failed");
15393
15476
  }
15394
15477
  async function attemptAndValidate(client, args, timeoutMs, signal, callContext, attempt, options) {
15395
- await attemptOnce(client, args, timeoutMs, signal, callContext, attempt.label);
15396
- const output = await options.fetchOutput(args, attempt);
15397
- const validated = await options.validateOutput(output, attempt);
15398
- return { output, validated, attempt };
15478
+ try {
15479
+ await attemptOnce(client, args, timeoutMs, signal, callContext, attempt.label);
15480
+ } catch (error) {
15481
+ throw {
15482
+ error,
15483
+ failureClass: classifyPromptFailure(error, "prompt", signal),
15484
+ attempt
15485
+ };
15486
+ }
15487
+ let output;
15488
+ try {
15489
+ output = await options.fetchOutput(args, attempt);
15490
+ } catch (error) {
15491
+ throw {
15492
+ error,
15493
+ failureClass: classifyPromptFailure(error, "output", signal),
15494
+ attempt
15495
+ };
15496
+ }
15497
+ try {
15498
+ const validated = await options.validateOutput(output, attempt);
15499
+ return { output, validated, attempt };
15500
+ } catch (error) {
15501
+ throw {
15502
+ error,
15503
+ failureClass: classifyPromptFailure(error, "validation", signal),
15504
+ attempt
15505
+ };
15506
+ }
15399
15507
  }
15400
15508
  async function promptSyncWithValidatedOutputRetry(client, args, options) {
15401
15509
  const timeoutMs = options.timeoutMs ?? 300000;
@@ -15405,6 +15513,7 @@ async function promptSyncWithValidatedOutputRetry(client, args, options) {
15405
15513
  const baseArgs = copyPromptArgs(args, baseBody);
15406
15514
  const explicitPrimaryLabel = baseBody.model?.providerID && baseBody.model.modelID ? `${baseBody.model.providerID}/${baseBody.model.modelID}` : "primary";
15407
15515
  const totalAttempts = fallbacks.length + 1;
15516
+ const failedAttempts = [];
15408
15517
  let firstError = null;
15409
15518
  let lastError = null;
15410
15519
  try {
@@ -15415,15 +15524,18 @@ async function promptSyncWithValidatedOutputRetry(client, args, options) {
15415
15524
  totalAttempts,
15416
15525
  model: baseBody.model
15417
15526
  }, options);
15418
- } catch (error) {
15419
- firstError = error;
15420
- lastError = error;
15421
- if (isNonRetryable(error, options.signal))
15422
- throw error;
15527
+ } catch (caught) {
15528
+ const failure = caught;
15529
+ failedAttempts.push(failure);
15530
+ firstError = failure.error;
15531
+ lastError = failure.error;
15532
+ if (isNonRetryable(failure.error, options.signal)) {
15533
+ throwWithPromptFailure(failure.error, failedAttempts, args, timeoutMs);
15534
+ }
15423
15535
  if (fallbacks.length === 0) {
15424
- throw error;
15536
+ throwWithPromptFailure(failure.error, failedAttempts, args, timeoutMs);
15425
15537
  }
15426
- log(`[${callContext}] primary (${explicitPrimaryLabel}) failed validation/prompt: ${shortErr(error)}; trying ${fallbacks.length} fallback(s)`);
15538
+ log(`[${callContext}] primary (${explicitPrimaryLabel}) failed validation/prompt: ${shortErr(failure.error)}; trying ${fallbacks.length} fallback(s)`);
15427
15539
  }
15428
15540
  for (let i = 0;i < fallbacks.length; i += 1) {
15429
15541
  const fallback = toModelEntry(fallbacks[i]);
@@ -15450,20 +15562,21 @@ async function promptSyncWithValidatedOutputRetry(client, args, options) {
15450
15562
  const result = await attemptAndValidate(client, attemptArgs, timeoutMs, options.signal, callContext, attempt, options);
15451
15563
  log(`[${callContext}] fallback succeeded with ${label} (attempt ${i + 2}/${fallbacks.length + 1})`);
15452
15564
  return result;
15453
- } catch (error) {
15454
- if (firstError === null)
15455
- firstError = error;
15456
- lastError = error;
15457
- if (isNonRetryable(error, options.signal))
15458
- throw error;
15565
+ } catch (caught) {
15566
+ const failure = caught;
15567
+ failedAttempts.push(failure);
15568
+ lastError = failure.error;
15569
+ if (isNonRetryable(failure.error, options.signal)) {
15570
+ throwWithPromptFailure(failure.error, failedAttempts, args, timeoutMs);
15571
+ }
15459
15572
  const remaining = fallbacks.length - i - 1;
15460
15573
  if (remaining > 0) {
15461
- log(`[${callContext}] ${label} failed validation/prompt: ${shortErr(error)}; ${remaining} fallback(s) left`);
15574
+ log(`[${callContext}] ${label} failed validation/prompt: ${shortErr(failure.error)}; ${remaining} fallback(s) left`);
15462
15575
  }
15463
15576
  }
15464
15577
  }
15465
- log(`[${callContext}] all models exhausted; tried: ${[explicitPrimaryLabel, ...fallbacks.map((fallback) => toModelEntry(fallback)?.model ?? String(fallback))].join(", ")}; original error: ${shortErr(firstError)}; last error: ${shortErr(lastError)}`);
15466
- throw firstError ?? lastError ?? new Error("All fallback models failed validation");
15578
+ log(`[${callContext}] all models exhausted; tried: ${failedAttempts.map((failure) => failure.attempt.label).join(", ")}; original error: ${shortErr(firstError)}; last error: ${shortErr(lastError)}`);
15579
+ throwWithPromptFailure(firstError ?? lastError ?? new Error("All fallback models failed validation"), failedAttempts, args, timeoutMs);
15467
15580
  }
15468
15581
  // src/shared/normalize-sdk-response.ts
15469
15582
  function normalizeSDKResponse(response, fallback, options) {
@@ -34339,7 +34452,31 @@ function clearNoteNudgeTriggerOnly(db, sessionId) {
34339
34452
  db.prepare("UPDATE session_meta SET note_nudge_trigger_pending = 0, note_nudge_trigger_message_id = '' WHERE session_id = ?").run(sessionId);
34340
34453
  }
34341
34454
 
34455
+ // src/hooks/magic-context/producer-window-guard.ts
34456
+ var PRODUCER_WINDOW_REFUSAL_MARGIN = 0.15;
34457
+ function producerWindowFailureReason(input) {
34458
+ const { producerSourceTokens, contextLimitTokens, maxOutputTokens } = input;
34459
+ if (typeof contextLimitTokens !== "number" || !Number.isFinite(contextLimitTokens) || contextLimitTokens <= 0 || !Number.isFinite(producerSourceTokens) || producerSourceTokens <= 0 || !Number.isFinite(maxOutputTokens) || maxOutputTokens < 0) {
34460
+ return null;
34461
+ }
34462
+ const usableInputTokens = Math.max(0, Math.floor(contextLimitTokens - maxOutputTokens));
34463
+ const refusalThreshold = usableInputTokens * (1 + PRODUCER_WINDOW_REFUSAL_MARGIN);
34464
+ if (producerSourceTokens < refusalThreshold)
34465
+ return null;
34466
+ return `producer_source_exceeds_window producer_source_tokens=${Math.round(producerSourceTokens)} usable_input_tokens=${usableInputTokens} context_limit_tokens=${Math.round(contextLimitTokens)} max_output_tokens=${Math.round(maxOutputTokens)} refusal_margin=${PRODUCER_WINDOW_REFUSAL_MARGIN}`;
34467
+ }
34468
+
34342
34469
  // src/hooks/magic-context/protected-tail-boundary.ts
34470
+ function describeBoundaryDiagnostics(snapshot) {
34471
+ return `boundaryDiagnostics=${JSON.stringify(snapshot.diagnostics ?? { unavailable: true, boundaryReason: snapshot.boundaryReason })}`;
34472
+ }
34473
+ function boundaryDiagnostics(args) {
34474
+ return {
34475
+ ...args,
34476
+ capTier: args.usagePercentage >= 95 ? "95" : args.usagePercentage >= 80 ? "80" : "normal",
34477
+ drainBudget: "not-reserved; does-not-size-cap"
34478
+ };
34479
+ }
34343
34480
  var ALPHA = 0.3;
34344
34481
  var FLOOR_RATIO = 0.08;
34345
34482
  var FLOOR_MIN = 2000;
@@ -34480,11 +34617,40 @@ function applyHeadCap(args) {
34480
34617
  capTokens,
34481
34618
  recentOpenArcCutoff
34482
34619
  } = args;
34483
- if (offset >= protectedTailStart)
34620
+ const diagnostics = {
34621
+ offset,
34622
+ capEnd: offset,
34623
+ capTokenSum: 0,
34624
+ completedFence: { from: offset, to: offset, arcs: [], tokenMass: 0 },
34625
+ oversizeAdmission: { from: offset, to: offset },
34626
+ openArcClamp: { from: offset, to: offset },
34627
+ completedRefence: { from: offset, to: offset, arcs: [], tokenMass: 0 },
34628
+ eligibleEnd: offset
34629
+ };
34630
+ if (offset >= protectedTailStart) {
34631
+ args.observeDiagnostics?.(diagnostics);
34484
34632
  return { eligibleEndOrdinal: offset, oversizeAtomicUnit: false };
34633
+ }
34485
34634
  let end = index.findHeadEndForCap(offset, protectedTailStart, capTokens);
34635
+ diagnostics.capEnd = end;
34636
+ diagnostics.capTokenSum = index.rangeTokens(offset, end);
34486
34637
  let oversizeAtomicUnit = end === offset + 1 && index.tokenForOrdinal(offset) > capTokens;
34487
- const completedFence = fenceBoundaryForCompletedToolArcs(end, arcs, lastCompartmentEndOrdinal + 1);
34638
+ let completedFence = fenceBoundaryForCompletedToolArcs(end, arcs, lastCompartmentEndOrdinal + 1, (component) => {
34639
+ diagnostics.completedFence.arcs = component.map((arc) => ({
34640
+ assistant: arc.invocation,
34641
+ result: arc.result
34642
+ }));
34643
+ diagnostics.completedFence.tokenMass = index.rangeTokens(Math.min(...component.map((arc) => arc.invocation)), Math.max(...component.map((arc) => arc.result)) + 1);
34644
+ });
34645
+ diagnostics.completedFence.from = end;
34646
+ diagnostics.completedFence.to = completedFence;
34647
+ diagnostics.oversizeAdmission.from = completedFence;
34648
+ if (completedFence <= offset && end > offset) {
34649
+ const afterFirstArc = fenceBoundaryForCompletedToolArcs(end, arcs, offset + 1);
34650
+ if (afterFirstArc <= protectedTailStart)
34651
+ completedFence = afterFirstArc;
34652
+ }
34653
+ diagnostics.oversizeAdmission.to = completedFence;
34488
34654
  if (completedFence > end) {
34489
34655
  end = Math.min(protectedTailStart, completedFence);
34490
34656
  if (index.rangeTokens(offset, end) > capTokens)
@@ -34492,6 +34658,7 @@ function applyHeadCap(args) {
34492
34658
  } else {
34493
34659
  end = completedFence;
34494
34660
  }
34661
+ diagnostics.openArcClamp.from = end;
34495
34662
  for (const arc of arcs) {
34496
34663
  const resOrdinal = arc.resOrdinal;
34497
34664
  if (resOrdinal === null) {
@@ -34500,6 +34667,18 @@ function applyHeadCap(args) {
34500
34667
  }
34501
34668
  }
34502
34669
  }
34670
+ diagnostics.openArcClamp.to = end;
34671
+ diagnostics.completedRefence.from = end;
34672
+ end = fenceBoundaryForCompletedToolArcs(end, arcs, lastCompartmentEndOrdinal + 1, (component) => {
34673
+ diagnostics.completedRefence.arcs = component.map((arc) => ({
34674
+ assistant: arc.invocation,
34675
+ result: arc.result
34676
+ }));
34677
+ diagnostics.completedRefence.tokenMass = index.rangeTokens(Math.min(...component.map((arc) => arc.invocation)), Math.max(...component.map((arc) => arc.result)) + 1);
34678
+ });
34679
+ diagnostics.completedRefence.to = end;
34680
+ diagnostics.eligibleEnd = end <= offset ? offset : Math.min(end, protectedTailStart);
34681
+ args.observeDiagnostics?.(diagnostics);
34503
34682
  if (end <= offset && offset < protectedTailStart) {
34504
34683
  return { eligibleEndOrdinal: offset, oversizeAtomicUnit };
34505
34684
  }
@@ -34628,6 +34807,11 @@ function resolveProtectedTailBoundary(ctx) {
34628
34807
  runtimeFloor = Math.max(runtimeFloor, ctx.priorBoundaryOrdinal);
34629
34808
  let protectedTailStart = Math.max(boundary, runtimeFloor);
34630
34809
  const forceMaterializationPercentage = escalationBands(ctx.executeThresholdPercentage).forceMaterializationPercentage;
34810
+ const livePromptFloor = {
34811
+ ordinal: null,
34812
+ from: protectedTailStart,
34813
+ to: protectedTailStart
34814
+ };
34631
34815
  if (!ctx.emergencyTailScale && usagePercentage < forceMaterializationPercentage) {
34632
34816
  let lastMeaningfulUserOrdinal = 0;
34633
34817
  for (let i = messages.length - 1;i >= 0; i--) {
@@ -34639,10 +34823,12 @@ function resolveProtectedTailBoundary(ctx) {
34639
34823
  lastMeaningfulUserOrdinal = message.ordinal;
34640
34824
  break;
34641
34825
  }
34826
+ livePromptFloor.ordinal = lastMeaningfulUserOrdinal || null;
34642
34827
  if (lastMeaningfulUserOrdinal >= offset) {
34643
34828
  protectedTailStart = Math.min(protectedTailStart, lastMeaningfulUserOrdinal);
34644
34829
  }
34645
34830
  }
34831
+ livePromptFloor.to = protectedTailStart;
34646
34832
  if (protectedTailStart > offset && index.rangeTokens(offset, protectedTailStart) <= NORMAL_HYSTERESIS_TOKENS) {
34647
34833
  protectedTailStart = offset;
34648
34834
  }
@@ -34653,7 +34839,11 @@ function resolveProtectedTailBoundary(ctx) {
34653
34839
  contextLimit: ctx.contextLimit,
34654
34840
  executeThresholdPercentage: ctx.executeThresholdPercentage
34655
34841
  });
34842
+ let headDiagnostics;
34656
34843
  const head = applyHeadCap({
34844
+ observeDiagnostics: (value) => {
34845
+ headDiagnostics = value;
34846
+ },
34657
34847
  index,
34658
34848
  protectedTailStart,
34659
34849
  offset,
@@ -34690,7 +34880,19 @@ function resolveProtectedTailBoundary(ctx) {
34690
34880
  rawRangeFingerprint,
34691
34881
  trueRawEligibleTokens: index.rangeTokens(offset, protectedTailStart),
34692
34882
  oversizeAtomicUnit: head.oversizeAtomicUnit,
34693
- boundaryReason
34883
+ boundaryReason,
34884
+ diagnostics: boundaryDiagnostics({
34885
+ tailTarget: target,
34886
+ usable: target.usable,
34887
+ usagePercentage,
34888
+ N: scaledN,
34889
+ triggerBudget: ctx.triggerBudget,
34890
+ capTokens: perRunCap,
34891
+ sizeWalkStart: recentOpenArcCutoff,
34892
+ protectedTailStart,
34893
+ livePromptFloor,
34894
+ head: headDiagnostics
34895
+ })
34694
34896
  };
34695
34897
  }
34696
34898
  function resolveBoundaryContext(args) {
@@ -34806,7 +35008,11 @@ function resolveWrapupProtectedTailBoundary(args) {
34806
35008
  contextLimit: ctx.contextLimit,
34807
35009
  executeThresholdPercentage: ctx.executeThresholdPercentage
34808
35010
  });
35011
+ let headDiagnostics;
34809
35012
  const head = applyHeadCap({
35013
+ observeDiagnostics: (value) => {
35014
+ headDiagnostics = value;
35015
+ },
34810
35016
  index,
34811
35017
  protectedTailStart: targetProtectedTailStart,
34812
35018
  offset,
@@ -34844,7 +35050,23 @@ function resolveWrapupProtectedTailBoundary(args) {
34844
35050
  rawRangeFingerprint,
34845
35051
  trueRawEligibleTokens: index.rangeTokens(offset, targetProtectedTailStart),
34846
35052
  oversizeAtomicUnit: head.oversizeAtomicUnit,
34847
- boundaryReason
35053
+ boundaryReason,
35054
+ diagnostics: boundaryDiagnostics({
35055
+ tailTarget: target,
35056
+ usable: target.usable,
35057
+ usagePercentage,
35058
+ N: target.N,
35059
+ triggerBudget: ctx.triggerBudget,
35060
+ capTokens: perRunCap,
35061
+ sizeWalkStart: Math.max(offset, anchorRawMessageCount - keep + 1),
35062
+ protectedTailStart: targetProtectedTailStart,
35063
+ livePromptFloor: {
35064
+ ordinal: null,
35065
+ from: targetProtectedTailStart,
35066
+ to: targetProtectedTailStart
35067
+ },
35068
+ head: headDiagnostics
35069
+ })
34848
35070
  };
34849
35071
  return {
34850
35072
  snapshot,
@@ -36877,7 +37099,7 @@ async function runCompartmentAgent(deps) {
36877
37099
  const protectedTailStart = Math.min(boundarySnapshot.protectedTailStart, boundarySnapshot.rawMessageCountAtTrigger + 1);
36878
37100
  const eligibleEndOrdinal = Math.min(boundarySnapshot.eligibleEndOrdinal, protectedTailStart);
36879
37101
  if (protectedTailStart <= offset || eligibleEndOrdinal <= offset) {
36880
- sessionLog(sessionId, `historian no-op: protectedTailStart=${protectedTailStart} eligibleEnd=${eligibleEndOrdinal} <= offset=${offset} — nothing to compact`);
37102
+ sessionLog(sessionId, `historian no-op: protectedTailStart=${protectedTailStart} eligibleEnd=${eligibleEndOrdinal} <= offset=${offset} — nothing to compact; ${describeBoundaryDiagnostics(boundarySnapshot)}`);
36881
37103
  if (boundarySnapshot.usagePercentage < 80 && !boundarySnapshot.emergencyTailScale) {
36882
37104
  if (!isWrapupInProgress(db, sessionId))
36883
37105
  clearEmergencyRecovery(db, sessionId);
@@ -36928,7 +37150,23 @@ async function runCompartmentAgent(deps) {
36928
37150
  rollbackDrainReservation();
36929
37151
  return;
36930
37152
  }
36931
- const chunkText = truncateHistorianInputIfNeeded(chunk.text, historianChunkTokens);
37153
+ const chunkText = chunk.oversizeAtomicUnit ? chunk.text : truncateHistorianInputIfNeeded(chunk.text, historianChunkTokens);
37154
+ const producerSourceTokens = estimateTokens(chunkText);
37155
+ if (boundarySnapshot.oversizeAtomicUnit || chunk.oversizeAtomicUnit) {
37156
+ sessionLog(sessionId, `historian oversize admission: range=${chunk.startIndex}-${chunk.endIndex} rawComponentTokens=${boundarySnapshot.diagnostics?.head.completedFence.tokenMass ?? "unknown"} perRunCap=${perRunCap} producerSourceTokens=${producerSourceTokens} historianChunkTokens=${historianChunkTokens}; ${describeBoundaryDiagnostics(boundarySnapshot)}`);
37157
+ }
37158
+ const producerWindowFailure = producerWindowFailureReason({
37159
+ producerSourceTokens,
37160
+ contextLimitTokens: deps.historianContextLimit,
37161
+ maxOutputTokens: deps.historianMaxOutputTokens ?? 32000
37162
+ });
37163
+ if (producerWindowFailure) {
37164
+ telemetry.failureReason = producerWindowFailure;
37165
+ retainDrainReservationForRetryThrottle = true;
37166
+ incrementHistorianFailure(db, sessionId, producerWindowFailure);
37167
+ sessionLog(sessionId, `historian oversize admission refused before spawn: ${producerWindowFailure}`);
37168
+ return;
37169
+ }
36932
37170
  if (chunkText !== chunk.text) {
36933
37171
  sessionLog(sessionId, `historian pre-flight: truncated formatted input for ${chunk.startIndex}-${chunk.endIndex} to fit ${historianChunkTokens} tokens`);
36934
37172
  }
@@ -36976,6 +37214,7 @@ ${chunkText}`,
36976
37214
  sequenceOffset,
36977
37215
  dumpLabelBase: `incremental-${sessionId}-${chunk.startIndex}-${chunk.endIndex}`,
36978
37216
  timeoutMs: historianTimeoutMs,
37217
+ model: deps.model,
36979
37218
  fallbackModelId: deps.fallbackModelId,
36980
37219
  fallbackModels: deps.fallbackModels,
36981
37220
  twoPass: deps.historianTwoPass,
@@ -38438,6 +38677,8 @@ function buildRecompDeps(ctx, sessionId) {
38438
38677
  memoryEnabled: ctx.memoryEnabled,
38439
38678
  autoPromote: ctx.autoPromote,
38440
38679
  model: ctx.historianModel,
38680
+ historianContextLimit: ctx.historianContextLimit,
38681
+ historianMaxOutputTokens: ctx.historianMaxOutputTokens,
38441
38682
  fallbackModels: ctx.fallbackModels,
38442
38683
  language: ctx.language,
38443
38684
  fallbackModelId: ctx.fallbackModelId ?? resolveLiveModelKey(ctx.liveSessionState, sessionId),
@@ -38587,4 +38828,4 @@ async function runUpgradeMemoryMigration(ctx, sessionId, migrationDirectory) {
38587
38828
  }
38588
38829
  }
38589
38830
 
38590
- export { withContentLanguageDirective, buildPrimaryLanguageDirective, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, resolveLegacyConfigSources, resolveLegacyConfigSourcesForHarness, migrateMagicContextConfigLocations, string, unknown, array, object, union, tuple, record, DEFAULT_PROTECTED_TAGS, parseCron, nextOccurrence, nextDueAtMs, promptSurfaceConfigIdentity, resolvePromptSurface, resolveModelConfigOrDefault, DEFAULT_EXECUTE_THRESHOLD_PERCENTAGE, DEFAULT_HISTORIAN_TIMEOUT_MS, DEFAULT_LOCAL_EMBEDDING_MODEL, PER_HARNESS_MIGRATION_INVENTORY, PER_HARNESS_MODEL_KEYS, ConfigProfilesSchema, MagicContextConfigSchema, getOpenCodeDbPath, removeMcOwnedCompactionMarkers, isFailClosedBlockingError, shouldBypassFailClosedBlock, resolveAgentNameFromMessages, createFailClosedController, recordHookInitFailure, clearHookInitFailure, getLastHookInitFailure, ProjectIdentityError, resolveProjectIdentityStrict, takeDubiousOwnershipProjectIdentityWarning, resolveProjectIdentity, directoryHasGitMetadata, resolveProjectIdentityForSession, normalizeStoredProjectPath, storedPathBelongsToIdentity, isLinkedGitWorktree, recordSessionProjectIdentity, beginBootQuietPeriod, bootQuietRemainingMs, scheduleAfterBootQuiet, rpcPortDir, rpcPortFilePath, isPidAlive, parseRpcPortFile, observeAuthorityRouting, registerModuleNoteEvaluationBridge, getModuleNoteEvaluationBridge, getContextStoreUuid, ensureContextStoreUuid, getAuthorityManagedMarker, reconcileAuthorityProject, checksumAuthoritySeedRows, prepareAuthority, drainAuthority, getMirrorCursor, applyMirroredNoteCompileFields, applyMirrorPage, pullMemoryMirrorOnce, V2_MEMORY_CATEGORIES, CATEGORY_PRIORITY, resolveWorkspaceShareCategories, resolveWorkspaceIdentitySet, expandWorkspaceIdentitySetWithAliases, resolveStoredPathWorkspaceIdentity, storedPathBelongsToWorkspace, sourceNameForMemory, computeWorkspaceEpochFingerprint, textMentionsRecentCommit, hasMeaningfulUserText, extractTexts, extractToolCallSummaries, preloadTokenizer, estimateTokens, normalizeText, getCurrentToolSetHash, recordToolDefinition, getMeasuredToolDefinitionTokens, getSchemaFenceRejection, getMigrationOnOpenRefusal, LATEST_SUPPORTED_VERSION, getDatabasePath, getPersistedSchemaVersion, setSqlitePragmaConfig, runSqliteOptimize, openDatabase, openDatabaseAsync, isDatabasePersisted, getDatabasePersistenceError, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLeaseBestEffort, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, clearRecompStaging, isRawCompactionSummaryInfo, extractInMemoryMessageViews, buildInMemoryTailRawMessages, isRecord, estimateTrueRawMessageTokens, invalidateTrueRawTokenCache, stripWellFormedLeadingTagPrefix, stripPersistedAssistantText, byteSize, stripTagPrefix, prependTag, isThinkingPart, isTextPart, isToolPartWithOutput, isFilePart, buildFileSourceContent, isEditTool, partHasCompletedResult, extractToolCallObservation, ToolMutationBatch, createToolDropTarget, setRawMessageProvider, cleanUserText, withRawSessionMessageCache, readRawSessionMessages, primeTailRawMessageCache, primeInMemoryTailRawMessageCache, readRawSessionMessageOrdinalPage, getRawSessionStoredMessageCount, readRawSessionMessagePartsById, readRawSessionMessageOrdinalById, readRawSessionMessageById, readSessionChunk, getMessageIndexSourceIdentity, isMessageIndexSourceCurrent, getLastIndexedOrdinal, getIndexedMessageCorpusSize, getMessageIndexReconciliationStartOrdinal, isMessageIndexReconciledThrough, deleteIndexedMessage, clearIndexedMessages, indexSingleMessage, indexMessagesAfterOrdinal, sweepOrphanedOpenCodeMessageIndexes, recordEmbeddingMeasurement, getMaxM0MutationId, queueMemoryMutation, getMemoryMutationsForRenderByProjects, getMaxMemoryMutationIdForProjects, MAX_EXECUTE_THRESHOLD, escalationBands, isEmergencyRecoveryArmed, isProviderOverflowReconfirmed, isProviderOverflowFailClosedProven, getEmergencyRecoveryArmedAt, loadPersistedUsage, loadProtectedTailMeta, resetProtectedTailNoEligibleHead, getWrapupInProgressState, acquireWrapupInProgress, updateWrapupInProgress, releaseWrapupInProgress, resolveCompactionModeRecord, getCompactionModeRecord, setCompactionModeRecord, getPersistedReasoningWatermark, setPersistedReasoningWatermark, clearPersistedReasoningWatermark, getEmergencyInputSample, setEmergencyDropSample, clearEmergencyDropSample, getLastNudgeUndropped, setLastNudgeUndropped, getChannel1NudgeState, setChannel1NudgeState, markChannel1PostReduceGracePending, captureChannel1PostReduceGraceBaseline, getChannel2NudgeState, getChannel2NudgeClaim, setChannel2NudgeState, casChannel2NudgeState, claimChannel2NudgeState, casChannel2NudgeClaim, getPersistedNoteNudge, getNoteNudgeAnchors, getAutoSearchHintDecisions, appendAutoSearchHintDecision, pruneNoteNudgeAnchors, pruneAutoSearchHintDecisions, removeNoteNudgeAnchorByMessageId, removeAutoSearchHintDecisionByMessageId, getPersistedTodoPermissionDenied, setPersistedTodoPermissionDenied, getPersistedTodoSyntheticAnchor, setPersistedTodoSyntheticAnchor, clearPersistedTodoSyntheticAnchor, setNoteLastReadAt, getHistorianFailureState, clearHistorianFailureState, getOverflowState, recordOverflowDetected, recordDetectedContextLimit, clearEmergencyRecovery, clearDetectedContextLimit, getPersistedCompactionMarkerState, setPersistedCompactionMarkerState, getStrippedPlaceholderIds, getHiddenSeamPlaceholderIds, applyStrippedPlaceholderDelta, removeStrippedPlaceholderId, NEWEST_REASONING_BEARING_ASSISTANT, THINKING_BINDING_RECOVERY_FROZEN_PREFIX, thinkingBindingRecoveryFrozenId, getThinkingBindingRecoveryTarget, armThinkingBindingRecovery, clearThinkingBindingRecoveryIf, getMergedReasoningStrippedIds, addMergedReasoningStrippedIds, getTrailingBlankDecisions, addTrailingBlankDecisions, demoteTrailingBlankKeepDecisions, getStaleReduceStrippedIds, addStaleReduceStrippedIds, getProcessedImageStrippedIds, addProcessedImageStrippedIds, getPendingCompactionMarkerState, setPendingCompactionMarkerState, clearPendingCompactionMarkerStateIf, peekDeferredExecutePending, setDeferredExecutePendingIfAbsent, clearDeferredExecutePendingIfMatches, getSessionsWithPendingMarker, setSessionWorkMetrics, getNotes, addNote, getSessionNotes, getPendingSmartNotes, getReadySmartNotes, updateNote, dismissNote, markNoteReady, markNoteChecked, queuePendingOp, getPendingOps, getPendingOpsCount, clearPendingOps, removePendingOp, PRIMER_CANDIDATE_TTL_MS, PRIMER_CANDIDATE_MAX_AGE_MS, primerOccurrenceKey, primerOccurrenceUtcDay, updatePrimerCandidateEmbedding, getPrimerCandidatesByIds, getPrimerCandidatesForPromotion, countPrimerCandidatesForProject, getActivePrimers, createPrimer, updatePrimerSupport, updatePrimerAnswer, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectMemoryEpoch, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, CTX_REDUCE_KEEP, estimateImageTokensFromDataUrl, normalizeTodoStateJson, buildSyntheticTodoPart, computeSyntheticCallId, isSyntheticTodoPart, countRealUserMessages, tailHygieneStructuralSignature, sameTailHygieneStructuralSignature, refreshTailHygieneBaseline, effectiveTailHygiene, assertTailHygieneContentUnchanged, CHANNEL1_SENTINEL, CHANNEL1_FLOOR_TOKENS, toolOutputTokens, decideChannel1, evaluateChannel2, reclaimableToolOutputCount, buildChannel2Reminder, buildChannel1Reminder, estimateEmergencyDropReclaimTokens, planEmergencyDrop, getRecentTagOwnerMessageIds, AGE_RECLAIM_MIN_TOKENS, getOldestActiveUnprotectedToolTags, getActiveToolTagsForAgeReclaim, getTriggerTagTokenUpperBound, getActiveTagTokenTotalsByMessage, tagTokenCountIsNull, backfillTagTokenCounts, insertTag, updateTagStatus, markWhitespaceAssistantTagInert, getInertWhitespaceAssistantTags, updateTagDropMode, updateCavemanDepth, updateTagMessageId, markTagsCompactedByMessageIds, deleteTagsByMessageId, getMaxTagNumberBySession, getTagNumberByMessageId, getAssignableTagNumberByMessageId, deriveTagLoadFloor, getTagsBySession, getActiveTagsBySession, getTailHygieneTags, getDroppedTagsBySession, getTagsByNumbers, getMaxDroppedTagNumber, getTagById, getToolTagNumberByOwner, getNullOwnerToolTag, adoptNullOwnerToolTag, getCandidateToolOwners, pickNearestPriorOwner, createChildSessionWithFence, detectThinkingBindingMismatch, isFable51ThinkingBindingModel, detectOverflow, resolveFallbackChain, modelBodyField, toModelEntry, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, promptSurfaceHashMaterial, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, extractLatestAssistantText, hasLengthCappedOutput, setKeepSubagents, shouldKeepSubagents, recordChildInvocation, COMPARTMENT_AGENT_SYSTEM_PROMPT, HISTORIAN_EDITOR_SYSTEM_PROMPT, COMPARTMENT_STRUCTURAL_SYSTEM_PROMPT, Priority, AdmissionClass, StaleRouteHandleError, SocketClosedError, SocketTimeoutError, SubcClient, isConsumerReconnectTransient, connectionFileExists, getCompartmentEvents, loadCompartmentChunkEmbeddingsForSearch, cosineSimilarity, SYNAPSE_DEFAULT_MODEL, SynapseEmbeddingProvider, computeNormalizedHash, saveCommitEmbedding, loadProjectCommitEmbeddings, loadUnembeddedCommits, countEmbeddedCommits, upsertCommits, getLatestIndexedCommitTimeMs, enforceProjectCap, GIT_SWEEP_LEASE_RENEWAL_MS, acquireGitSweepLease, renewGitSweepLease, markGitSweepSuccessAndRelease, parkGitSweepNonIndexable, releaseGitSweepLease, saveEmbeddingIfHashMatches, getProjectEmbeddings, peekProjectEmbeddings, invalidateProject, invalidateMemory, markProjectLoadUntrusted, contentSha256, sweepStaleEmbeddingIdentitiesForProject, registerProjectEmbedding, registerProjectShadowEmbedding, getShadowEmbeddingMeasurementCohort, getPrimaryEmbeddingMeasurementCohort, embedShadowTextForProject, enqueueShadowEmbeddingItems, registerProjectInObservationMode, getProjectEmbeddingSnapshot, embedTextForProject, embedBatchForProject, embedItemsForProject, embedUnembeddedMemoriesForProject, drainCommitBacklogForProject, embedSessionCompartmentChunks, getEmbeddingCoverageStatus, isEmbeddingEnabled, embedText, ensureMemoryEmbeddings, computeCueContentHash, hasMuralCueColumns, getMuralCueState, memoryNeedsCue, setMuralCue, recordMuralCueRejection, hasMemoryShareableColumn, hasMemoryClassifiedAtColumn, getUnclassifiedMemoryIds, ModuleMemoryAuthorityError, insertMemory, insertMemoryIdempotent, getMemoryByHash, getMemoriesByProject, buildWorkspaceMemorySqlFilter, getMemoriesByProjects, getMaxMemoryIdForProjects, readNewMemoriesForM1Union, getMemoryById, getMemoriesByIds, updateMemorySeenCount, updateMemoryRetrievalCount, setMemoryClassification, supersededMemory, mergeMemoryStats, archiveMemory, getMemoryCountsByStatus, sanitizeFtsQuery, searchMemoriesFTS, searchMemoriesFTSUnion, recordMemoryMapping, recordMemoryVerifications, getUnmappedMemoryIds, clearMemoryVerifications, getMemoryVerifications, resolveGitTopLevel, readGitHead, readGitChangedFilesSince, readGitFileChangeTimesSince, verificationFileExists, normalizeVerificationFiles, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, getMural, BoundedSessionMap, registerLkgPersistence, LKG_SNAPSHOT_ARRAY, LKG_SNAPSHOT_OBJECT, LKG_SNAPSHOT_KEY, LKG_SNAPSHOT_STRING, LKG_SNAPSHOT_NUMBER, LKG_SNAPSHOT_BOOLEAN, LKG_SNAPSHOT_NULL, LKG_SNAPSHOT_UNDEFINED, incrementalLkgContentDigests, lkgContentDigest, captureSlot, getSlot, dropSlot, noteEntry, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, resetNoteNudgeCooldownOnly, clearNoteNudgeTriggerOnly, MARKER_SUMMARY_TEXT, applyDeferredCompactionMarker, removeCompactionMarkerForSession, checkCompactionMarkerConsistency, resolveMuralWire, extractM0Block, formatDate, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, injectM0M1, RECOVERY_NO_HEAD_LIMIT, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, runCompartmentAgent, snapRangeToCompartments, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, setRecompStarting2, setRecompTerminal2, runManagedRecomp2, runManagedUpgrade2 };
38831
+ export { withContentLanguageDirective, buildPrimaryLanguageDirective, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, resolveLegacyConfigSources, resolveLegacyConfigSourcesForHarness, migrateMagicContextConfigLocations, string, unknown, array, object, union, tuple, record, DEFAULT_PROTECTED_TAGS, parseCron, nextOccurrence, nextDueAtMs, promptSurfaceConfigIdentity, resolveModelConfigValue, resolvePromptSurface, resolveModelConfigOrDefault, DEFAULT_EXECUTE_THRESHOLD_PERCENTAGE, DEFAULT_HISTORIAN_TIMEOUT_MS, DEFAULT_LOCAL_EMBEDDING_MODEL, PER_HARNESS_MIGRATION_INVENTORY, PER_HARNESS_MODEL_KEYS, ConfigProfilesSchema, MagicContextConfigSchema, getOpenCodeDbPath, removeMcOwnedCompactionMarkers, isFailClosedBlockingError, shouldBypassFailClosedBlock, resolveAgentNameFromMessages, createFailClosedController, recordHookInitFailure, clearHookInitFailure, getLastHookInitFailure, ProjectIdentityError, resolveProjectIdentityStrict, takeDubiousOwnershipProjectIdentityWarning, resolveProjectIdentity, directoryHasGitMetadata, resolveProjectIdentityForSession, normalizeStoredProjectPath, storedPathBelongsToIdentity, isLinkedGitWorktree, recordSessionProjectIdentity, beginBootQuietPeriod, bootQuietRemainingMs, scheduleAfterBootQuiet, rpcPortDir, rpcPortFilePath, isPidAlive, parseRpcPortFile, observeAuthorityRouting, registerModuleNoteEvaluationBridge, getModuleNoteEvaluationBridge, getContextStoreUuid, ensureContextStoreUuid, getAuthorityManagedMarker, reconcileAuthorityProject, checksumAuthoritySeedRows, prepareAuthority, drainAuthority, getMirrorCursor, applyMirroredNoteCompileFields, applyMirrorPage, pullMemoryMirrorOnce, V2_MEMORY_CATEGORIES, CATEGORY_PRIORITY, resolveWorkspaceShareCategories, resolveWorkspaceIdentitySet, expandWorkspaceIdentitySetWithAliases, resolveStoredPathWorkspaceIdentity, storedPathBelongsToWorkspace, sourceNameForMemory, computeWorkspaceEpochFingerprint, textMentionsRecentCommit, hasMeaningfulUserText, extractTexts, extractToolCallSummaries, preloadTokenizer, estimateTokens, normalizeText, getCurrentToolSetHash, recordToolDefinition, getMeasuredToolDefinitionTokens, getSchemaFenceRejection, getMigrationOnOpenRefusal, LATEST_SUPPORTED_VERSION, getDatabasePath, getPersistedSchemaVersion, setSqlitePragmaConfig, runSqliteOptimize, openDatabase, openDatabaseAsync, isDatabasePersisted, getDatabasePersistenceError, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLeaseBestEffort, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, clearRecompStaging, isRawCompactionSummaryInfo, extractInMemoryMessageViews, buildInMemoryTailRawMessages, isRecord, estimateTrueRawMessageTokens, invalidateTrueRawTokenCache, stripWellFormedLeadingTagPrefix, stripPersistedAssistantText, byteSize, stripTagPrefix, prependTag, isThinkingPart, isTextPart, isToolPartWithOutput, isFilePart, buildFileSourceContent, isEditTool, partHasCompletedResult, extractToolCallObservation, ToolMutationBatch, createToolDropTarget, setRawMessageProvider, cleanUserText, withRawSessionMessageCache, readRawSessionMessages, primeTailRawMessageCache, primeInMemoryTailRawMessageCache, readRawSessionMessageOrdinalPage, getRawSessionStoredMessageCount, readRawSessionMessagePartsById, readRawSessionMessageOrdinalById, readRawSessionMessageById, readSessionChunk, getMessageIndexSourceIdentity, isMessageIndexSourceCurrent, getLastIndexedOrdinal, getIndexedMessageCorpusSize, getMessageIndexReconciliationStartOrdinal, isMessageIndexReconciledThrough, deleteIndexedMessage, clearIndexedMessages, indexSingleMessage, indexMessagesAfterOrdinal, sweepOrphanedOpenCodeMessageIndexes, recordEmbeddingMeasurement, getMaxM0MutationId, queueMemoryMutation, getMemoryMutationsForRenderByProjects, getMaxMemoryMutationIdForProjects, MAX_EXECUTE_THRESHOLD, escalationBands, isEmergencyRecoveryArmed, isProviderOverflowReconfirmed, isProviderOverflowFailClosedProven, getEmergencyRecoveryArmedAt, loadPersistedUsage, loadProtectedTailMeta, resetProtectedTailNoEligibleHead, getWrapupInProgressState, acquireWrapupInProgress, updateWrapupInProgress, releaseWrapupInProgress, resolveCompactionModeRecord, getCompactionModeRecord, setCompactionModeRecord, getPersistedReasoningWatermark, setPersistedReasoningWatermark, clearPersistedReasoningWatermark, getEmergencyInputSample, setEmergencyDropSample, clearEmergencyDropSample, getLastNudgeUndropped, setLastNudgeUndropped, getChannel1NudgeState, setChannel1NudgeState, markChannel1PostReduceGracePending, captureChannel1PostReduceGraceBaseline, getChannel2NudgeState, getChannel2NudgeClaim, setChannel2NudgeState, casChannel2NudgeState, claimChannel2NudgeState, casChannel2NudgeClaim, getPersistedNoteNudge, getNoteNudgeAnchors, getAutoSearchHintDecisions, appendAutoSearchHintDecision, pruneNoteNudgeAnchors, pruneAutoSearchHintDecisions, removeNoteNudgeAnchorByMessageId, removeAutoSearchHintDecisionByMessageId, getPersistedTodoPermissionDenied, setPersistedTodoPermissionDenied, getPersistedTodoSyntheticAnchor, setPersistedTodoSyntheticAnchor, clearPersistedTodoSyntheticAnchor, setNoteLastReadAt, getHistorianFailureState, clearHistorianFailureState, getOverflowState, recordOverflowDetected, recordDetectedContextLimit, clearEmergencyRecovery, clearDetectedContextLimit, getPersistedCompactionMarkerState, setPersistedCompactionMarkerState, getStrippedPlaceholderIds, getHiddenSeamPlaceholderIds, applyStrippedPlaceholderDelta, removeStrippedPlaceholderId, NEWEST_REASONING_BEARING_ASSISTANT, THINKING_BINDING_RECOVERY_FROZEN_PREFIX, thinkingBindingRecoveryFrozenId, getThinkingBindingRecoveryTarget, armThinkingBindingRecovery, clearThinkingBindingRecoveryIf, getMergedReasoningStrippedIds, addMergedReasoningStrippedIds, getTrailingBlankDecisions, addTrailingBlankDecisions, demoteTrailingBlankKeepDecisions, getStaleReduceStrippedIds, addStaleReduceStrippedIds, getProcessedImageStrippedIds, addProcessedImageStrippedIds, getPendingCompactionMarkerState, setPendingCompactionMarkerState, clearPendingCompactionMarkerStateIf, peekDeferredExecutePending, setDeferredExecutePendingIfAbsent, clearDeferredExecutePendingIfMatches, getSessionsWithPendingMarker, setSessionWorkMetrics, getNotes, addNote, getSessionNotes, getPendingSmartNotes, getReadySmartNotes, updateNote, dismissNote, markNoteReady, markNoteChecked, queuePendingOp, getPendingOps, getPendingOpsCount, clearPendingOps, removePendingOp, PRIMER_CANDIDATE_TTL_MS, PRIMER_CANDIDATE_MAX_AGE_MS, primerOccurrenceKey, primerOccurrenceUtcDay, updatePrimerCandidateEmbedding, getPrimerCandidatesByIds, getPrimerCandidatesForPromotion, countPrimerCandidatesForProject, getActivePrimers, createPrimer, updatePrimerSupport, updatePrimerAnswer, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectMemoryEpoch, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, CTX_REDUCE_KEEP, estimateImageTokensFromDataUrl, normalizeTodoStateJson, buildSyntheticTodoPart, computeSyntheticCallId, isSyntheticTodoPart, countRealUserMessages, tailHygieneStructuralSignature, sameTailHygieneStructuralSignature, refreshTailHygieneBaseline, effectiveTailHygiene, assertTailHygieneContentUnchanged, CHANNEL1_SENTINEL, CHANNEL1_FLOOR_TOKENS, toolOutputTokens, decideChannel1, evaluateChannel2, reclaimableToolOutputCount, buildChannel2Reminder, buildChannel1Reminder, estimateEmergencyDropReclaimTokens, planEmergencyDrop, getRecentTagOwnerMessageIds, AGE_RECLAIM_MIN_TOKENS, getOldestActiveUnprotectedToolTags, getActiveToolTagsForAgeReclaim, getTriggerTagTokenUpperBound, getActiveTagTokenTotalsByMessage, tagTokenCountIsNull, backfillTagTokenCounts, insertTag, updateTagStatus, markWhitespaceAssistantTagInert, getInertWhitespaceAssistantTags, updateTagDropMode, updateCavemanDepth, updateTagMessageId, markTagsCompactedByMessageIds, deleteTagsByMessageId, getMaxTagNumberBySession, getTagNumberByMessageId, getAssignableTagNumberByMessageId, deriveTagLoadFloor, getTagsBySession, getActiveTagsBySession, getTailHygieneTags, getDroppedTagsBySession, getTagsByNumbers, getMaxDroppedTagNumber, getTagById, getToolTagNumberByOwner, getNullOwnerToolTag, adoptNullOwnerToolTag, getCandidateToolOwners, pickNearestPriorOwner, createChildSessionWithFence, detectThinkingBindingMismatch, isFable51ThinkingBindingModel, detectOverflow, resolveFallbackChain, modelBodyField, toModelEntry, getPromptFailureDetail, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, promptSurfaceHashMaterial, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, extractLatestAssistantText, hasLengthCappedOutput, setKeepSubagents, shouldKeepSubagents, recordChildInvocation, COMPARTMENT_AGENT_SYSTEM_PROMPT, HISTORIAN_EDITOR_SYSTEM_PROMPT, COMPARTMENT_STRUCTURAL_SYSTEM_PROMPT, Priority, AdmissionClass, StaleRouteHandleError, SocketClosedError, SocketTimeoutError, SubcClient, isConsumerReconnectTransient, connectionFileExists, getCompartmentEvents, loadCompartmentChunkEmbeddingsForSearch, cosineSimilarity, SYNAPSE_DEFAULT_MODEL, SynapseEmbeddingProvider, computeNormalizedHash, saveCommitEmbedding, loadProjectCommitEmbeddings, loadUnembeddedCommits, countEmbeddedCommits, upsertCommits, getLatestIndexedCommitTimeMs, enforceProjectCap, GIT_SWEEP_LEASE_RENEWAL_MS, acquireGitSweepLease, renewGitSweepLease, markGitSweepSuccessAndRelease, parkGitSweepNonIndexable, releaseGitSweepLease, saveEmbeddingIfHashMatches, getProjectEmbeddings, peekProjectEmbeddings, invalidateProject, invalidateMemory, markProjectLoadUntrusted, contentSha256, sweepStaleEmbeddingIdentitiesForProject, registerProjectEmbedding, registerProjectShadowEmbedding, getShadowEmbeddingMeasurementCohort, getPrimaryEmbeddingMeasurementCohort, embedShadowTextForProject, enqueueShadowEmbeddingItems, registerProjectInObservationMode, getProjectEmbeddingSnapshot, embedTextForProject, embedBatchForProject, embedItemsForProject, embedUnembeddedMemoriesForProject, drainCommitBacklogForProject, embedSessionCompartmentChunks, getEmbeddingCoverageStatus, isEmbeddingEnabled, embedText, ensureMemoryEmbeddings, computeCueContentHash, hasMuralCueColumns, getMuralCueState, memoryNeedsCue, setMuralCue, recordMuralCueRejection, hasMemoryShareableColumn, hasMemoryClassifiedAtColumn, getUnclassifiedMemoryIds, ModuleMemoryAuthorityError, insertMemory, insertMemoryIdempotent, getMemoryByHash, getMemoriesByProject, buildWorkspaceMemorySqlFilter, getMemoriesByProjects, getMaxMemoryIdForProjects, readNewMemoriesForM1Union, getMemoryById, getMemoriesByIds, updateMemorySeenCount, updateMemoryRetrievalCount, setMemoryClassification, supersededMemory, mergeMemoryStats, archiveMemory, getMemoryCountsByStatus, sanitizeFtsQuery, searchMemoriesFTS, searchMemoriesFTSUnion, recordMemoryMapping, recordMemoryVerifications, getUnmappedMemoryIds, clearMemoryVerifications, getMemoryVerifications, resolveGitTopLevel, readGitHead, readGitChangedFilesSince, readGitFileChangeTimesSince, verificationFileExists, normalizeVerificationFiles, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, getMural, BoundedSessionMap, registerLkgPersistence, LKG_SNAPSHOT_ARRAY, LKG_SNAPSHOT_OBJECT, LKG_SNAPSHOT_KEY, LKG_SNAPSHOT_STRING, LKG_SNAPSHOT_NUMBER, LKG_SNAPSHOT_BOOLEAN, LKG_SNAPSHOT_NULL, LKG_SNAPSHOT_UNDEFINED, incrementalLkgContentDigests, lkgContentDigest, captureSlot, getSlot, dropSlot, noteEntry, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, resetNoteNudgeCooldownOnly, clearNoteNudgeTriggerOnly, MARKER_SUMMARY_TEXT, applyDeferredCompactionMarker, removeCompactionMarkerForSession, checkCompactionMarkerConsistency, resolveMuralWire, extractM0Block, formatDate, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, injectM0M1, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, runCompartmentAgent, snapRangeToCompartments, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, setRecompStarting2, setRecompTerminal2, runManagedRecomp2, runManagedUpgrade2 };
@@ -6,7 +6,7 @@ import {
6
6
  } from "./index-q264erdp.js";
7
7
  import {
8
8
  readJsoncFile
9
- } from "./index-jfpk81yt.js";
9
+ } from "./index-sd3egckz.js";
10
10
 
11
11
  // src/plugin/conflict-warning-hook.ts
12
12
  import { existsSync, readFileSync } from "node:fs";