@cortexkit/pi-magic-context 0.49.23 → 0.49.24

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 (30) hide show
  1. package/dist/auto-search-worker.js +4 -4
  2. package/dist/chunk-embedding-write-worker.js +4 -4
  3. package/dist/{compartment-chunk-embedding-y01m95c2.js → compartment-chunk-embedding-g9a977b8.js} +3 -3
  4. package/dist/{embedding-backfill-2vh6m3bg.js → embedding-backfill-qxzjy5v2.js} +5 -5
  5. package/dist/{index-w1twp2kp.js → index-00c5a49f.js} +1 -1
  6. package/dist/{index-dbgg6hsf.js → index-3jde7hdr.js} +2 -2
  7. package/dist/{index-579m1751.js → index-8a2wvrda.js} +1 -1
  8. package/dist/{index-at6py2k3.js → index-8hmqdav2.js} +5 -1
  9. package/dist/{index-gqjxy2p7.js → index-byh4rfe7.js} +77 -5
  10. package/dist/{index-st4gwt64.js → index-faz8bw8b.js} +1 -1
  11. package/dist/{index-2bx7ge3x.js → index-fbrxezw0.js} +32 -32
  12. package/dist/{index-wgmhk91m.js → index-hf01gtz7.js} +3 -3
  13. package/dist/{index-pe5gz5c4.js → index-nxq2srg9.js} +1 -1
  14. package/dist/{index-ftvm2acc.js → index-rk8xef10.js} +4 -4
  15. package/dist/{index-vx6f7wff.js → index-wb2t932e.js} +1 -1
  16. package/dist/{index-5j6vwg4z.js → index-ygzh9xdg.js} +32 -22
  17. package/dist/index.js +515 -146
  18. package/dist/{message-fts-rowid-map-59y476bk.js → message-fts-rowid-map-1tb3qjtc.js} +2 -2
  19. package/dist/{message-index-bounded-4ngt600v.js → message-index-bounded-hjat9176.js} +5 -5
  20. package/dist/{message-index-3snxf11x.js → message-index-esykp965.js} +5 -5
  21. package/dist/migration-worker.js +3 -3
  22. package/dist/{project-embedding-registry-hfyzs654.js → project-embedding-registry-9e82qsb6.js} +4 -4
  23. package/dist/raw-ordinal-warmup-worker.js +6 -6
  24. package/dist/{read-session-chunk-5dmc77q2.js → read-session-chunk-tzvv1kph.js} +2 -2
  25. package/dist/{read-session-raw-yxv2fv34.js → read-session-raw-napqv76k.js} +3 -1
  26. package/dist/{search-archive-3daj5ttc.js → search-archive-enx1vd9n.js} +3 -3
  27. package/dist/{search-jhfh3tsj.js → search-n3yqng95.js} +8 -8
  28. package/dist/subagent-entry.js +11 -11
  29. package/dist/tag-snapshot-worker-pi.js +4 -4
  30. package/package.json +4 -3
@@ -24,12 +24,12 @@ var [
24
24
  { Database, registerSqliteDiagnosticSink },
25
25
  { log }
26
26
  ] = await Promise.all([
27
- import("./embedding-backfill-2vh6m3bg.js"),
27
+ import("./embedding-backfill-qxzjy5v2.js"),
28
28
  import("./embedding-cache-7rp4gqzr.js"),
29
29
  import("./storage-memory-0ndn65fm.js"),
30
- import("./project-embedding-registry-hfyzs654.js"),
31
- import("./search-jhfh3tsj.js"),
32
- import("./compartment-chunk-embedding-y01m95c2.js"),
30
+ import("./project-embedding-registry-9e82qsb6.js"),
31
+ import("./search-n3yqng95.js"),
32
+ import("./compartment-chunk-embedding-g9a977b8.js"),
33
33
  import("./embedding-activity-ew6dshfd.js"),
34
34
  import("./harness-9872e0ym.js"),
35
35
  import("./sqlite-v89bj0yy.js"),
@@ -15,14 +15,14 @@ import"./index-my0dn413.js";
15
15
  import"./index-fgs78jyd.js";
16
16
  import"./index-gwxaz0z5.js";
17
17
  import"./index-399p688g.js";
18
- import"./index-at6py2k3.js";
19
- import"./index-579m1751.js";
18
+ import"./index-8hmqdav2.js";
19
+ import"./index-8a2wvrda.js";
20
20
  import {
21
21
  replaceCompartmentChunkEmbeddings2,
22
22
  recordChunkEmbedBackoff2,
23
23
  loadUnembeddedSessionChunkCandidates2,
24
24
  countUnembeddedSessionCompartments2
25
- } from "./index-vx6f7wff.js";
25
+ } from "./index-wb2t932e.js";
26
26
  import {
27
27
  recordSessionProjectIdentity,
28
28
  acquireGitSweepLease,
@@ -34,7 +34,7 @@ import"./index-n4wyxcgr.js";
34
34
  import {
35
35
  LATEST_SUPPORTED_VERSION,
36
36
  enforceSchemaFence
37
- } from "./index-dbgg6hsf.js";
37
+ } from "./index-3jde7hdr.js";
38
38
  import"./index-3c3ztwgc.js";
39
39
  import"./index-w1avzkdt.js";
40
40
  import"./index-135e8hvg.js";
@@ -24,10 +24,10 @@ import {
24
24
  countSessionCompartmentEmbedCoverage2,
25
25
  countSessionCompartmentEmbedCoveragePolite2,
26
26
  countUnembeddedSessionCompartmentsPolite2
27
- } from "./index-vx6f7wff.js";
27
+ } from "./index-wb2t932e.js";
28
28
  import"./index-gwxaz0z5.js";
29
- import"./index-579m1751.js";
30
- import"./index-at6py2k3.js";
29
+ import"./index-8a2wvrda.js";
30
+ import"./index-8hmqdav2.js";
31
31
  import"./index-399p688g.js";
32
32
  import"./index-hqw0rt9k.js";
33
33
  import"./index-my0dn413.js";
