@cortexkit/pi-magic-context 0.49.51 → 0.49.52

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.
@@ -31,7 +31,7 @@ serveWorkerJobs(async (initial, port) => {
31
31
  import("./embedding-cache-7rp4gqzr.js"),
32
32
  import("./storage-memory-0ndn65fm.js"),
33
33
  import("./project-embedding-registry-hpca84nz.js"),
34
- import("./search-7w8m1snz.js"),
34
+ import("./search-2vgt4717.js"),
35
35
  import("./compartment-chunk-embedding-wg7emg3z.js"),
36
36
  import("./embedding-activity-ew6dshfd.js"),
37
37
  import("./harness-9872e0ym.js"),
@@ -35,7 +35,7 @@ import"./index-xx1911hb.js";
35
35
  import {
36
36
  LATEST_SUPPORTED_VERSION,
37
37
  enforceSchemaFence
38
- } from "./index-06rdy9h6.js";
38
+ } from "./index-rjz01pvv.js";
39
39
  import"./index-3bb24eb6.js";
40
40
  import"./index-zc6fdyx7.js";
41
41
  import"./index-jxm4bvm4.js";
@@ -9,7 +9,7 @@ import {
9
9
  } from "./index-7y60kyea.js";
10
10
  import {
11
11
  cleanUserText2
12
- } from "./index-4j5442b0.js";
12
+ } from "./index-fec4ezww.js";
13
13
  import {
14
14
  recordMessageFtsRowid2,
15
15
  recordIndexedMessageTime2,
@@ -139,9 +139,9 @@ async function serveV2ArchiveReads2(port, openConnections) {
139
139
  import("./sqlite-v89bj0yy.js"),
140
140
  import("./store-reader-mmfw2h48.js"),
141
141
  import("./store-0hhs1db3.js"),
142
- import("./read-session-chunk-dmpabgvh.js"),
143
- import("./render-71rpjt3g.js"),
144
- import("./search-archive-w12r0c45.js"),
142
+ import("./read-session-chunk-9yr9mava.js"),
143
+ import("./render-3s7kbr61.js"),
144
+ import("./search-archive-dd1z7xn0.js"),
145
145
  import("./expand-attachments-8sxeyj26.js")
146
146
  ]);
147
147
  const pool = new V2StoreReaderPool;
@@ -39,7 +39,7 @@ import {
39
39
  expandToolPart,
40
40
  visitRawSessionMessages2,
41
41
  readRawSessionMessageById2
42
- } from "./index-4j5442b0.js";
42
+ } from "./index-fec4ezww.js";
43
43
  import {
44
44
  isRecord,
45
45
  providerVisibleMessage,
@@ -64,7 +64,7 @@ import {
64
64
  import {
65
65
  isPidAlive,
66
66
  readProcessStartTime
67
- } from "./index-06rdy9h6.js";
67
+ } from "./index-rjz01pvv.js";
68
68
  import {
69
69
  gaDatabasePath2,
70
70
  V2StoreReader2
@@ -56,7 +56,7 @@ import {
56
56
  import {
57
57
  piHarnessKindFromExecutable,
58
58
  getErrorMessage
59
- } from "./index-06rdy9h6.js";
59
+ } from "./index-rjz01pvv.js";
60
60
  import {
61
61
  getOrCreateSessionMeta,
62
62
  updateSessionMeta,
@@ -70,10 +70,10 @@ import {
70
70
  renderMessageByOrdinal2,
71
71
  renderVerboseRange2,
72
72
  renderItemByTag2
73
- } from "./index-jy9fq8gp.js";
73
+ } from "./index-akmmkmhf.js";
74
74
  import {
75
75
  getLastIndexedOrdinal
76
- } from "./index-ywvhr524.js";
76
+ } from "./index-0hewsw7v.js";
77
77
  import {
78
78
  setNoteLastReadAt,
79
79
  getPersistedCompactionMarkerState,
@@ -83,7 +83,7 @@ import {
83
83
  hasRawMessageProvider2,
84
84
  setRawMessageProvider2,
85
85
  readSessionChunk2
86
- } from "./index-4j5442b0.js";
86
+ } from "./index-fec4ezww.js";
87
87
  import {
88
88
  stableStringify
89
89
  } from "./index-jxm4bvm4.js";
@@ -134,7 +134,7 @@ import {
134
134
  resolveMemoriesByIdsForSearch2,
135
135
  unifiedSearch2,
136
136
  formatSearchResults2
137
- } from "./index-babadndp.js";
137
+ } from "./index-mb34ngfr.js";
138
138
  import {
139
139
  TODO_STATUSES,
140
140
  TODO_PRIORITIES,
@@ -184,7 +184,7 @@ import {
184
184
  } from "./index-xssjy4z9.js";
185
185
  import {
186
186
  renderSearchArchive2
187
- } from "./index-ch3rvpjg.js";
187
+ } from "./index-ktez4jwz.js";
188
188
  import {
189
189
  computeNormalizedHash
190
190
  } from "./index-9x1f96r8.js";
