@oh-my-pi/snapcompact 18.1.17 → 18.1.18

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/CHANGELOG.md CHANGED
@@ -2,6 +2,12 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [18.1.18] - 2026-09-11
6
+
7
+ ### Fixed
8
+
9
+ - A snapcompact pass now also strips a superseded Anthropic server-compaction payload (`preserveData.anthropicCompaction`) alongside the OpenAI replacement history, so a stale native summary can never replay ahead of the archived frames.
10
+
5
11
  ## [18.1.0] - 2026-09-01
6
12
 
7
13
  ### Added
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/snapcompact",
4
- "version": "18.1.17",
4
+ "version": "18.1.18",
5
5
  "description": "Bitmap-frame context compression for vision-capable LLMs",
6
6
  "homepage": "https://omp.sh",
7
7
  "author": "Stencil Labs, Inc.",
@@ -31,11 +31,11 @@
31
31
  "fmt": "oxfmt --no-error-on-unmatched-pattern 'src/**/*.{ts,tsx}' '{test,bench,examples,scripts}/**/*.ts' '*.ts'"
32
32
  },
33
33
  "dependencies": {
34
- "@oh-my-pi/pi-ai": "18.1.17",
35
- "@oh-my-pi/pi-catalog": "18.1.17",
36
- "@oh-my-pi/pi-natives": "18.1.17",
37
- "@oh-my-pi/pi-utils": "18.1.17",
38
- "@oh-my-pi/pi-wire": "18.1.17"
34
+ "@oh-my-pi/pi-ai": "18.1.18",
35
+ "@oh-my-pi/pi-catalog": "18.1.18",
36
+ "@oh-my-pi/pi-natives": "18.1.18",
37
+ "@oh-my-pi/pi-utils": "18.1.18",
38
+ "@oh-my-pi/pi-wire": "18.1.18"
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/bun": "^1.3.14"
@@ -1067,15 +1067,16 @@ export function serializeConversation(messages: Message[], options?: SerializeOp
1067
1067
  // Preserve-data helpers
1068
1068
  // ============================================================================
1069
1069
 
1070
- const OPENAI_REMOTE_COMPACTION_PRESERVE_KEY = "openaiRemoteCompaction";
1070
+ /** Provider-native compaction payloads a snapcompact pass supersedes. */
1071
+ const PROVIDER_COMPACTION_PRESERVE_KEYS = ["openaiRemoteCompaction", "anthropicCompaction"] as const;
1071
1072
 
1072
- function stripOpenAiRemoteCompactionPreserveData(
1073
+ function stripProviderCompactionPreserveData(
1073
1074
  preserveData: Record<string, unknown> | undefined,
1074
1075
  ): Record<string, unknown> | undefined {
1075
- if (!preserveData || !(OPENAI_REMOTE_COMPACTION_PRESERVE_KEY in preserveData)) {
1076
+ if (!preserveData || !PROVIDER_COMPACTION_PRESERVE_KEYS.some(key => key in preserveData)) {
1076
1077
  return preserveData;
1077
1078
  }
1078
- const { [OPENAI_REMOTE_COMPACTION_PRESERVE_KEY]: _removed, ...rest } = preserveData;
1079
+ const { openaiRemoteCompaction: _openai, anthropicCompaction: _anthropic, ...rest } = preserveData;
1079
1080
  return Object.keys(rest).length > 0 ? rest : undefined;
1080
1081
  }
1081
1082
 
@@ -2157,9 +2158,10 @@ export async function compact<TMessage = Message>(
2157
2158
  });
2158
2159
  }
2159
2160
 
2160
- // A snapcompact pass replaces any provider-side replacement history; strip the
2161
- // OpenAI remote-compaction payload like the default summarizer path does.
2162
- const basePreserve = stripOpenAiRemoteCompactionPreserveData(previousPreserveData) ?? {};
2161
+ // A snapcompact pass replaces any provider-side compaction payload; strip the
2162
+ // OpenAI replacement history and the Anthropic compaction block like the
2163
+ // default summarizer path does.
2164
+ const basePreserve = stripProviderCompactionPreserveData(previousPreserveData) ?? {};
2163
2165
  const persistedText =
2164
2166
  layout.keptText.length > 0 && layout.textTail.length > 0
2165
2167
  ? `${layout.keptText.slice(0, layout.keptText.length - layout.textTail.length)}${textTail}`