@@ -1,17 +1,17 @@
1
1
  import {
2
2
  ensureMemoryEmbeddings2
3
- } from "./index-pe5gz5c4.js";
4
- import"./index-w1twp2kp.js";
3
+ } from "./index-nxq2srg9.js";
4
+ import"./index-00c5a49f.js";
5
5
  import"./index-9p40dgkm.js";
6
6
  import"./index-yhzhdp3m.js";
7
7
  import"./index-j3pz3a1b.js";
8
- import"./index-vx6f7wff.js";
8
+ import"./index-wb2t932e.js";
9
9
  import"./index-wqpjhx1p.js";
10
10
  import"./index-gwxaz0z5.js";
11
11
  import"./index-ccanzg8p.js";
12
12
  import"./index-hxp6q5f8.js";
13
- import"./index-579m1751.js";
14
- import"./index-at6py2k3.js";
13
+ import"./index-8a2wvrda.js";
14
+ import"./index-8hmqdav2.js";
15
15
  import"./index-399p688g.js";
16
16
  import"./index-hqw0rt9k.js";
17
17
  import"./index-my0dn413.js";
@@ -41,7 +41,7 @@ import {
41
41
  countSessionCompartmentEmbedCoverage2,
42
42
  countSessionCompartmentEmbedCoveragePolite2,
43
43
  countUnembeddedSessionCompartmentsPolite2
44
- } from "./index-vx6f7wff.js";
44
+ } from "./index-wb2t932e.js";
45
45
  import {
46
46
  DEFAULT_LOCAL_EMBEDDING_MODEL
47
47
  } from "./index-ccanzg8p.js";
@@ -42,7 +42,7 @@ import {
42
42
  } from "./index-fapenpch.js";
