@cortexkit/magic-context 0.22.1 → 0.22.3

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 (2) hide show
  1. package/dist/index.js +62 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -144779,9 +144779,22 @@ var init_read_session_formatting = __esm(() => {
144779
144779
  tokenizer = new src_default(exports_claude);
144780
144780
  });
144781
144781
  // ../plugin/src/hooks/magic-context/tag-content-primitives.ts
144782
- var encoder;
144782
+ function stripTagPrefix(value) {
144783
+ let stripped = value;
144784
+ for (let pass = 0;pass < 8; pass++) {
144785
+ const prev = stripped;
144786
+ stripped = stripped.replace(MALFORMED_TAG_PREFIX_REGEX, "");
144787
+ stripped = stripped.replace(TAG_PREFIX_REGEX, "");
144788
+ if (stripped === prev)
144789
+ break;
144790
+ }
144791
+ return stripped;
144792
+ }
144793
+ var encoder, TAG_PREFIX_REGEX, MALFORMED_TAG_PREFIX_REGEX;
144783
144794
  var init_tag_content_primitives = __esm(() => {
144784
144795
  encoder = new TextEncoder;
144796
+ TAG_PREFIX_REGEX = /^(?:§\d+§\s*)+/;
144797
+ MALFORMED_TAG_PREFIX_REGEX = /^(?:§\d+">§(?:\d+§)?\s*)+/;
144785
144798
  });
144786
144799
 
144787
144800
  // ../plugin/src/hooks/magic-context/tag-part-guards.ts
@@ -144800,7 +144813,9 @@ function hasMeaningfulPart(part) {
144800
144813
  return false;
144801
144814
  const type = part.type;
144802
144815
  if (type === "text") {
144803
- return typeof part.text === "string" && part.text.trim().length > 0;
144816
+ if (typeof part.text !== "string")
144817
+ return false;
144818
+ return stripTagPrefix(part.text).trim().length > 0;
144804
144819
  }
144805
144820
  if (typeof type !== "string")
144806
144821
  return false;
@@ -144837,6 +144852,7 @@ class ToolMutationBatch {
144837
144852
  }
144838
144853
  var IGNORE_PART_TYPES;
144839
144854
  var init_tool_drop_target = __esm(() => {
144855
+ init_tag_content_primitives();
144840
144856
  IGNORE_PART_TYPES = new Set([
144841
144857
  "thinking",
144842
144858
  "reasoning",
@@ -145495,6 +145511,17 @@ CREATE INDEX IF NOT EXISTS idx_dream_queue_pending ON dream_queue(started_at, en
145495
145511
  updated_at INTEGER NOT NULL DEFAULT 0
145496
145512
  );
145497
145513
 
145514
+ CREATE TABLE IF NOT EXISTS git_sweep_coordinator (
145515
+ project_path TEXT PRIMARY KEY,
145516
+ lease_holder TEXT,
145517
+ lease_expires_at INTEGER,
145518
+ last_swept_at INTEGER
145519
+ );
145520
+ CREATE INDEX IF NOT EXISTS idx_git_sweep_coordinator_lease_expires
145521
+ ON git_sweep_coordinator(lease_expires_at);
145522
+ CREATE INDEX IF NOT EXISTS idx_git_sweep_coordinator_last_swept
145523
+ ON git_sweep_coordinator(last_swept_at);
145524
+
145498
145525
  CREATE TABLE IF NOT EXISTS m0_mutation_log (
145499
145526
  id INTEGER PRIMARY KEY AUTOINCREMENT,
145500
145527
  session_id TEXT NOT NULL,
@@ -146030,7 +146057,7 @@ function closeDatabase() {
146030
146057
  }
146031
146058
  }
146032
146059
  }
146033
- var databases, persistenceByDatabase, persistenceErrorByDatabase, lastSchemaFenceRejection = null, LATEST_SUPPORTED_VERSION = 27, sqlitePragmaConfig;
146060
+ var databases, persistenceByDatabase, persistenceErrorByDatabase, lastSchemaFenceRejection = null, LATEST_SUPPORTED_VERSION = 29, sqlitePragmaConfig;
146034
146061
  var init_storage_db = __esm(async () => {
146035
146062
  init_data_path();
146036
146063
  init_logger();
@@ -146821,6 +146848,38 @@ var init_migrations = __esm(async () => {
146821
146848
  ON tags(session_id, entry_fingerprint)
146822
146849
  WHERE type='message' AND entry_fingerprint IS NOT NULL`);
146823
146850
  }
146851
+ },
146852
+ {
146853
+ version: 28,
146854
+ description: "Add git commit sweep coordinator lease/cooldown table",
146855
+ up: (db) => {
146856
+ db.exec(`
146857
+ CREATE TABLE IF NOT EXISTS git_sweep_coordinator (
146858
+ project_path TEXT PRIMARY KEY,
146859
+ lease_holder TEXT,
146860
+ lease_expires_at INTEGER,
146861
+ last_swept_at INTEGER
146862
+ );
146863
+ CREATE INDEX IF NOT EXISTS idx_git_sweep_coordinator_lease_expires
146864
+ ON git_sweep_coordinator(lease_expires_at);
146865
+ CREATE INDEX IF NOT EXISTS idx_git_sweep_coordinator_last_swept
146866
+ ON git_sweep_coordinator(last_swept_at);
146867
+ `);
146868
+ }
146869
+ },
146870
+ {
146871
+ version: 29,
146872
+ description: "Add anchor_ordinal to notes (traceback to the conversation tail)",
146873
+ up: (db) => {
146874
+ const notesExists = db.prepare("SELECT name FROM sqlite_master WHERE type='table' AND name='notes'").get();
146875
+ if (!notesExists) {
146876
+ return;
146877
+ }
146878
+ const columns = db.prepare("PRAGMA table_info(notes)").all();
146879
+ if (!columns.some((column) => column.name === "anchor_ordinal")) {
146880
+ db.exec("ALTER TABLE notes ADD COLUMN anchor_ordinal INTEGER");
146881
+ }
146882
+ }
146824
146883
  }
146825
146884
  ];
146826
146885
  LATEST_MIGRATION_VERSION = MIGRATIONS.reduce((max, m) => Math.max(max, m.version), 0);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/magic-context",
3
- "version": "0.22.1",
3
+ "version": "0.22.3",
4
4
  "description": "Unified CLI for Magic Context — setup, doctor, and migration across OpenCode and Pi",
5
5
  "keywords": [
6
6
  "opencode",