@cortexkit/magic-context 0.22.2 → 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 +18 -2
  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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/magic-context",
3
- "version": "0.22.2",
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",