Skip to content

Commit e76cff1

Browse files
authored
fix: strip all accumulated tags in stripTagPrefix (#12)
Defensive fix: change TAG_PREFIX_REGEX from /^§\d+§\s*/ to /^(?:§\d+§\s*)+/ so stripTagPrefix removes all consecutive tag prefixes, not just the outermost one. In practice tags don't accumulate because prependTag always strips before prepending, but this makes the function robust against any future path that might double-tag content. Thanks to @tomolom for the contribution. Fixes #11
1 parent ca4d23f commit e76cff1

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/plugin/src/hooks/magic-context/tag-content-primitives.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import type { ThinkingLikePart } from "./tag-messages";
22

33
const encoder = new TextEncoder();
4-
const TAG_PREFIX_REGEX = /^§\d+§\s*/;
4+
const TAG_PREFIX_REGEX = /^(?:§\d+§\s*)+/;
55

66
export function byteSize(value: string): number {
77
return encoder.encode(value).length;

0 commit comments

Comments
 (0)