43
43
  import {
44
44
  startMessageFtsRowidMapBackfill2
45
- } from "./index-579m1751.js";
45
+ } from "./index-8a2wvrda.js";
46
46
  import {
47
47
  LKG_SLOT_CHUNKS_DDL,
48
48
  SESSION_REPLAY_DECISIONS_DDL,
@@ -1307,7 +1307,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
1307
1307
  state.running = startMessageFtsRowidMapBackfill2(db, signal).then(async () => {
1308
1308
  if (signal.aborted || !readsOpenCodeStore)
1309
1309
  return;
1310
- const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-5dmc77q2.js"));
1310
+ const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-tzvv1kph.js"));
1311
1311
  const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-e3r8ddh1.js"));
1312
1312
  if (signal.aborted)
1313
1313
  return;
@@ -5,7 +5,7 @@ import {
5
5
  } from "./index-2qtx0q6h.js";
6
6
  import {
7
7
  runSessionWarmupWorker
8
- } from "./index-at6py2k3.js";
8
+ } from "./index-8hmqdav2.js";
9
9
  import {
10
10
  logSlowWriteTransaction
11
11
  } from "./index-hqw0rt9k.js";
@@ -184,6 +184,10 @@ function recordFailure(key, sessionId, failure, detail) {
184
184
  }
185
185
 
186
186
  // ../plugin/src/hooks/magic-context/read-session-raw.ts
187
+ function areRustHistorianSyntheticParts2(parts) {
188
+ const contentParts = parts.filter((part) => part === null || typeof part !== "object" || part.type !== "compaction");
189
+ return contentParts.length > 0 && contentParts.every((part) => part !== null && typeof part === "object" && (part.synthetic === true || part.syntheticTodoMarker === true));
190
+ }
187
191
  function isStrictGapHealingMessage2(message) {
188
192
  if (message.storeType === "synthetic")
189
193
  return true;
@@ -1281,4 +1285,4 @@ function readRawSessionBoundaryEndpointsFromDb2(db, sessionId, ids, blockIds = [
1281
1285
  }
1282
1286
  }
1283
1287
 
1284
- export { runSessionWarmupWorker, prewarmRawSessionOrdinalsForDb, isStrictGapHealingMessage2, readRawSessionMessagesFromDb2, readRawSessionMessagePageFromDb2, RAW_SUMMARY_TEXT_MAX_CHARS2, readRawSessionMessageSummaryPageFromDb2, countRawSessionMessageOrdinalsFromDb2, readRawSessionMessageIdOrdinalsForRangeFromDb2, readRawSessionMessageIdsAtOrdinalsFromDb2, readRawSessionMessageOrdinalPageFromDb2, countStoredRawSessionMessagesFromDb2, readRawSessionTailFromDb2, buildInMemoryTailRawMessages2, readRawSessionMessagePartsByIdFromDb2, forgetRawSessionOrdinalWatermark2, forgetRawSessionSummaryRows2, noteRawSessionSummaryRowWritten2, RawOrdinalsNotReady2, rawOrdinalSummarySeed2, scanRawSessionSummaryRows2, getRawSessionSummaryEpoch2, installRawSessionSummaryScan2, isRawSessionSummaryWarm2, readRawSessionMessageOrdinalByIdFromDb2, readRawSessionMessageByIdFromDb2, hasRawSessionMessageByIdFromDb2, readRawSeedTailFromDb2, readRawSessionBoundaryEndpointsFromDb2 };
1288
+ export { runSessionWarmupWorker, prewarmRawSessionOrdinalsForDb, areRustHistorianSyntheticParts2, isStrictGapHealingMessage2, readRawSessionMessagesFromDb2, readRawSessionMessagePageFromDb2, RAW_SUMMARY_TEXT_MAX_CHARS2, readRawSessionMessageSummaryPageFromDb2, countRawSessionMessageOrdinalsFromDb2, readRawSessionMessageIdOrdinalsForRangeFromDb2, readRawSessionMessageIdsAtOrdinalsFromDb2, readRawSessionMessageOrdinalPageFromDb2, countStoredRawSessionMessagesFromDb2, readRawSessionTailFromDb2, buildInMemoryTailRawMessages2, readRawSessionMessagePartsByIdFromDb2, forgetRawSessionOrdinalWatermark2, forgetRawSessionSummaryRows2, noteRawSessionSummaryRowWritten2, RawOrdinalsNotReady2, rawOrdinalSummarySeed2, scanRawSessionSummaryRows2, getRawSessionSummaryEpoch2, installRawSessionSummaryScan2, isRawSessionSummaryWarm2, readRawSessionMessageOrdinalByIdFromDb2, readRawSessionMessageByIdFromDb2, hasRawSessionMessageByIdFromDb2, readRawSeedTailFromDb2, readRawSessionBoundaryEndpointsFromDb2 };
@@ -72,7 +72,7 @@ import {
72
72
  hasRawSessionMessageByIdFromDb2,
73
73
  readRawSeedTailFromDb2,
74
74
  readRawSessionBoundaryEndpointsFromDb2
75
- } from "./index-at6py2k3.js";
75
+ } from "./index-8hmqdav2.js";
76
76
  import {
77
77
  logSlowWriteTransaction
78
78
  } from "./index-hqw0rt9k.js";
@@ -2941,6 +2941,70 @@ function expandToolPart(part, overrides, legacyPreview = false) {
2941
2941
  return renderToolTemplate(template, input, state?.output ?? state?.error, legacyPreview);
2942
2942
  }
2943
2943
 
2944
+ // ../plugin/src/hooks/magic-context/ask-answer-notice.ts
2945
+ var ANSWER_HEADER_PREFIX = /^Inbox [^\n]* notice from user via user_answer \(user_answer\)/;
2946
+ var ANSWER_TRAILER = /\n([\s\S]*?)\nThis ask is now closed; no dismiss is needed\. Continue accordingly\.$/;
2947
+ var ANSWER_ANSWER_LINE = /^The user answered your parked question (\S+)\.\nQuestion: ([^\n]+)\nAnswer: /;
2948
+ var ANSWER_QUESTION_LINE = /^Question: ([^\n]+)\nAnswer: /;
2949
+ var reminderEnvelopePattern = /<system-reminder>([\s\S]*?)<\/system-reminder>/gi;
2950
+ function reminderBodies(text) {
2951
+ reminderEnvelopePattern.lastIndex = 0;
2952
+ const bodies = [];
2953
+ for (const match of text.matchAll(reminderEnvelopePattern)) {
2954
+ const body = match[1];
2955
+ if (body !== undefined)
2956
+ bodies.push(body);
2957
+ }
2958
+ return bodies;
2959
+ }
2960
+ function parseAnswerBody(body) {
2961
+ const lines = body.replace(/\r\n/g, `
2962
+ `).replace(/^\n+|\n+$/g, "");
2963
+ if (!ANSWER_HEADER_PREFIX.test(lines))
2964
+ return null;
2965
+ if (lines.includes("The user dismissed this question"))
2966
+ return null;
2967
+ const framed = ANSWER_TRAILER.exec(lines);
2968
+ if (framed === null)
2969
+ return null;
2970
+ const content = framed[1] ?? "";
2971
+ const narrated = ANSWER_ANSWER_LINE.exec(content);
2972
+ if (narrated !== null) {
2973
+ const question = narrated[2] ?? "";
2974
+ const answer = content.slice(narrated[0].length);
2975
+ return closedAnswer(question, answer);
2976
+ }
2977
+ const bare = ANSWER_QUESTION_LINE.exec(content);
2978
+ if (bare !== null) {
2979
+ const question = bare[1] ?? "";
2980
+ const answer = content.slice(bare[0].length);
2981
+ return closedAnswer(question, answer);
2982
+ }
2983
+ return null;
2984
+ }
2985
+ function closedAnswer(question, answer) {
2986
+ if (question.trim().length === 0)
2987
+ return null;
2988
+ if (answer.trim().length === 0)
2989
+ return null;
2990
+ return { question, answer };
2991
+ }
2992
+ function extractAskAnswerNotices(text) {
2993
+ const notices = [];
2994
+ for (const body of reminderBodies(text)) {
2995
+ const notice = parseAnswerBody(body);
2996
+ if (notice !== null)
2997
+ notices.push(notice);
2998
+ }
2999
+ return notices;
3000
+ }
3001
+ function formatAskAnswerNotice(notice) {
3002
+ return `U (answered "${notice.question}"): ${notice.answer}`;
3003
+ }
3004
+ function askAnswerLines(text) {
3005
+ return extractAskAnswerNotices(text).map(formatAskAnswerNotice);
3006
+ }
3007
+
2944
3008
  // ../plugin/src/hooks/magic-context/host-served-rows.ts
2945
3009
  var HOST_UNSERVED_ROW = "hostUnservedRow";
2946
3010
  function markHostUnservedRow(target) {
@@ -4238,6 +4302,9 @@ function withRawMessageProvider2(sessionId, provider, fn) {
4238
4302
  function cleanUserText2(text) {
4239
4303
  return stripOutsideSteeringWrappers(text, (segment) => removeSystemReminders(segment).replace(OMO_INTERNAL_INITIATOR_MARKER, "")).trim();
4240
4304
  }
4305
+ function answerLineParts(rawText) {
4306
+ return askAnswerLines(rawText).map(normalizeText).filter((value) => value.length > 0);
4307
+ }
4241
4308
  function hasMeaningfulChunkUserText(parts) {
4242
4309
  for (const part of parts) {
4243
4310
  if (part === null || typeof part !== "object")
@@ -4254,7 +4321,7 @@ function hasMeaningfulChunkUserText(parts) {
4254
4321
  continue;
4255
4322
  return true;
4256
4323
  }
4257
- return false;
4324
+ return parts.some((part) => part !== null && typeof part === "object" && part.type === "text" && typeof part.text === "string" && part.ignored !== true && askAnswerLines(part.text).length > 0);
4258
4325
  }
4259
4326
  function withRawSessionMessageCache2(fn) {
4260
4327
  const outerCache = activeRawMessageCache;
@@ -5008,8 +5075,10 @@ function readSessionChunk2(sessionId, tokenBudget, offset = 1, eligibleEndOrdina
5008
5075
  }
5009
5076
  const role = compactRole(msg.role);
5010
5077
  const textParts = extractTexts2(msg.parts).map((t) => msg.role === "user" ? cleanUserText2(t) : t).map(normalizeText).filter((value) => value.length > 0);
5078
+ const answerParts = msg.role === "user" ? extractTexts2(msg.parts).flatMap((text) => answerLineParts(text)) : [];
5079
+ const userParts = answerParts.length > 0 ? [...textParts, ...answerParts] : textParts;
5011
5080
  const allParts = options.expand === false ? [
5012
- ...textParts,
5081
+ ...userParts,
5013
5082
  ...textParts.length === 0 ? extractToolCallSummaries(msg.parts) : []
5014
5083
  ] : msg.parts.flatMap((part) => {
5015
5084
  if (expandedResults.has(part))
@@ -5018,6 +5087,9 @@ function readSessionChunk2(sessionId, tokenBudget, offset = 1, eligibleEndOrdina
5018
5087
  if (expansion !== null)
5019
5088
  return [`TC: ${expansion}`];
5020
5089
  const texts = extractTexts2([part]).map((t) => msg.role === "user" ? cleanUserText2(t) : t).map(normalizeText).filter(Boolean);
5090
+ if (msg.role === "user") {
5091
+ texts.push(...extractTexts2([part]).flatMap((text) => answerLineParts(text)));
5092
+ }
5021
5093
  return texts.length ? texts : textParts.length === 0 ? extractToolCallSummaries([part]) : [];
5022
5094
  });
5023
5095
  const compacted = compactTextForSummary(allParts.join(" / "), msg.role);
@@ -5026,7 +5098,7 @@ function readSessionChunk2(sessionId, tokenBudget, offset = 1, eligibleEndOrdina
5026
5098
  recordFilteredNoise(meta);
5027
5099
  continue;
5028
5100
  }
5029
- const msgHasNarrative = textParts.length > 0;
5101
+ const msgHasNarrative = userParts.length > 0;
5030
5102
  if (currentBlock && currentBlock.role === role) {
5031
5103
  currentBlock.endOrdinal = msg.ordinal;
5032
5104
  currentBlock.parts.push(text);
@@ -5128,4 +5200,4 @@ function readRawSessionSeedTail2(sessionId, boundaryId, onQuery) {
5128
5200
  });
5129
5201
  }
5130
5202
 
5131
- export { detectThinkingBindingMismatch, detectLatestTurnThinkingMismatch, isPrefixBoundThinkingModel, detectOverflow, MAX_EXECUTE_THRESHOLD, escalationBands, MERGED_REASONING_PARTS_PREFIX, decodeMergedReasoningParts, HYGIENE_PROVIDER_UNITS_VERSION, sessionDecisionCalibration, transitionSessionHygieneUnits, computeProtectionWindow, readEpochFloorSnapshot, getProtectionWindowForSession, SESSION_META_SELECT_COLUMNS, META_COLUMNS, BOOLEAN_META_KEYS, NULL_BIND_META_KEYS, isSessionMetaRow, getDefaultSessionMeta, ensureSessionMetaRow, toSessionMeta, persistCachedM0, clearCachedM0M1, isRustMarkerAdmissionFenced, ReplayDocumentError, readReplayEnvelope, readReplayDocument, updateReplayDocument, writeReplayDocument, isProviderOverflowFailClosedProven, getEmergencyRecoveryArmedAt, describeProtectedTailDrainBudgetSkip, loadProtectedTailMeta, markProtectedTailPolicyV3Seeded, recordProtectedTailPublicationFloor, recordProtectedTailNoEligibleHead, getWrapupInProgressState, isWrapupInProgress, acquireWrapupInProgress, updateWrapupInProgress, releaseWrapupInProgress, resolveCompactionModeRecord, getCompactionModeRecord, setCompactionModeRecord, EMERGENCY_DRAIN_FAILURE_BACKOFF_MS, getProtectedTailDrainBudgetSkip, reserveProtectedTailDrainTokens, clearEmergencyDrainLatch, recordHistorianDrainFailure, clearHistorianDrainFailure, rollbackProtectedTailDrainReservation, clearPersistedReasoningWatermark, getEmergencyInputSample, setEmergencyDropSample, clearEmergencyDropSample, getLastNudgeUndropped, setLastNudgeUndropped, getChannel1NudgeState, setChannel1NudgeState, markChannel1PostReduceGracePending, captureChannel1PostReduceGraceBaseline, getChannel2NudgeState, getChannel2NudgeClaim, setChannel2NudgeState, casChannel2NudgeState, claimChannel2NudgeState, casChannel2NudgeClaim, getPersistedNoteNudge, setPersistedNoteNudgeTrigger, setPersistedNoteNudgeTriggerMessageId, getNoteNudgeAnchors, getAutoSearchHintDecisions, deliverNoteNudgeAtomic, appendAutoSearchHintDecision, pruneNoteNudgeAnchors, queueAutoSearchHintDecisionRetirement, flushAutoSearchHintDecisionRetirement, getPersistedTodoSyntheticAnchor, setPersistedTodoSyntheticAnchor, clearPersistedTodoSyntheticAnchor, getNoteLastReadAt, setNoteLastReadAt, getHistorianFailureState, incrementHistorianFailure, clearHistorianFailureState, getOverflowState, recordOverflowDetected, clearEmergencyRecovery, clearDetectedContextLimit, getPersistedCompactionMarkerState, setPersistedCompactionMarkerState, parseStrippedPlaceholderState, serializeStrippedPlaceholderState, getStrippedPlaceholderIds, applyStrippedPlaceholderDelta, THINKING_BINDING_RECOVERY_FROZEN_PREFIX, THINKING_BINDING_STRIP_ORDER_END_MARKER, thinkingBindingRecoveryFrozenId, COMPACTION_OFF_THINKING_FROZEN_PREFIX, getThinkingBindingRecoveryTarget, armThinkingBindingRecovery, clearThinkingBindingRecoveryIf, getMergedReasoningStrippedIds, addMergedReasoningStrippedIds, getProcessedImageStrippedIds, parseProcessedImageMarkers, serializeProcessedImageMarkers, addProcessedImageStrippedIds, getPendingCompactionMarkerState, getCompactionMarkerHealth, loadPostprocessReplaySnapshot, clearPendingCompactionMarkerStateIf, getPendingPiCompactionMarkerState, setPendingPiCompactionMarkerState, clearPendingPiCompactionMarkerStateIf, logPiCompactionMarkerClear, getSessionsWithPendingPiMarker, setSessionWorkMetrics, getSessionWorkMetrics, resolveEpochFloorForPass, withReadOnlySessionDb, expandToolPart, retreatPastHostUnservedRows, isCoveredInstructionRow, completedToolArcCrossesBoundary, estimateTrueRawMessageTokens, buildToolArcs, fenceBoundaryForCompletedToolArcs, fenceBoundaryForToolArcs, buildTrueRawTokenIndex, computeRawRangeFingerprint, invalidateTrueRawTokenCache, stripSystemInjection, isFilePart, hasUserAnswerMetadata, DreamTokenBudgetExceeded, TOKEN_BUDGET_FINALIZE_MESSAGE, TOKEN_BUDGET_TOOL_REFUSAL, registerBudgetFinalizeChild, releaseBudgetFinalizeChild, createDreamTokenBudget, droppedInputMarker, createDroppedInputGuard, isEditTool, applyEditMarkerToInput, modelAcceptsEmptyContent, isAnthropicFamilyRoute, variantChangeBustsProviderCache, isInActiveAnthropicTurn, activeAnthropicTurnStart, hasAnthropicReasoning, findLatestAssistantReasoningMutationExemptMessage, DEFAULT_KEEP_REASONING_TOKENS, resolveKeepReasoningTokens, reasoningStepCost, reasoningBudgetCutoff, reasoningTextAndOpaque, opaqueThinkingCost, estimatePartImageTokens, SKELETON_REAL_INPUT_MAX_BYTES, toolInputStringBytes, resolveHostServedBoundaryId2, hasRawMessageProvider2, setRawMessageProvider2, setBoundedRawMessageProvider2, withRawMessageProvider2, cleanUserText2, withRawSessionMessageCache2, readRawSessionMessages2, readRawSessionMessagePage2, getRawSessionMessageOrdinalCount2, RAW_MESSAGE_VISIT_PAGE_SIZE2, visitRawSessionMessages2, visitRawSessionMessagesAsync2, readRawSessionMessageRange2, prepareRawSessionOrdinals2, primeTailRawMessageCache2, getCachedAbsoluteMessageCount2, primeInMemoryTailRawMessageCache2, readRawSessionMessageOrdinalPage2, getRawSessionStoredMessageCount2, readRawSessionMessageIdOrdinalsForRange2, readRawSessionMessageIdOrdinals2, readRawSessionMessagePartsById2, readRawSessionBoundaryEndpoints2, hasRawSessionMessageById2, readRawSessionMessageOrdinalById2, compareRawSessionMessageOrder2, readRawSessionMessageById2, getRawSessionMessageCount2, RAW_SESSION_TAG_KEY_PAGE_SIZE2, getRawSessionTagKeysThrough2, getLegacyProtectedTailStartOrdinal2, getProtectedTailStartOrdinal2, readSessionChunk2, getRawSessionMessageIdsThrough2, readRawSessionSeedTail2 };
5203
+ export { detectThinkingBindingMismatch, detectLatestTurnThinkingMismatch, isPrefixBoundThinkingModel, detectOverflow, MAX_EXECUTE_THRESHOLD, escalationBands, MERGED_REASONING_PARTS_PREFIX, decodeMergedReasoningParts, HYGIENE_PROVIDER_UNITS_VERSION, sessionDecisionCalibration, transitionSessionHygieneUnits, computeProtectionWindow, readEpochFloorSnapshot, getProtectionWindowForSession, SESSION_META_SELECT_COLUMNS, META_COLUMNS, BOOLEAN_META_KEYS, NULL_BIND_META_KEYS, isSessionMetaRow, getDefaultSessionMeta, ensureSessionMetaRow, toSessionMeta, persistCachedM0, clearCachedM0M1, isRustMarkerAdmissionFenced, ReplayDocumentError, readReplayEnvelope, readReplayDocument, updateReplayDocument, writeReplayDocument, isProviderOverflowFailClosedProven, getEmergencyRecoveryArmedAt, describeProtectedTailDrainBudgetSkip, loadProtectedTailMeta, markProtectedTailPolicyV3Seeded, recordProtectedTailPublicationFloor, recordProtectedTailNoEligibleHead, getWrapupInProgressState, isWrapupInProgress, acquireWrapupInProgress, updateWrapupInProgress, releaseWrapupInProgress, resolveCompactionModeRecord, getCompactionModeRecord, setCompactionModeRecord, EMERGENCY_DRAIN_FAILURE_BACKOFF_MS, getProtectedTailDrainBudgetSkip, reserveProtectedTailDrainTokens, clearEmergencyDrainLatch, recordHistorianDrainFailure, clearHistorianDrainFailure, rollbackProtectedTailDrainReservation, clearPersistedReasoningWatermark, getEmergencyInputSample, setEmergencyDropSample, clearEmergencyDropSample, getLastNudgeUndropped, setLastNudgeUndropped, getChannel1NudgeState, setChannel1NudgeState, markChannel1PostReduceGracePending, captureChannel1PostReduceGraceBaseline, getChannel2NudgeState, getChannel2NudgeClaim, setChannel2NudgeState, casChannel2NudgeState, claimChannel2NudgeState, casChannel2NudgeClaim, getPersistedNoteNudge, setPersistedNoteNudgeTrigger, setPersistedNoteNudgeTriggerMessageId, getNoteNudgeAnchors, getAutoSearchHintDecisions, deliverNoteNudgeAtomic, appendAutoSearchHintDecision, pruneNoteNudgeAnchors, queueAutoSearchHintDecisionRetirement, flushAutoSearchHintDecisionRetirement, getPersistedTodoSyntheticAnchor, setPersistedTodoSyntheticAnchor, clearPersistedTodoSyntheticAnchor, getNoteLastReadAt, setNoteLastReadAt, getHistorianFailureState, incrementHistorianFailure, clearHistorianFailureState, getOverflowState, recordOverflowDetected, clearEmergencyRecovery, clearDetectedContextLimit, getPersistedCompactionMarkerState, setPersistedCompactionMarkerState, parseStrippedPlaceholderState, serializeStrippedPlaceholderState, getStrippedPlaceholderIds, applyStrippedPlaceholderDelta, THINKING_BINDING_RECOVERY_FROZEN_PREFIX, THINKING_BINDING_STRIP_ORDER_END_MARKER, thinkingBindingRecoveryFrozenId, COMPACTION_OFF_THINKING_FROZEN_PREFIX, getThinkingBindingRecoveryTarget, armThinkingBindingRecovery, clearThinkingBindingRecoveryIf, getMergedReasoningStrippedIds, addMergedReasoningStrippedIds, getProcessedImageStrippedIds, parseProcessedImageMarkers, serializeProcessedImageMarkers, addProcessedImageStrippedIds, getPendingCompactionMarkerState, getCompactionMarkerHealth, loadPostprocessReplaySnapshot, clearPendingCompactionMarkerStateIf, getPendingPiCompactionMarkerState, setPendingPiCompactionMarkerState, clearPendingPiCompactionMarkerStateIf, logPiCompactionMarkerClear, getSessionsWithPendingPiMarker, setSessionWorkMetrics, getSessionWorkMetrics, resolveEpochFloorForPass, withReadOnlySessionDb, expandToolPart, askAnswerLines, retreatPastHostUnservedRows, isCoveredInstructionRow, completedToolArcCrossesBoundary, estimateTrueRawMessageTokens, buildToolArcs, fenceBoundaryForCompletedToolArcs, fenceBoundaryForToolArcs, buildTrueRawTokenIndex, computeRawRangeFingerprint, invalidateTrueRawTokenCache, stripSystemInjection, isFilePart, hasUserAnswerMetadata, DreamTokenBudgetExceeded, TOKEN_BUDGET_FINALIZE_MESSAGE, TOKEN_BUDGET_TOOL_REFUSAL, registerBudgetFinalizeChild, releaseBudgetFinalizeChild, createDreamTokenBudget, droppedInputMarker, createDroppedInputGuard, isEditTool, applyEditMarkerToInput, modelAcceptsEmptyContent, isAnthropicFamilyRoute, variantChangeBustsProviderCache, isInActiveAnthropicTurn, activeAnthropicTurnStart, hasAnthropicReasoning, findLatestAssistantReasoningMutationExemptMessage, DEFAULT_KEEP_REASONING_TOKENS, resolveKeepReasoningTokens, reasoningStepCost, reasoningBudgetCutoff, reasoningTextAndOpaque, opaqueThinkingCost, estimatePartImageTokens, SKELETON_REAL_INPUT_MAX_BYTES, toolInputStringBytes, resolveHostServedBoundaryId2, hasRawMessageProvider2, setRawMessageProvider2, setBoundedRawMessageProvider2, withRawMessageProvider2, cleanUserText2, withRawSessionMessageCache2, readRawSessionMessages2, readRawSessionMessagePage2, getRawSessionMessageOrdinalCount2, RAW_MESSAGE_VISIT_PAGE_SIZE2, visitRawSessionMessages2, visitRawSessionMessagesAsync2, readRawSessionMessageRange2, prepareRawSessionOrdinals2, primeTailRawMessageCache2, getCachedAbsoluteMessageCount2, primeInMemoryTailRawMessageCache2, readRawSessionMessageOrdinalPage2, getRawSessionStoredMessageCount2, readRawSessionMessageIdOrdinalsForRange2, readRawSessionMessageIdOrdinals2, readRawSessionMessagePartsById2, readRawSessionBoundaryEndpoints2, hasRawSessionMessageById2, readRawSessionMessageOrdinalById2, compareRawSessionMessageOrder2, readRawSessionMessageById2, getRawSessionMessageCount2, RAW_SESSION_TAG_KEY_PAGE_SIZE2, getRawSessionTagKeysThrough2, getLegacyProtectedTailStartOrdinal2, getProtectedTailStartOrdinal2, readSessionChunk2, getRawSessionMessageIdsThrough2, readRawSessionSeedTail2 };
@@ -6,7 +6,7 @@ import {
6
6
  } from "./index-my0dn413.js";
7
7
  import {
8
8
  readRawSessionMessageIdOrdinalsForRange2
9
- } from "./index-gqjxy2p7.js";
9
+ } from "./index-byh4rfe7.js";
10
10
 
11
11
  // ../plugin/src/tools/ctx-expand/search-archive.ts
12
12
  var archiveReadsOnThisThread = 0;
@@ -67,7 +67,7 @@ import {
67
67
  visitRawSessionMessages2,
68
68
  readRawSessionMessageById2,
69
69
  readSessionChunk2
70
- } from "./index-gqjxy2p7.js";
70
+ } from "./index-byh4rfe7.js";
71
71
  import {
72
72
  isRecord,
73
73
  providerVisibleMessage,
@@ -109,14 +109,14 @@ import {
109
109
  V2StoreReader,
110
110
  deleteSessionScopedRows,
111
111
  getLastIndexedOrdinal2
112
- } from "./index-wgmhk91m.js";
112
+ } from "./index-hf01gtz7.js";
113
113
  import {
114
114
  resolveOpenCodeDbPath,
115
115
  assertOpenCodeStoreGeneration
116
116
  } from "./index-8976mezv.js";
117
117
  import {
118
118
  noteRawSessionSummaryRowWritten2
119
- } from "./index-at6py2k3.js";
119
+ } from "./index-8hmqdav2.js";
120
120
  import {
121
121
  SubcClient,
122
122
  connectionFileExists,
@@ -136,10 +136,10 @@ import {
136
136
  unregisterProjectEmbedding2,
137
137
  getProjectEmbeddingSnapshot2,
138
138
  embedTextForProject2
139
- } from "./index-w1twp2kp.js";
139
+ } from "./index-00c5a49f.js";
140
140
  import {
141
141
  getErrorMessage
142
- } from "./index-dbgg6hsf.js";
142
+ } from "./index-3jde7hdr.js";
143
143
  import {
144
144
  V2_MEMORY_CATEGORIES,
145
145
  CATEGORY_PRIORITY,
@@ -175,7 +175,7 @@ import {
175
175
  resolveMemoriesByIdsForSearch2,
176
176
  unifiedSearch2,
177
177
  formatSearchResults2
178
- } from "./index-ftvm2acc.js";
178
+ } from "./index-rk8xef10.js";
179
179
  import {
180
180
  computeCueContentHash,
181
181
  getMuralCueState,
@@ -206,7 +206,7 @@ import {
206
206
  } from "./index-6wdwv3a6.js";
207
207
  import {
208
208
  renderSearchArchive2
209
- } from "./index-st4gwt64.js";
209
+ } from "./index-faz8bw8b.js";
210
210
  import {
211
211
  computeNormalizedHash
212
212
  } from "./index-9x1f96r8.js";
@@ -10379,18 +10379,18 @@ var FULL_PARAMETER_DESCRIPTIONS = {
10379
10379
  message: "Message ordinal from a <session-history> heading or a ctx_search hit, not a tag number. Returns that one message in full. Use alone."
10380
10380
  },
10381
10381
  ctx_note: {
10382
- action: "write | read | update | dismiss. Defaults to write when content is given, else read.",
10382
+ action: "write | read | update | dismiss.",
10383
10383
  content: "Note text for write/update: first line is the title (under 80 chars), then the detail.",
10384
10384
  surface_condition: "Makes this a smart note: a condition an outside checker can verify on its own, periodically — repository state, releases, web pages, anything it can look up — never something only this conversation knows. The note is parked until the condition holds.",
10385
10385
  filter: "Read filter: all, active, pending (unsurfaced smart notes), ready, dismissed. Omitted, it shows active session notes plus every current smart note (pending included); active shows only notes whose stored status is active.",
10386
10386
  limit: "Rows per read (default 25).",
10387
10387
  offset: "Skip this many newest rows (default 0).",
10388
- note_ids: "Note ids: one for update, 1–50 for dismiss or read (read returns full bodies). Ignored by write."
10388
+ note_ids: "Note ids: one for update, 1–50 for dismiss, or 1–50 to read those notes in full. Write and a plain read take an empty list."
10389
10389
  },
10390
10390
  ctx_memory: {
10391
10391
  action: "write | update | archive | merge | get",
10392
10392
  content: "The memory text — one standalone fact (write, update, merge).",
10393
- category: "Kind of fact (required for write; on update/merge optional, omitted keeps the current category).",
10393
+ category: "Kind of fact (required for write; on update/merge, pass the memory's current category to keep it).",
10394
10394
  ids: "Memory ids from <project-memory>: one for update, one or more for archive, two or more for merge, 1–20 for get.",
10395
10395
  reason: "Why it is being archived (optional)."
10396
10396
  },
@@ -10414,18 +10414,18 @@ var LIGHT_PARAMETER_DESCRIPTIONS = {
10414
10414
  message: "Message ordinal from a <session-history> heading or a ctx_search hit, not a tag number. Returns that one message in full. Use alone."
10415
10415
  },
10416
10416
  ctx_note: {
10417
- action: "write | read | update | dismiss (default: write with content, else read).",
10417
+ action: "write | read | update | dismiss.",
10418
10418
  content: "Note text: first line title (<80 chars), then detail.",
10419
10419
  surface_condition: "A condition an outside checker can verify on its own, periodically (repository, releases, web — anything it can look up); never something only this conversation knows.",
10420
10420
  filter: "Read filter: all, active, pending, ready, dismissed. Omitted: active notes plus every current smart note (pending included); active: only active-status notes.",
10421
10421
  limit: "Rows per read (default 25).",
10422
10422
  offset: "Skip newest rows (default 0).",
10423
- note_ids: "One id for update, 1–50 for dismiss or read (full bodies). Ignored by write."
10423
+ note_ids: "One id for update, 1–50 for dismiss, or 1–50 to read those notes in full. Write and a plain read take an empty list."
10424
10424
  },
10425
10425
  ctx_memory: {
10426
10426
  action: "write | update | archive | merge | get",
10427
10427
  content: "One standalone fact (write, update, merge).",
10428
- category: "Kind of fact (required for write; optional on update/merge).",
10428
+ category: "Kind of fact (required for write; on update/merge pass the current category to keep it).",
10429
10429
  ids: "Ids from <project-memory>: one for update, 1+ for archive, 2+ for merge, 1–20 for get.",
10430
10430
  reason: "Why it is archived (optional)."
10431
10431
  },
@@ -11324,18 +11324,18 @@ var ALL_ACTIONS = [...PRIMARY_ACTIONS, "list"];
11324
11324
  var DREAMER_ONLY_ACTIONS = new Set(["list"]);
11325
11325
  var GET_MAX_IDS = 20;
11326
11326
  var ParamsShape = {
11327
- action: Optional(Union(PRIMARY_ACTIONS.map((a) => Literal(a)), {
11327
+ action: Union(PRIMARY_ACTIONS.map((a) => Literal(a)), {
11328
11328
  description: "write | update | archive | merge | get"
11329
- })),
11330
- content: Optional(String2({
11329
+ }),
11330
+ content: String2({
11331
11331
  description: "The memory text — one standalone fact (write, update, merge)."
11332
- })),
11333
- category: Optional(Union(V2_MEMORY_CATEGORIES.map((c) => Literal(c)), {
11334
- description: "Kind of fact (required for write; on update/merge optional, omitted keeps the current category)."
11335
- })),
11336
- ids: Optional(_Array_(Number2(), {
11332
+ }),
11333
+ category: Union(V2_MEMORY_CATEGORIES.map((c) => Literal(c)), {
11334
+ description: "Kind of fact (required for write; on update/merge, pass the memory's current category to keep it)."
11335
+ }),
11336
+ ids: _Array_(Number2(), {
11337
11337
  description: "Memory ids from <project-memory>: one for update, one or more for archive, two or more for merge, 1–20 for get."
11338
- })),
11338
+ }),
11339
11339
  reason: Optional(String2({
11340
11340
  description: "Why it is being archived (optional)."
11341
11341
  }))
@@ -12382,25 +12382,24 @@ var FILTER_VALUES = [
12382
12382
  "all"
12383
12383
  ];
12384
12384
  var ParamsSchema2 = _Object_({
12385
- action: Optional(Union([
12385
+ action: Union([
12386
12386
  Literal("write"),
12387
12387
  Literal("read"),
12388
12388
  Literal("dismiss"),
12389
12389
  Literal("update")
12390
12390
  ], {
12391
- description: "write | read | update | dismiss. Defaults to write when content is given, else read."
12392
- })),
12393
- content: Optional(String2({
12391
+ description: "write | read | update | dismiss."
12392
+ }),
12393
+ content: String2({
12394
12394
  description: "Note text for write/update: first line is the title (under 80 chars), then the detail."
12395
- })),
12395
+ }),
12396
12396
  surface_condition: Optional(String2({
12397
12397
  description: "Makes this a smart note: a condition an outside checker can verify on its own, periodically — repository state, releases, web pages, anything it can look up — never something only this conversation knows. The note is parked until the condition holds."
12398
12398
  })),
12399
- note_ids: Optional(_Array_(Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }), {
12400
- minItems: 1,
12399
+ note_ids: _Array_(Integer({ minimum: 1, maximum: Number.MAX_SAFE_INTEGER }), {
12401
12400
  maxItems: 50,
12402
- description: "Note ids: one for update, 1–50 for dismiss or read (read returns full bodies). Ignored by write."
12403
- })),
12401
+ description: "Note ids: one for update, 1–50 for dismiss, or 1–50 to read those notes in full. Write and a plain read take an empty list."
12402
+ }),
12404
12403
  filter: Optional(Union(FILTER_VALUES.map((value) => Literal(value)), {
12405
12404
  description: "Read filter: all, active, pending (unsurfaced smart notes), ready, dismissed. Omitted, it shows active session notes plus every current smart note (pending included); active shows only notes whose stored status is active."
12406
12405
  })),
@@ -12492,7 +12491,8 @@ function createCtxNoteTool(deps) {
12492
12491
  const sessionId = ctx.sessionManager.getSessionId();
12493
12492
  const dreamerEnabled = deps.resolveDreamerEnabled?.(ctx) ?? deps.dreamerEnabled;
12494
12493
  const action = params.action ?? (params.content?.trim() ? "write" : "read");
12495
- const noteIds = action === "dismiss" || action === "update" || action === "read" && params.note_ids !== undefined ? parseNoteIds(action, params.note_ids) : undefined;
12494
+ const targetedReadIds = action === "read" && Array.isArray(params.note_ids) && params.note_ids.length === 0 ? undefined : params.note_ids;
12495
+ const noteIds = action === "dismiss" || action === "update" || action === "read" && targetedReadIds !== undefined ? parseNoteIds(action, targetedReadIds) : undefined;
12496
12496
  if (typeof noteIds === "string")
12497
12497
  return err3(noteIds);
12498
12498
  if (action === "write") {
@@ -31,10 +31,10 @@ import {
31
31
  messageFtsOrdinalRangeIsMapped2,
32
32
  getMessageFtsRowidMapBackfillProgress2,
33
33
  deleteUnmappedMessageFtsRows2
34
- } from "./index-579m1751.js";
34
+ } from "./index-8a2wvrda.js";
35
35
  import {
36
36
  deleteChunkEmbedBackoffForSession2
37
- } from "./index-vx6f7wff.js";
37
+ } from "./index-wb2t932e.js";
38
38
  import {
39
39
  closeQuietly,
40
40
  TAG_TOMBSTONE_OWNER_PREFIX,
@@ -46,7 +46,7 @@ import {
46
46
  } from "./index-w1avzkdt.js";
47
47
  import {
48
48
  cleanUserText2
49
- } from "./index-gqjxy2p7.js";
49
+ } from "./index-byh4rfe7.js";
50
50
  import {
51
51
  sameProjectDirectory
52
52
  } from "./index-wrr9rp9a.js";
@@ -15,7 +15,7 @@ import {
15
15
  OpenAICompatibleEmbeddingProvider,
16
16
  getProjectEmbeddingSnapshot2,
17
17
  embedBatchForProject2
18
- } from "./index-w1twp2kp.js";
18
+ } from "./index-00c5a49f.js";
19
19
  import {
20
20
  isEmbeddingHostBusy2
21
21
  } from "./index-9p40dgkm.js";
@@ -34,7 +34,7 @@ import {
34
34
  loadCompartmentChunkEmbeddingsForSearch2,
35
35
  peekCompartmentChunkSearchPool2,
36
36
  warmCompartmentChunkSearchPool2
37
- } from "./index-vx6f7wff.js";
37
+ } from "./index-wb2t932e.js";
38
38
  import {
39
39
  recordEmbeddingMeasurement,
40
40
  saveCommitEmbedding,
@@ -52,7 +52,7 @@ import {
52
52
  getProjectEmbeddingSnapshot2,
53
53
  embedTextForProject2,
54
54
  embedItemsForProject2
55
- } from "./index-w1twp2kp.js";
55
+ } from "./index-00c5a49f.js";
56
56
  import {
57
57
  saveEmbeddingIfHashMatches,
58
58
  getProjectEmbeddings2
@@ -62,7 +62,7 @@ import {
62
62
  isEmbeddingEnabled,
63
63
  embedText,
64
64
  ensureMemoryEmbeddings2
65
- } from "./index-pe5gz5c4.js";
65
+ } from "./index-nxq2srg9.js";
66
66
  import {
67
67
  getMemorySelectColumns2,
68
68
  isMemoryRow2,
@@ -82,7 +82,7 @@ import {
82
82
  keywordRelevance,
83
83
  matchedSearchSnippet,
84
84
  getIndexedMessageCorpusSize2
85
- } from "./index-wgmhk91m.js";
85
+ } from "./index-hf01gtz7.js";
86
86
  import {
87
87
  MESSAGE_FTS_SESSION_FILTER_SQL,
88
88
  withMessageFtsSessionFilter
@@ -13,7 +13,7 @@ import {
13
13
  } from "./index-gwxaz0z5.js";
14
14
  import {
15
15
  messageFtsOrdinalRangeIsMapped2
16
- } from "./index-579m1751.js";
16
+ } from "./index-8a2wvrda.js";
17
17
 
18
18
  // ../plugin/src/features/magic-context/compartment-chunk-embedding.ts
19
19
  import { createHash } from "node:crypto";