@cortexkit/pi-magic-context 0.21.0 → 0.21.2

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.
@@ -158409,7 +158409,6 @@ function handleUntrustedLoad(db, projectIdentity, directory, detailed) {
158409
158409
  // src/embedding-bootstrap.ts
158410
158410
  async function ensureProjectRegisteredFromPiDirectory(directory, db) {
158411
158411
  const projectIdentity = resolveProjectIdentity(directory);
158412
- invalidateProject(projectIdentity);
158413
158412
  const detailed = loadPiConfigDetailed({ cwd: directory });
158414
158413
  if (isConfigLoadUntrusted(detailed)) {
158415
158414
  handleUntrustedLoad(db, projectIdentity, directory, detailed);
@@ -163973,6 +163972,7 @@ var ALL_ACTIONS = [
163973
163972
  "archive"
163974
163973
  ];
163975
163974
  var DREAMER_ONLY_ACTIONS = new Set([
163975
+ "list",
163976
163976
  "update",
163977
163977
  "merge",
163978
163978
  "archive"
@@ -164061,7 +164061,7 @@ function queueEmbedding(args) {
164061
164061
  }
164062
164062
  function createCtxMemoryTool(deps) {
164063
164063
  const dreamerAllowed = deps.allowDreamerActions === true;
164064
- const description = dreamerAllowed ? "Manage cross-session project memories. Memories persist across sessions and are " + "shared with OpenCode sessions on the same project. " + "Supported actions: write, delete, list, update, merge, archive." : "Manage cross-session project memories. Memories persist across sessions and are " + "shared with OpenCode sessions on the same project. " + "Supported actions: write, delete, list.";
164064
+ const description = dreamerAllowed ? "Manage cross-session project memories. Memories persist across sessions and are " + "shared with OpenCode sessions on the same project. " + "Supported actions: write, delete, list, update, merge, archive." : "Manage cross-session project memories. Memories persist across sessions and are " + "shared with OpenCode sessions on the same project. " + "Supported actions: write, delete.";
164065
164065
  return {
164066
164066
  name: "ctx_memory",
164067
164067
  label: "Magic Context: Memory",
@@ -164617,6 +164617,13 @@ function getDefaultHistorianFailureState() {
164617
164617
  lastFailureAt: null
164618
164618
  };
164619
164619
  }
164620
+ function setPersistedReasoningWatermark(db, sessionId, tagNumber) {
164621
+ ensureSessionMetaRow(db, sessionId);
164622
+ db.prepare("UPDATE session_meta SET cleared_reasoning_through_tag = ? WHERE session_id = ?").run(tagNumber, sessionId);
164623
+ }
164624
+ function clearPersistedReasoningWatermark(db, sessionId) {
164625
+ setPersistedReasoningWatermark(db, sessionId, 0);
164626
+ }
164620
164627
  function getPersistedStickyTurnReminder(db, sessionId) {
164621
164628
  const result = db.prepare("SELECT sticky_turn_reminder_text, sticky_turn_reminder_message_id FROM session_meta WHERE session_id = ?").get(sessionId);
164622
164629
  if (!isPersistedStickyTurnReminderRow(result)) {
@@ -164858,6 +164865,12 @@ function clearEmergencyRecovery(db, sessionId) {
164858
164865
  db.prepare("UPDATE session_meta SET needs_emergency_recovery = 0 WHERE session_id = ?").run(sessionId);
164859
164866
  })();
164860
164867
  }
164868
+ function clearDetectedContextLimit(db, sessionId) {
164869
+ db.transaction(() => {
164870
+ ensureSessionMetaRow(db, sessionId);
164871
+ db.prepare("UPDATE session_meta SET detected_context_limit = 0 WHERE session_id = ?").run(sessionId);
164872
+ })();
164873
+ }
164861
164874
  function getPersistedCompactionMarkerState(db, sessionId) {
164862
164875
  const row = db.prepare("SELECT compaction_marker_state FROM session_meta WHERE session_id = ?").get(sessionId);
164863
164876
  const raw = row?.compaction_marker_state;
@@ -166974,8 +166987,10 @@ function formatResult(result, index) {
166974
166987
  ].join(`
166975
166988
  `);
166976
166989
  }
166990
+ const expandStart = Math.max(1, result.messageOrdinal - 3);
166991
+ const expandEnd = result.messageOrdinal + 3;
166977
166992
  return [
166978
- `[${index}] [message] score=${result.score.toFixed(2)} ordinal=${result.messageOrdinal} role=${result.role}`,
166993
+ `[${index}] [message] score=${result.score.toFixed(2)} ordinal=${result.messageOrdinal} range=${expandStart}-${expandEnd} role=${result.role}`,
166979
166994
  result.content
166980
166995
  ].join(`
166981
166996
  `);
@@ -166984,7 +166999,11 @@ function formatSearchResults(query, results) {
166984
166999
  if (results.length === 0) {
166985
167000
  return `No results found for "${query}" across memories, git commits, or message history.`;
166986
167001
  }
166987
- const body = results.map((result, index) => formatResult(result, index + 1)).join(`
167002
+ const bodyParts = results.map((result, index) => formatResult(result, index + 1));
167003
+ if (results.some((result) => result.source === "message")) {
167004
+ bodyParts.push("Use ctx_expand(start, end) with the range from any message result above to read the full conversation context.");
167005
+ }
167006
+ const body = bodyParts.join(`
166988
167007
 
166989
167008
  `);
166990
167009
  return `Found ${results.length} result${results.length === 1 ? "" : "s"} for "${query}":
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/pi-magic-context",
3
- "version": "0.21.0",
3
+ "version": "0.21.2",
4
4
  "type": "module",
5
5
  "description": "Pi coding agent extension for Magic Context — cross-session memory and context management",
6
6
  "main": "dist/index.js",