@cortexkit/pi-magic-context 0.49.29 → 0.49.30

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.
@@ -28,7 +28,7 @@ var [
28
28
  import("./embedding-cache-7rp4gqzr.js"),
29
29
  import("./storage-memory-0ndn65fm.js"),
30
30
  import("./project-embedding-registry-wwbhm9rf.js"),
31
- import("./search-pq1nqjp4.js"),
31
+ import("./search-tgv2rdac.js"),
32
32
  import("./compartment-chunk-embedding-pkk5beqp.js"),
33
33
  import("./embedding-activity-ew6dshfd.js"),
34
34
  import("./harness-9872e0ym.js"),
@@ -33,7 +33,7 @@ import"./index-48twbev2.js";
33
33
  import {
34
34
  LATEST_SUPPORTED_VERSION,
35
35
  enforceSchemaFence
36
- } from "./index-9pfffeqj.js";
36
+ } from "./index-y5x5wt5t.js";
37
37
  import"./index-0s14xaca.js";
38
38
  import"./index-g026ztby.js";
39
39
  import"./index-135e8hvg.js";
@@ -82,7 +82,7 @@ import {
82
82
  keywordRelevance,
83
83
  matchedSearchSnippet,
84
84
  getIndexedMessageCorpusSize
85
- } from "./index-vppykq05.js";
85
+ } from "./index-74bc8ts8.js";
86
86
  import {
87
87
  MESSAGE_FTS_SESSION_FILTER_SQL,
88
88
  withMessageFtsSessionFilter
@@ -15,7 +15,7 @@ import {
15
15
  } from "./index-2qtx0q6h.js";
16
16
  import {
17
17
  createFailClosedBlockingError
18
- } from "./index-9pfffeqj.js";
18
+ } from "./index-y5x5wt5t.js";
19
19
  import {
20
20
  createWorkerShutdown
21
21
  } from "./index-54wmg4rj.js";
@@ -6,7 +6,7 @@ import {
6
6
  } from "./index-my0dn413.js";
7
7
  import {
8
8
  readRawSessionMessageIdOrdinalsForRange2
9
- } from "./index-yvb1cz6b.js";
9
+ } from "./index-n2ayqhbx.js";
10
10
 
11
11
  // ../plugin/src/tools/ctx-expand/search-archive.ts
12
12
  var archiveReadsOnThisThread = 0;
@@ -9,7 +9,7 @@ import {
9
9
  } from "./index-my0dn413.js";
10
10
  import {
11
11
  cleanUserText2
12
- } from "./index-yvb1cz6b.js";
12
+ } from "./index-n2ayqhbx.js";
13
13
  import {
14
14
  recordMessageFtsRowid2,
15
15
  recordIndexedMessageTime2,
@@ -66,7 +66,7 @@ import {
66
66
  visitRawSessionMessages2,
67
67
  readRawSessionMessageById2,
68
68
  readSessionChunk2
69
- } from "./index-yvb1cz6b.js";
69
+ } from "./index-n2ayqhbx.js";
70
70
  import {
71
71
  isRecord,
72
72
  providerVisibleMessage,
@@ -106,7 +106,7 @@ import {
106
106
  isPidAlive,
107
107
  readProcessStartTime,
108
108
  getErrorMessage
109
- } from "./index-9pfffeqj.js";
109
+ } from "./index-y5x5wt5t.js";
110
110
  import {
111
111
  BoundedSessionMap,
112
112
  resolveOpenCodeDbPath,
@@ -143,7 +143,7 @@ import {
143
143
  } from "./index-0jykn0dw.js";
144
144
  import {
145
145
  getLastIndexedOrdinal
146
- } from "./index-vppykq05.js";
146
+ } from "./index-74bc8ts8.js";
147
147
  import {
148
148
  V2_MEMORY_CATEGORIES,
149
149
  CATEGORY_PRIORITY,
@@ -180,7 +180,7 @@ import {
180
180
  resolveMemoriesByIdsForSearch2,
181
181
  unifiedSearch2,
182
182
  formatSearchResults2
183
- } from "./index-wcma874r.js";
183
+ } from "./index-0cq3g9y5.js";
184
184
  import {
185
185
  computeCueContentHash,
186
186
  getMuralCueState,
@@ -211,7 +211,7 @@ import {
211
211
  } from "./index-6wdwv3a6.js";
212
212
  import {
213
213
  renderSearchArchive2
214
- } from "./index-fp40yrsy.js";
214
+ } from "./index-5qh6z3sn.js";
215
215
  import {
216
216
  computeNormalizedHash
217
217
  } from "./index-9x1f96r8.js";
