@cortexkit/opencode-magic-context 0.49.60 → 0.49.62

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.
package/dist/index.js CHANGED
@@ -8203,7 +8203,7 @@ var require_src2 = __commonJS(function(exports, module) {
8203
8203
  // package.json
8204
8204
  var package_default = {
8205
8205
  name: "@cortexkit/opencode-magic-context",
8206
- version: "0.49.60",
8206
+ version: "0.49.62",
8207
8207
  type: "module",
8208
8208
  description: "OpenCode plugin for Magic Context — cross-session memory and context management",
8209
8209
  main: "dist/index.js",
@@ -114,4 +114,18 @@ export declare function buildPersistedDropTargets(transcript: Transcript, tags:
114
114
  allowReasoningPrefixRewrite?: boolean;
115
115
  }): Map<number, TagTarget>;
116
116
  export declare function tagTranscript(sessionId: string, transcript: Transcript, tagger: Tagger, db: ContextDatabase, options?: TagTranscriptOptions): TagTranscriptResult;
117
+ /**
118
+ * Whether tagTranscript leaves this text part untagged. Pi and Oh My Pi can
119
+ * expose provider framing as assistant text blocks (Gemini, for one, streams an
120
+ * empty text block after a function call). Treat a previously prefixed blank as
121
+ * blank too, so Magic Context never turns inert framing into a tag-bearing part
122
+ * that later strip logic could mistake for content. With
123
+ * `preserveTagOnlyAssistantText`, an assistant text that is nothing but tag
124
+ * notation stays untagged as well.
125
+ *
126
+ * Such a part still takes up a text ordinal but never gets a stored `:pN` row.
127
+ * Any check that compares stored rows with the current text parts must skip
128
+ * exactly these parts, so it calls this same function.
129
+ */
130
+ export declare function isUntaggedAssistantText(role: string, text: string, preserveTagOnlyAssistantText: boolean | undefined): boolean;
117
131
  //# sourceMappingURL=tag-transcript.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tag-transcript.d.ts","sourceRoot":"","sources":["../../src/shared/tag-transcript.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,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,OAAO,CAAA;CAAO,GACxD,GAAG,CAAC,MAAM,EAAE,SAAS,CAAC,CAyGxB;AAkGD,wBAAgB,aAAa,CACzB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,EAAE,EAAE,eAAe,EACnB,OAAO,GAAE,oBAAyB,GACnC,mBAAmB,CA+XrB;AAyTD;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CACnC,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EACZ,4BAA4B,EAAE,OAAO,GAAG,SAAS,GAClD,OAAO,CAQT"}
package/dist/v2/server.js CHANGED
@@ -7875,7 +7875,7 @@ var require_src2 = __commonJS(function(exports, module) {
7875
7875
  // package.json
7876
7876
  var package_default = {
7877
7877
  name: "@cortexkit/opencode-magic-context",
7878
- version: "0.49.60",
7878
+ version: "0.49.62",
7879
7879
  type: "module",
7880
7880
  description: "OpenCode plugin for Magic Context — cross-session memory and context management",
7881
7881
  main: "dist/index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/opencode-magic-context",
3
- "version": "0.49.60",
3
+ "version": "0.49.62",
4
4
  "type": "module",
5
5
  "description": "OpenCode plugin for Magic Context — cross-session memory and context management",
6
6
  "main": "dist/index.js",
@@ -1043,19 +1043,37 @@ interface TagTextPartArgs {
1043
1043
  textTokenCache?: Map<string, { text: string; tokenCount: number }>;
1044
1044
  }
1045
1045
 
1046
- function tagTextPart(args: TagTextPartArgs): void {
1047
- const identityStart = args.timing ? performance.now() : 0;
1048
- const text = args.part.getText() ?? "";
1049
- // Pi and OMP can expose provider framing as assistant text blocks. Treat a
1050
- // previously prefixed blank as blank too, so MC never turns inert framing
1051
- // into a tag-bearing part that later strip logic could mistake for content.
1052
- if (
1053
- args.message.info.role === "assistant" &&
1046
+ /**
1047
+ * Whether tagTranscript leaves this text part untagged. Pi and Oh My Pi can
1048
+ * expose provider framing as assistant text blocks (Gemini, for one, streams an
1049
+ * empty text block after a function call). Treat a previously prefixed blank as
1050
+ * blank too, so Magic Context never turns inert framing into a tag-bearing part
1051
+ * that later strip logic could mistake for content. With
1052
+ * `preserveTagOnlyAssistantText`, an assistant text that is nothing but tag
1053
+ * notation stays untagged as well.
1054
+ *
1055
+ * Such a part still takes up a text ordinal but never gets a stored `:pN` row.
1056
+ * Any check that compares stored rows with the current text parts must skip
1057
+ * exactly these parts, so it calls this same function.
1058
+ */
1059
+ export function isUntaggedAssistantText(
1060
+ role: string,
1061
+ text: string,
1062
+ preserveTagOnlyAssistantText: boolean | undefined,
1063
+ ): boolean {
1064
+ return (
1065
+ role === "assistant" &&
1054
1066
  (stripWellFormedLeadingTagPrefix(text).trim().length === 0 ||
1055
- (args.preserveTagOnlyAssistantText &&
1067
+ (preserveTagOnlyAssistantText === true &&
1056
1068
  text.includes("§") &&
1057
1069
  stripPersistedAssistantText(text).length === 0))
1058
- ) {
1070
+ );
1071
+ }
1072
+
1073
+ function tagTextPart(args: TagTextPartArgs): void {
1074
+ const identityStart = args.timing ? performance.now() : 0;
1075
+ const text = args.part.getText() ?? "";
1076
+ if (isUntaggedAssistantText(args.message.info.role, text, args.preserveTagOnlyAssistantText)) {
1059
1077
  if (args.timing) args.timing.identity += performance.now() - identityStart;
1060
1078
  return;
1061
1079
  }