@wolfx/opencode-magic-context 0.21.8-patch.4 → 0.21.8-patch.5

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.
@@ -33,7 +33,9 @@
33
33
  */
34
34
  export interface TextCompleteStripConfig {
35
35
  enabled: boolean;
36
- /** Custom regex source strings. When provided, REPLACE the built-in defaults. */
36
+ /** Custom regex source strings. Supports `/pattern/flags` syntax for flags
37
+ * like `g`, `i`, etc. Plain strings (no leading `/`) are treated as the
38
+ * pattern with no flags. Example: `"/\\u00a7/g"` for global § strip. */
37
39
  patterns?: string[];
38
40
  }
39
41
  export declare function createTextCompleteHandler(stripConfig?: TextCompleteStripConfig): (_input: {
@@ -1 +1 @@
1
- {"version":3,"file":"text-complete.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/text-complete.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAOH,MAAM,WAAW,uBAAuB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB,iFAAiF;IACjF,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAED,wBAAgB,yBAAyB,CAAC,WAAW,CAAC,EAAE,uBAAuB,IAavE,QAAQ;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAChE,QAAQ;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,KACzB,OAAO,CAAC,IAAI,CAAC,CAKnB"}
1
+ {"version":3,"file":"text-complete.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/text-complete.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAOH,MAAM,WAAW,uBAAuB;IACpC,OAAO,EAAE,OAAO,CAAC;IACjB;;6EAEyE;IACzE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB;AAkBD,wBAAgB,yBAAyB,CAAC,WAAW,CAAC,EAAE,uBAAuB,IAavE,QAAQ;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAChE,QAAQ;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,KACzB,OAAO,CAAC,IAAI,CAAC,CAKnB"}
package/dist/index.js CHANGED
@@ -176103,13 +176103,24 @@ var DEFAULT_PATTERNS = [
176103
176103
  /^(\u00a7\d+\u00a7\s*)+/,
176104
176104
  /\u00a7/g
176105
176105
  ];
176106
+ function parseRegex(src) {
176107
+ if (src.startsWith("/")) {
176108
+ const lastSlash = src.lastIndexOf("/");
176109
+ if (lastSlash > 1) {
176110
+ const pattern = src.slice(1, lastSlash);
176111
+ const flags = src.slice(lastSlash + 1);
176112
+ return new RegExp(pattern, flags);
176113
+ }
176114
+ }
176115
+ return new RegExp(src);
176116
+ }
176106
176117
  function createTextCompleteHandler(stripConfig) {
176107
176118
  const isEnabled = stripConfig?.enabled ?? true;
176108
176119
  let patterns;
176109
176120
  if (!isEnabled) {
176110
176121
  patterns = [];
176111
176122
  } else if (stripConfig?.patterns && stripConfig.patterns.length > 0) {
176112
- patterns = stripConfig.patterns.map((src) => new RegExp(src));
176123
+ patterns = stripConfig.patterns.map(parseRegex);
176113
176124
  } else {
176114
176125
  patterns = DEFAULT_PATTERNS;
176115
176126
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wolfx/opencode-magic-context",
3
- "version": "0.21.8-patch.4",
3
+ "version": "0.21.8-patch.5",
4
4
  "type": "module",
5
5
  "description": "OpenCode plugin for Magic Context — cross-session memory and context management",
6
6
  "main": "dist/index.js",