@@ -3391,9 +3391,10 @@ function closeConnection(connection) {
3391
3391
  counters.readersClosed += 1;
3392
3392
  }
3393
3393
  }
3394
- function messageTimesQuery(count) {
3394
+ function messageTimesQuery(count, withVersions = false) {
3395
3395
  return `SELECT id, COALESCE(time_created, json_extract(data, '$.time.created')) AS created,
3396
3396
  json_extract(data, '$.time.completed') AS completed
3397
+ ${withVersions ? ", type, seq, time_created AS version_created, time_updated AS version_updated" : ""}
3397
3398
  FROM session_message WHERE +session_id = ? AND id IN (${Array.from({ length: count }, () => "?").join(",")})`;
3398
3399
  }
3399
3400
 
@@ -3618,16 +3619,46 @@ class V2StoreReader {
3618
3619
  return row ? decode(row) : null;
3619
3620
  });
3620
3621
  }
3621
- messageTimes(sessionID, ids) {
3622
- const times = new Map;
3622
+ messageTimeVersions(sessionID, ids, span) {
3623
+ const versions = new Map;
3624
+ if (ids.length > 0 && span && span.last - span.first < ids.length * 2) {
3625
+ const wanted = new Set(ids);
3626
+ const rows = this.prepare(`SELECT id, type, seq, time_created AS created, time_updated AS updated
3627
+ FROM session_message WHERE session_id = ? AND seq >= ? AND seq <= ?`).all(sessionID, span.first, span.last);
3628
+ for (const row of rows)
3629
+ if (wanted.has(row.id))
3630
+ versions.set(row.id, row);
3631
+ for (const [id, version] of this.messageTimeVersions(sessionID, ids.filter((id) => !versions.has(id))))
3632
+ versions.set(id, version);
3633
+ return versions;
3634
+ }
3623
3635
  for (let offset = 0;offset < ids.length; offset += 500) {
3624
3636
  const batch = ids.slice(offset, offset + 500);
3625
- const rows = this.prepare(messageTimesQuery(batch.length)).all(sessionID, ...batch);
3637
+ const rows = this.prepare(`SELECT id, type, seq, time_created AS created, time_updated AS updated
3638
+ FROM session_message WHERE +session_id = ? AND id IN (${batch.map(() => "?").join(",")})`).all(sessionID, ...batch);
3626
3639
  for (const row of rows)
3640
+ versions.set(row.id, row);
3641
+ }
3642
+ return versions;
3643
+ }
3644
+ messageTimes(sessionID, ids, versions) {
3645
+ const times = new Map;
3646
+ for (let offset = 0;offset < ids.length; offset += 500) {
3647
+ const batch = ids.slice(offset, offset + 500);
3648
+ const rows = this.prepare(messageTimesQuery(batch.length, versions !== undefined)).all(sessionID, ...batch);
3649
+ for (const row of rows) {
3627
3650
  times.set(row.id, {
3628
3651
  created: typeof row.created === "number" ? row.created : undefined,
3629
3652
  completed: typeof row.completed === "number" ? row.completed : undefined
3630
3653
  });
3654
+ versions?.set(row.id, {
3655
+ id: row.id,
3656
+ type: row.type,
3657
+ seq: row.seq,
3658
+ created: row.version_created,
3659
+ updated: row.version_updated
3660
+ });
3661
+ }
3631
3662
  }
3632
3663
  return times;
3633
3664
  }
@@ -4016,9 +4016,15 @@ function hasAnthropicReasoning(messages) {
4016
4016
  });