@@ -3629,7 +3629,7 @@ function updateUserMemoryContent(db, id, content) {
3629
3629
  db.prepare("UPDATE user_memories SET content = ?, updated_at = ? WHERE id = ?").run(content, Date.now(), id);
3630
3630
  }
3631
3631
  function dismissUserMemory(db, id) {
3632
- db.prepare("UPDATE user_memories SET status = 'dismissed', updated_at = ? WHERE id = ?").run(Date.now(), id);
3632
+ db.prepare("UPDATE user_memories SET status = 'dismissed', updated_at = ? WHERE id = ? AND status = 'active'").run(Date.now(), id);
3633
3633
  }
3634
3634
  function parseCandidateIds(raw) {
3635
3635
  try {
@@ -2242,7 +2242,7 @@ function normalizeDetectedLimitModelKey(modelKey) {
2242
2242
  return typeof modelKey === "string" && modelKey.length > 0 ? piModelRefToCanonical(modelKey) : null;
2243
2243
  }
2244
2244
  function normalizeEmergencyRecoveryOrigin(value) {
2245
- return value === "provider_overflow" || value === "proactive_model_shrink" ? value : null;
2245
+ return value === "provider_overflow" || value === "proactive_model_shrink" || value === "history_boundary_over_window" ? value : null;
2246
2246
  }
2247
2247
  function parseOverflowState(result, modelKey) {
2248
2248
  if (!result) {
@@ -6,7 +6,7 @@ import {
6
6
  } from "./index-7y60kyea.js";
7
7
  import {
8
8
  readRawSessionMessageIdOrdinalsForRange2
9
- } from "./index-4j5442b0.js";
9
+ } from "./index-fec4ezww.js";
10
10
 
11
11
  // ../plugin/src/tools/ctx-expand/search-archive.ts
12
12
  var archiveReadsOnThisThread = 0;
@@ -91,7 +91,7 @@ import {
91
91
  clearIndexedMessages,
92
92
  indexSingleMessage,
93
93
  indexMessagesAfterOrdinal
94
- } from "./index-ywvhr524.js";
94
+ } from "./index-0hewsw7v.js";
95
95
  import {
96
96
  MESSAGE_FTS_SESSION_FILTER_SQL,
97
97
  withMessageFtsSessionFilter
@@ -128,8 +128,13 @@ var USER_FACING_FAILURES = {
128
128
  },
129
129
  history_boundary_unresolved: {
130
130
  code: "MC-H04",
131
- sentence: "This request was not sent: Magic Context could not safely place the history summary boundary in the loaded conversation, and the untrimmed request is larger than the model's context window.",
132
- action: "Reopen this session in its current project directory, then run /ctx-recomp to rebuild the history summary. A model with a larger context window can also help."
131
+ sentence: "This request was not sent: it is larger than the model's context window, and Magic Context could not cut the already-summarized history out of it.",
132
+ action: "Run /ctx-flush to compress the history now, then send your message again."
133
+ },
134
+ history_boundary_recovering: {
135
+ code: "MC-H08",
136
+ sentence: "This request was not sent: it is larger than the model's context window, and Magic Context could not cut the already-summarized history out of it.",
137
+ action: "Send your message again: Magic Context will first summarize more of the history and drop old tool output to make it fit."
133
138
  },
134
139
  history_over_window_unmanaged: {
135
140
  code: "MC-H06",
@@ -1789,7 +1789,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
1789
1789
  state.running = startMessageFtsRowidMapBackfill2(db, signal).then(async () => {
1790
1790
  if (signal.aborted || !readsOpenCodeStore)
1791
1791
  return;
1792
- const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-dmpabgvh.js"));
1792
+ const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-9yr9mava.js"));
1793
1793
  const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-krre2qnb.js"));
1794
1794
  if (signal.aborted)
1795
1795
  return;
package/dist/index.js CHANGED
@@ -153,7 +153,7 @@ import {
153
153
  registerTodoStateLifecycle,
154
154
  syncCtxMemoryToolEnabled,
155
155
  registerMagicContextTools
156
- } from "./index-sm51c9bc.js";
156
+ } from "./index-cc73przv.js";
157
157
  import"./index-4knyh1kt.js";
158
158
  import {
159
159
  canonicalModelIdentity,
@@ -351,12 +351,13 @@ import {
351
351
  getCachedAbsoluteMessageCount2,
352
352
  primeInMemoryTailRawMessageCache2,
353
353
  readRawSessionMessageIdOrdinalsForRange2,
354
+ hasRawSessionMessageById2,
354
355
  compareRawSessionMessageOrder2,
355
356
  getRawSessionMessageCount2,
356
357
  getRawSessionTagKeysThrough2,
357
358
  getLegacyProtectedTailStartOrdinal2,
358
359
  readSessionChunk2
359
- } from "./index-4j5442b0.js";
360
+ } from "./index-fec4ezww.js";
360
361
  import {
361
362
  UNKNOWN_FIT_RATIO,
362
363
  hasMeasuredDecisionCalibration,
@@ -495,7 +496,7 @@ import {
495
496
  openCurrentDatabase,
496
497
  openDatabaseAsync,
497
498
  closeDatabase
498
- } from "./index-06rdy9h6.js";
499
+ } from "./index-rjz01pvv.js";
499
500
  import {
500
501
  LkgRecoveryFenceError,
501
502
  clearLkgFenceProcessState,
@@ -612,7 +613,7 @@ import {
612
613
  getSourceContents,
613
614
  recordSubagentInvocation,
614
615
  getLatestHistorianInvocationId
615
- } from "./index-jy9fq8gp.js";
616
+ } from "./index-akmmkmhf.js";
616
617
  import {
617
618
  resolveOpenCodeDbPath,
618
619
  assertOpenCodeStoreGeneration,
@@ -670,7 +671,7 @@ import {
670
671
  clearCompressionDepthRange,
671
672
  cleanSearchText,
672
673
  matchedSearchSnippet
673
- } from "./index-ywvhr524.js";
674
+ } from "./index-0hewsw7v.js";
674
675
  import {
675
676
  rememberV1HiddenRun
676
677
  } from "./index-6x556c2q.js";
@@ -802,7 +803,7 @@ import {
802
803
  scheduleClearAndReindex,
803
804
  clearSessionTracking,
804
805
  createAutoSearchDiagnostics
805
- } from "./index-babadndp.js";
806
+ } from "./index-mb34ngfr.js";
806
807
  import"./index-xssjy4z9.js";
807
808
  import {
808
809
  DREAMER_PRIMER_INVESTIGATOR_ALLOWED_TOOLS,
@@ -833,8 +834,8 @@ import {
833
834
  } from "./index-pkg07s54.js";
834
835
  import"./index-yjgkjkjs.js";
835
836
  import"./index-1cvyaw9a.js";
836
- import"./index-jexm22qn.js";
837
- import"./index-ch3rvpjg.js";
837
+ import"./index-73c292h9.js";
838
+ import"./index-ktez4jwz.js";
838
839
  import {
839
840
  __toESM
840
841
  } from "./index-22jkk6wg.js";
@@ -3589,7 +3590,7 @@ function startHostStallProfilerSwitch() {
3589
3590
  // package.json
3590
3591
  var package_default = {
3591
3592
  name: "@cortexkit/pi-magic-context",
3592
- version: "0.49.51",
3593
+ version: "0.49.52",
3593
3594
  type: "module",
3594
3595
  description: "Pi and OMP coding agent extension for Magic Context — cross-session memory and context management",
3595
3596
  main: "dist/index.js",
@@ -30020,6 +30021,11 @@ function persistFilteredNoise(db, sessionId, chunk, eligibleEnd) {
30020
30021
  const start = chunk.startIndex;
30021
30022
  if (chunk.text || chunk.messageCount !== 0 || eligibleEnd <= start || rows.length !== eligibleEnd - start || rows.some((row, index) => row.ordinal !== start + index || !row.messageId))
30022
30023
  return false;
30024
+ const endId = rows[rows.length - 1].messageId;
30025
+ if (!hasRawSessionMessageById2(sessionId, endId)) {
30026
+ sessionLog2(sessionId, `historian skipped a filtered-noise marker for ordinals ${start}-${eligibleEnd - 1}: its end row ${endId} is no longer in the host store`);
30027
+ return false;
30028
+ }
30023
30029
  const saved = db.transaction(() => {
30024
30030
  const prior = getCompartments(db, sessionId);
30025
30031
  const last = prior.at(-1);
@@ -15,7 +15,7 @@ import"./index-wfqysrwq.js";
15
15
  import"./index-x2n261wp.js";
16
16
  import"./index-szn2tac8.js";
17
17
  import"./index-n0zjvs3h.js";
18
- import"./index-4j5442b0.js";
18
+ import"./index-fec4ezww.js";
19
19
  import"./index-6x556c2q.js";
20
20
  import"./index-c6wbq66z.js";
21
21
  import {
@@ -25,7 +25,7 @@ import {
25
25
  markMessageIndexDirty,
26
26
  getIndexableContent,
27
27
  indexSingleMessage
28
- } from "./index-ywvhr524.js";
28
+ } from "./index-0hewsw7v.js";
29
29
  import"./index-6d0bby9d.js";
30
30
  import"./index-j0eagxkz.js";
31
31
 
@@ -17,7 +17,7 @@ import"./index-xx1911hb.js";
17
17
  import {
18
18
  setSqlitePragmaConfig,
19
19
  initializeDatabase
20
- } from "./index-06rdy9h6.js";
20
+ } from "./index-rjz01pvv.js";
21
21
  import"./index-fapenpch.js";
22
22
  import"./index-3bb24eb6.js";
23
23
  import"./index-8sqebjzk.js";
@@ -19,7 +19,7 @@ serveWorkerJobs(async (input, port) => {
19
19
  await main();
20
20
  async function main() {
21
21
  if (input.v2ArchiveReader) {
22
- const { serveV2ArchiveReads } = await import("./v2-archive-reader-5n1w78zj.js");
22
+ const { serveV2ArchiveReads } = await import("./v2-archive-reader-6jbyaafn.js");
23
23
  await serveV2ArchiveReads(port, openConnections);
24
24
  return;
25
25
  }
@@ -51,7 +51,7 @@ serveWorkerJobs(async (input, port) => {
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-w12r0c45.js");
54
+ const { renderSearchArchive } = await import("./search-archive-dd1z7xn0.js");
55
55
  const { readRawSessionMessageIdOrdinalsForRangeFromDb } = await import("./read-session-raw-75dcxtdy.js");
56
56
  const archive = input.searchArchive;
57
57
  let raw;
@@ -81,7 +81,7 @@ serveWorkerJobs(async (input, port) => {
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-wg71m86d.js"),
84
+ import("./message-index-bounded-d50b5f2z.js"),
85
85
  import("./sqlite-context-pragmas-gcgch6qz.js")
86
86
  ]);
87
87
  configureContextDatabasePragmas(db);
@@ -38,7 +38,7 @@ import {
38
38
  readSessionChunk2,
39
39
  getRawSessionMessageIdsThrough2,
40
40
  readRawSessionSeedTail2
41
- } from "./index-4j5442b0.js";
41
+ } from "./index-fec4ezww.js";
42
42
  import"./index-qcsjj9m0.js";
43
43
  import"./index-6x556c2q.js";
44
44
  import"./index-aec63gtj.js";
@@ -3,18 +3,18 @@ import {
3
3
  renderVerboseRange2,
4
4
  renderVerboseRangeForTool2,
5
5
  renderItemByTag2
6
- } from "./index-jy9fq8gp.js";
6
+ } from "./index-akmmkmhf.js";
7
7
  import"./index-46wk0td0.js";
8
- import"./index-ywvhr524.js";
8
+ import"./index-0hewsw7v.js";
9
9
  import"./index-hgd00nas.js";
10
10
  import"./index-nvh6d3bz.js";
11
11
  import"./index-ndg15t3x.js";
12
- import"./index-4j5442b0.js";
12
+ import"./index-fec4ezww.js";
13
13
  import"./index-qcsjj9m0.js";
14
14
  import"./index-6x556c2q.js";
15
15
  import"./index-qm139qq2.js";
16
16
  import"./index-aec63gtj.js";
17
- import"./index-06rdy9h6.js";
17
+ import"./index-rjz01pvv.js";
18
18
  import"./index-fapenpch.js";
19
19
  import"./index-zc6fdyx7.js";
20
20
  import"./index-135e8hvg.js";
@@ -5,9 +5,9 @@ import {
5
5
  resolveMemoriesByIdsForSearch2,
6
6
  unifiedSearch2,
7
7
  formatSearchResults2
8
- } from "./index-babadndp.js";
8
+ } from "./index-mb34ngfr.js";
9
9
  import"./index-46wk0td0.js";
10
- import"./index-ywvhr524.js";
10
+ import"./index-0hewsw7v.js";
11
11
  import"./index-1cvyaw9a.js";
12
12
  import"./index-ty2m0s0s.js";
13
13
  import"./index-29nw7n1r.js";
@@ -17,7 +17,7 @@ import"./index-hgd00nas.js";
17
17
  import"./index-yhzhdp3m.js";
18
18
  import"./index-zxm7ckvc.js";
19
19
  import"./index-ndg15t3x.js";
20
- import"./index-4j5442b0.js";
20
+ import"./index-fec4ezww.js";
21
21
  import"./index-qcsjj9m0.js";
22
22
  import"./index-6x556c2q.js";
23
23
  import"./index-38pf5bqw.js";
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  renderSearchArchive2
3
- } from "./index-ch3rvpjg.js";
4
- import"./index-jexm22qn.js";
3
+ } from "./index-ktez4jwz.js";
4
+ import"./index-73c292h9.js";
5
5
  import"./index-1cvyaw9a.js";
6
- import"./index-4j5442b0.js";
6
+ import"./index-fec4ezww.js";
7
7
  import"./index-qcsjj9m0.js";
8
8
  import"./index-6x556c2q.js";
9
9
  import"./index-aec63gtj.js";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  TOKEN_BUDGET_TOOL_REFUSAL
3
- } from "./index-4j5442b0.js";
3
+ } from "./index-fec4ezww.js";
4
4
  import {
5
5
  setHarness2
6
6
  } from "./index-0h2mkab2.js";
@@ -14,7 +14,7 @@ import {
14
14
  import"./index-2qtx0q6h.js";
15
15
  import {
16
16
  openDatabase
17
- } from "./index-06rdy9h6.js";
17
+ } from "./index-rjz01pvv.js";
18
18
  import"./index-fapenpch.js";
19
19
  import"./index-3bb24eb6.js";
20
20
  import"./index-8sqebjzk.js";
@@ -34,7 +34,7 @@ import {
34
34
  ensureProjectRegisteredFromPiDirectory,
35
35
  resolvePiHarnessKind,
36
36
  registerMagicContextTools
37
- } from "./index-sm51c9bc.js";
37
+ } from "./index-cc73przv.js";
38
38
  import"./index-aec63gtj.js";
39
39
  import"./index-qm139qq2.js";
40
40
  import"./index-ndg15t3x.js";
@@ -45,17 +45,17 @@ import"./index-9p40dgkm.js";
45
45
  import"./index-zxm7ckvc.js";
46
46
  import"./index-yhzhdp3m.js";
47
47
  import"./index-ty2m0s0s.js";
48
- import"./index-jy9fq8gp.js";
49
- import"./index-ywvhr524.js";
48
+ import"./index-akmmkmhf.js";
49
+ import"./index-0hewsw7v.js";
50
50
  import"./index-qcsjj9m0.js";
51
51
  import"./index-6x556c2q.js";
52
52
  import"./index-nvh6d3bz.js";
53
53
  import"./index-46wk0td0.js";
54
54
  import"./index-1cvyaw9a.js";
55
- import"./index-jexm22qn.js";
56
- import"./index-ch3rvpjg.js";
55
+ import"./index-73c292h9.js";
56
+ import"./index-ktez4jwz.js";
57
57
  import"./index-29nw7n1r.js";
58
- import"./index-babadndp.js";
58
+ import"./index-mb34ngfr.js";
59
59
  import"./index-xssjy4z9.js";
60
60
  import"./index-j0eagxkz.js";
61
61
  import {
@@ -8,7 +8,7 @@ import"./index-yxeg8zaa.js";
8
8
  import {
9
9
  LATEST_SUPPORTED_VERSION,
10
10
  getPersistedSchemaVersion
11
- } from "./index-06rdy9h6.js";
11
+ } from "./index-rjz01pvv.js";
12
12
  import"./index-fapenpch.js";
13
13
  import"./index-3bb24eb6.js";
14
14
  import"./index-8sqebjzk.js";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  readV2ArchiveOffThread2,
3
3
  serveV2ArchiveReads2
4
- } from "./index-jexm22qn.js";
4
+ } from "./index-73c292h9.js";
5
5
  import"./index-8sqebjzk.js";
6
6
  import"./index-2qtx0q6h.js";
7
7
  import"./index-x2n261wp.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/pi-magic-context",
3
- "version": "0.49.51",
3
+ "version": "0.49.52",
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",