4017
4017
  }
4018
4018
 
4019
+ // ../plugin/src/shared/marker-only-text.ts
4020
+ var MARKER_ONLY_PATTERN = /^(?:(?:§\d+§|\[dropped\s*(?:\d+|§\d*§)?\]|\[cleared\])\s*)+$/;
4021
+ function isMarkerOnlyText(text) {
4022
+ const trimmed = text.trim();
4023
+ return trimmed.length > 0 && MARKER_ONLY_PATTERN.test(trimmed);
4024
+ }
4025
+
4019
4026
  // ../plugin/src/hooks/magic-context/served-shape-repair.ts
4020
4027
  var sources = new WeakMap;
4021
-
4022
4028
  // ../plugin/src/hooks/magic-context/strip-content.ts
4023
4029
  var METADATA_PART_TYPES = new Set([
4024
4030
  "step-start",
@@ -5214,4 +5220,4 @@ function readRawSessionSeedTail2(sessionId, boundaryId, onQuery) {
5214
5220
  });
5215
5221
  }
5216
5222
 
5217
- 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, 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, resolveHistorianChunkStart2, compareRawSessionMessageOrder2, readRawSessionMessageById2, getRawSessionMessageCount2, RAW_SESSION_TAG_KEY_PAGE_SIZE2, getRawSessionTagKeysThrough2, getLegacyProtectedTailStartOrdinal2, getProtectedTailStartOrdinal2, readSessionChunk2, getRawSessionMessageIdsThrough2, readRawSessionSeedTail2 };
5223
+ 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, 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, isMarkerOnlyText, 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, resolveHistorianChunkStart2, compareRawSessionMessageOrder2, readRawSessionMessageById2, getRawSessionMessageCount2, RAW_SESSION_TAG_KEY_PAGE_SIZE2, getRawSessionTagKeysThrough2, getLegacyProtectedTailStartOrdinal2, getProtectedTailStartOrdinal2, readSessionChunk2, getRawSessionMessageIdsThrough2, readRawSessionSeedTail2 };
@@ -2003,7 +2003,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
2003
2003
  state.running = startMessageFtsRowidMapBackfill2(db, signal).then(async () => {
2004
2004
  if (signal.aborted || !readsOpenCodeStore)
2005
2005
  return;
2006
- const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-cfq56m0y.js"));
2006
+ const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-73kd0ans.js"));
2007
2007
  const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-e3r8ddh1.js"));
2008
2008
  if (signal.aborted)
2009
2009
  return;
package/dist/index.js CHANGED
@@ -262,7 +262,7 @@ import {
262
262
  registerTodoStateLifecycle,
263
263
  syncCtxMemoryToolEnabled,
264
264
  registerMagicContextTools
265
- } from "./index-00p6t4nd.js";
265
+ } from "./index-gxjppvsh.js";
266
266
  import"./index-4knyh1kt.js";
267
267
  import {
268
268
  canonicalModelIdentity,
@@ -304,7 +304,7 @@ import {
304
304
  openCurrentDatabase,
305
305
  openDatabaseAsync,
306
306
  closeDatabase
307
- } from "./index-9pfffeqj.js";
307
+ } from "./index-y5x5wt5t.js";
308
308
  import {
309
309
  sameProjectDirectory,
310
310
  pruneMissingProjectIdentities,
@@ -450,6 +450,7 @@ import {
450
450
  isInActiveAnthropicTurn,
451
451
  activeAnthropicTurnStart,
452
452
  hasAnthropicReasoning,
453
+ isMarkerOnlyText,
453
454
  findLatestAssistantReasoningMutationExemptMessage,
454
455
  DEFAULT_KEEP_REASONING_TOKENS,
455
456
  resolveKeepReasoningTokens,
@@ -480,7 +481,7 @@ import {
480
481
  getRawSessionTagKeysThrough2,
481
482
  getLegacyProtectedTailStartOrdinal2,
482
483
  readSessionChunk2
483
- } from "./index-yvb1cz6b.js";
484
+ } from "./index-n2ayqhbx.js";
484
485
  import {
485
486
  UNKNOWN_FIT_RATIO,
486
487
  hasMeasuredDecisionCalibration,
@@ -598,6 +599,7 @@ import {
598
599
  stableStringify,
599
600
  closeQuietly,
600
601
  isKnownAutocommit,
602
+ getTableColumnNames,
601
603
  observeTemporalDecisions,
602
604
  freezeTemporalDecisions,
603
605
  tagIdentityRevisionKey
@@ -680,7 +682,7 @@ import {
680
682
  isMessageIndexReconciledThrough,
681
683
  indexSingleMessage,
682
684
  indexMessagesAfterOrdinal
683
- } from "./index-vppykq05.js";
685
+ } from "./index-74bc8ts8.js";
684
686
  import {
685
687
  rememberV1HiddenRun
686
688
  } from "./index-6x556c2q.js";
@@ -745,7 +747,7 @@ import {
745
747
  normalizeVerificationFiles,
746
748
  indexCommitsForProject,
747
749
  embedUnembeddedCommits
748
- } from "./index-wcma874r.js";
750
+ } from "./index-0cq3g9y5.js";
749
751
  import {
750
752
  setEmbeddingSessionBusy2,
751
753
  isEmbeddingHostBusy2
@@ -809,10 +811,10 @@ import {
809
811
  drainPiTagSnapshotSession,
810
812
  assertPiTagSnapshotReady,
811
813
  ensurePiTagSnapshotReady
812
- } from "./index-f1pcnedq.js";
814
+ } from "./index-2pnhk4gc.js";
813
815
  import"./index-jn44h81p.js";
814
816
  import"./index-1cvyaw9a.js";
815
- import"./index-fp40yrsy.js";
817
+ import"./index-5qh6z3sn.js";
816
818
  import {
817
819
  __toESM
818
820
  } from "./index-22jkk6wg.js";
@@ -3557,7 +3559,7 @@ function startHostStallProfilerSwitch() {
3557
3559
  // package.json
3558
3560
  var package_default = {
3559
3561
  name: "@cortexkit/pi-magic-context",
3560
- version: "0.49.29",
3562
+ version: "0.49.30",
3561
3563
  type: "module",
3562
3564
  description: "Pi and OMP coding agent extension for Magic Context — cross-session memory and context management",
3563
3565
  main: "dist/index.js",
@@ -33380,6 +33382,26 @@ async function executeContextRecompWithResult(deps, options = {}) {
33380
33382
  }
33381
33383
 
33382
33384
  // ../plugin/src/hooks/magic-context/history-boundary-repair.ts
33385
+ function readStoreBoundaries(db, sessionId) {
33386
+ const columns = getTableColumnNames(db, "compartments");
33387
+ const numbers = ["id", "sequence", "start_message", "end_message", "created_at"];
33388
+ const strings = ["session_id", "start_message_id", "end_message_id", "title", "content"];
33389
+ const predicates = [...numbers, ...strings].every((column) => columns.has(column)) ? [
33390
+ ...numbers.map((column) => `typeof(${column}) IN ('integer', 'real')`),
33391
+ ...strings.map((column) => `typeof(${column}) = 'text'`)
33392
+ ] : ["0"];
33393
+ for (const column of ["p1", "p2", "p3", "p4", "episode_type"]) {
33394
+ if (columns.has(column))
33395
+ predicates.push(`typeof(${column}) IN ('text', 'null')`);
33396
+ }
33397
+ for (const column of ["importance", "legacy"]) {
33398
+ if (columns.has(column))
33399
+ predicates.push(`typeof(${column}) IN ('integer', 'real', 'null')`);
33400
+ }
33401
+ return db.prepare(`SELECT sequence, ${columns.has("end_message_id") ? "end_message_id" : "NULL"} AS endMessageId
33402
+ FROM compartments WHERE session_id = ? AND ${predicates.join(" AND ")}
33403
+ ORDER BY sequence ASC`).all(sessionId);
33404
+ }
33383
33405
  function readBaseline(db, sessionId) {
33384
33406
  const row = db.prepare("SELECT cached_m0_bytes IS NOT NULL AS hasM0, cached_m0_last_baseline_end_message_id AS boundary FROM session_meta WHERE session_id = ?").get(sessionId);
33385
33407
  return {
@@ -33446,7 +33468,7 @@ function dropCompartmentsAfter(db, sessionId, anchor, holderId, activeBranch = f
33446
33468
  }
33447
33469
  function repairMissingHistoryBoundary(args) {
33448
33470
  const { db, sessionId, isInHostStore, scope = "store" } = args;
33449
- const compartments = scope === "active-branch" ? db.prepare("SELECT sequence, COALESCE(end_message_id, '') AS endMessageId FROM compartments WHERE session_id = ? ORDER BY sequence").all(sessionId) : getCompartments(db, sessionId);
33471
+ const compartments = scope === "active-branch" ? db.prepare("SELECT sequence, COALESCE(end_message_id, '') AS endMessageId FROM compartments WHERE session_id = ? ORDER BY sequence").all(sessionId) : readStoreBoundaries(db, sessionId);
33450
33472
  let latestIndex = compartments.length - 1;
33451
33473
  while (latestIndex >= 0 && !compartments[latestIndex]?.endMessageId)
33452
33474
  latestIndex -= 1;
@@ -33490,7 +33512,7 @@ function repairMissingHistoryBoundary(args) {
33490
33512
  let dropped;
33491
33513
  let anchorForDrop = anchor;
33492
33514
  try {
33493
- if (scope === "active-branch" && anchor) {
33515
+ if (anchor) {
33494
33516
  const row = db.prepare("SELECT end_message AS endMessage FROM compartments WHERE session_id = ? AND sequence = ?").get(sessionId, anchor.sequence);
33495
33517
  if (!row)
33496
33518
  return { kind: "unresolved", reason: "busy", missingEndMessageId: missing };
@@ -42017,11 +42039,6 @@ function replayPiReminderStrips(args) {
42017
42039
  }
42018
42040
 
42019
42041
  // src/strip-placeholders-pi.ts
42020
- var MARKER_ONLY_PATTERN = /^(?:(?:§\d+§|\[dropped(?: §\d+§)?\]|\[cleared\])\s*)+$/;
42021
- function isPiMarkerOnlyText(text) {
42022
- const trimmed = text.trim();
42023
- return trimmed.length > 0 && MARKER_ONLY_PATTERN.test(trimmed);
42024
- }
42025
42042
  function messageIsPlaceholderOnly(message) {
42026
42043
  if (!message || typeof message !== "object")
42027
42044
  return false;
@@ -42029,7 +42046,7 @@ function messageIsPlaceholderOnly(message) {
42029
42046
  if (msg.role !== "assistant")
42030
42047
  return false;
42031
42048
  if (typeof msg.content === "string")
42032
- return msg.content.trim().length === 0 || isPiMarkerOnlyText(msg.content);
42049
+ return msg.content.trim().length === 0 || isMarkerOnlyText(msg.content);
42033
42050
  if (!Array.isArray(msg.content))
42034
42051
  return false;
42035
42052
  if (msg.content.length === 0)
@@ -42043,7 +42060,7 @@ function messageIsPlaceholderOnly(message) {
42043
42060
  if (typeof text !== "string")
42044
42061
  return false;
42045
42062
  sawVisibleContent = true;
42046
- if (text.trim().length > 0 && !isPiMarkerOnlyText(text))
42063
+ if (text.trim().length > 0 && !isMarkerOnlyText(text))
42047
42064
  return false;
42048
42065
  }
42049
42066
  return sawVisibleContent;
@@ -13,7 +13,7 @@ import"./index-399p688g.js";
13
13
  import"./index-54wmg4rj.js";
14
14
  import"./index-6981g1xv.js";
15
15
  import"./index-23t8ryqw.js";
16
- import"./index-yvb1cz6b.js";
16
+ import"./index-n2ayqhbx.js";
17
17
  import"./index-6x556c2q.js";
18
18
  import {
19
19
  MESSAGE_INDEX_MAX_FTS_BYTES,
@@ -22,7 +22,7 @@ import {
22
22
  markMessageIndexDirty,
23
23
  getIndexableContent,
24
24
  indexSingleMessage
25
- } from "./index-vppykq05.js";
25
+ } from "./index-74bc8ts8.js";
26
26
  import"./index-bvpar0bg.js";
27
27
  import"./index-hqw0rt9k.js";
28
28
 
@@ -18,7 +18,7 @@ import"./index-48twbev2.js";
18
18
  import {
19
19
  setSqlitePragmaConfig,
20
20
  initializeDatabase
21
- } from "./index-9pfffeqj.js";
21
+ } from "./index-y5x5wt5t.js";
22
22
  import"./index-fapenpch.js";
23
23
  import"./index-399p688g.js";
24
24
  import"./index-54wmg4rj.js";
@@ -51,7 +51,7 @@ async function main() {
51
51
  await runMessageFtsRowidMapBackfill(db);
52
52
  reply = { kind: "fts-rowid-backfill" };
53
53
  } else if (input.searchArchive) {
54
- const { renderSearchArchive } = await import("./search-archive-yky3g10b.js");
54
+ const { renderSearchArchive } = await import("./search-archive-ck531w6h.js");
55
55
  const { readRawSessionMessageIdOrdinalsForRangeFromDb } = await import("./read-session-raw-g9b1zdn5.js");
56
56
  const archive = input.searchArchive;
57
57
  let raw;
@@ -81,7 +81,7 @@ async function main() {
81
81
  const { setHarness } = await import("./harness-9872e0ym.js");
82
82
  setHarness(input.harness ?? "opencode");
83
83
  const [{ indexMessageInShortChunks }, { configureContextDatabasePragmas }] = await Promise.all([
84
- import("./message-index-bounded-w10cy1s9.js"),
84
+ import("./message-index-bounded-vkqx693v.js"),
85
85
  import("./sqlite-context-pragmas-gcgch6qz.js")
86
86
  ]);
87
87
  configureContextDatabasePragmas(db);
@@ -36,7 +36,7 @@ import {
36
36
  readSessionChunk2,
37
37
  getRawSessionMessageIdsThrough2,
38
38
  readRawSessionSeedTail2
39
- } from "./index-yvb1cz6b.js";
39
+ } from "./index-n2ayqhbx.js";
40
40
  import"./index-0x1c054v.js";
41
41
  import"./index-6x556c2q.js";
42
42
  import"./index-ccanzg8p.js";
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  renderSearchArchive2
3
- } from "./index-fp40yrsy.js";
3
+ } from "./index-5qh6z3sn.js";
4
4
  import"./index-1cvyaw9a.js";
5
- import"./index-yvb1cz6b.js";
5
+ import"./index-n2ayqhbx.js";
6
6
  import"./index-0x1c054v.js";
7
7
  import"./index-6x556c2q.js";
8
8
  import"./index-ccanzg8p.js";
@@ -5,9 +5,9 @@ import {
5
5
  resolveMemoriesByIdsForSearch2,
6
6
  unifiedSearch2,
7
7
  formatSearchResults2
8
- } from "./index-wcma874r.js";
8
+ } from "./index-0cq3g9y5.js";
9
9
  import"./index-1cvyaw9a.js";
10
- import"./index-vppykq05.js";
10
+ import"./index-74bc8ts8.js";
11
11
  import"./index-4nny4r40.js";
12
12
  import"./index-0jykn0dw.js";
13
13
  import"./index-9p40dgkm.js";
@@ -15,7 +15,7 @@ import"./index-29nw7n1r.js";
15
15
  import"./index-yhzhdp3m.js";
16
16
  import"./index-4zemngt7.js";
17
17
  import"./index-kmk3xpf9.js";
18
- import"./index-yvb1cz6b.js";
18
+ import"./index-n2ayqhbx.js";
19
19
  import"./index-0x1c054v.js";
20
20
  import"./index-6x556c2q.js";
21
21
  import"./index-wqpjhx1p.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TOKEN_BUDGET_TOOL_REFUSAL
3
- } from "./index-yvb1cz6b.js";
3
+ } from "./index-n2ayqhbx.js";
4
4
  import {
5
5
  setHarness2
6
6
  } from "./index-0h2mkab2.js";
@@ -13,7 +13,7 @@ import {
13
13
  import"./index-2qtx0q6h.js";
14
14
  import {
15
15
  openDatabase
16
- } from "./index-9pfffeqj.js";
16
+ } from "./index-y5x5wt5t.js";
17
17
  import"./index-fapenpch.js";
18
18
  import"./index-399p688g.js";
19
19
  import"./index-54wmg4rj.js";
@@ -30,7 +30,7 @@ import {
30
30
  ensureProjectRegisteredFromPiDirectory,
31
31
  resolvePiHarnessKind,
32
32
  registerMagicContextTools
33
- } from "./index-00p6t4nd.js";
33
+ } from "./index-gxjppvsh.js";
34
34
  import"./index-ccanzg8p.js";
35
35
  import"./index-gwxaz0z5.js";
36
36
  import"./index-kmk3xpf9.js";
@@ -40,12 +40,12 @@ import"./index-9p40dgkm.js";
40
40
  import"./index-4zemngt7.js";
41
41
  import"./index-yhzhdp3m.js";
42
42
  import"./index-4nny4r40.js";
43
- import"./index-vppykq05.js";
43
+ import"./index-74bc8ts8.js";
44
44
  import"./index-0x1c054v.js";
45
45
  import"./index-6x556c2q.js";
46
- import"./index-wcma874r.js";
46
+ import"./index-0cq3g9y5.js";
47
47
  import"./index-1cvyaw9a.js";
48
- import"./index-fp40yrsy.js";
48
+ import"./index-5qh6z3sn.js";
49
49
  import"./index-29nw7n1r.js";
50
50
  import"./index-6wdwv3a6.js";
51
51
  import"./index-hqw0rt9k.js";
@@ -7,7 +7,7 @@ import"./index-fgs78jyd.js";
7
7
  import {
8
8
  LATEST_SUPPORTED_VERSION,
9
9
  getPersistedSchemaVersion
10
- } from "./index-9pfffeqj.js";
10
+ } from "./index-y5x5wt5t.js";
11
11
  import"./index-fapenpch.js";
12
12
  import"./index-399p688g.js";
13
13
  import {
@@ -30,7 +30,7 @@ import {
30
30
  encodePiHydrationOperation,
31
31
  PI_FALLBACK_ROW_COLUMNS,
32
32
  PI_FALLBACK_ROW_PREDICATE
33
- } from "./index-f1pcnedq.js";
33
+ } from "./index-2pnhk4gc.js";
34
34
  import"./index-hqw0rt9k.js";
35
35
 
36
36
  // src/tag-snapshot-worker-pi.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/pi-magic-context",
3
- "version": "0.49.29",
3
+ "version": "0.49.30",
4
4
  "type": "module",
5
5
  "description": "Pi and OMP coding agent extension for Magic Context — cross-session memory and context management",
6
6
  "main": "dist/index.js",