@oh-my-pi/snapcompact 16.1.21 → 16.1.23

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,13 @@
2
2
 
3
3
  ## [Unreleased]
4
4
 
5
+ ## [16.1.23] - 2026-06-26
6
+
7
+ ### Added
8
+
9
+ - Added `archiveSourceText(archive)` to extract a persisted frame archive's source text as plain text for LLM summarization. ([#3561](https://github.com/can1357/oh-my-pi/pull/3561) by [@serverinspector](https://github.com/serverinspector))
10
+ - Added `stripPreservedArchive(preserveData)` to drop the persisted frame-archive slot (`PRESERVE_KEY`) and collapse to `undefined` when no other state remains — shared by the agent and coding-agent compaction paths instead of duplicating the strip rule.
11
+
5
12
  ## [16.1.13] - 2026-06-22
6
13
 
7
14
  ### Fixed
@@ -519,6 +519,14 @@ export declare function renderMany(text: string, options?: RenderManyOptions): P
519
519
  export declare function frames(text: string, options?: Pick<RenderManyOptions, "shape" | "model" | "frameSize">): number;
520
520
  /** Validate and extract a persisted frame archive from `preserveData`. */
521
521
  export declare function getPreservedArchive(preserveData: Record<string, unknown> | undefined): Archive | undefined;
522
+ /** Drop the persisted frame archive ({@link PRESERVE_KEY}) from `preserveData`,
523
+ * returning the remaining state — or `undefined` when nothing else remains, so
524
+ * an empty `{}` is never persisted. Callers strip the archive once its frames
525
+ * have been migrated into a new compaction's text, preventing the stale frames
526
+ * from leaking back into the rebuilt context. */
527
+ export declare function stripPreservedArchive(preserveData: Record<string, unknown> | undefined): Record<string, unknown> | undefined;
528
+ /** Extract persisted archive source text as plain text for LLM summarization. */
529
+ export declare function archiveSourceText(archive: Archive): string | undefined;
522
530
  /** Convert archive frames into LLM image blocks (oldest first). */
523
531
  export declare function images(archive: Archive): ImageContent[];
524
532
  /** Ordered archive blocks for a compaction summary message, oldest to newest:
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/snapcompact",
4
- "version": "16.1.21",
4
+ "version": "16.1.23",
5
5
  "description": "Bitmap-frame context compression for vision-capable LLMs",
6
6
  "homepage": "https://omp.sh",
7
7
  "author": "Can Boluk",
@@ -31,10 +31,10 @@
31
31
  "fmt": "biome format --write ."
32
32
  },
33
33
  "dependencies": {
34
- "@oh-my-pi/pi-ai": "16.1.21",
35
- "@oh-my-pi/pi-natives": "16.1.21",
36
- "@oh-my-pi/pi-utils": "16.1.21",
37
- "@oh-my-pi/pi-wire": "16.1.21"
34
+ "@oh-my-pi/pi-ai": "16.1.23",
35
+ "@oh-my-pi/pi-natives": "16.1.23",
36
+ "@oh-my-pi/pi-utils": "16.1.23",
37
+ "@oh-my-pi/pi-wire": "16.1.23"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/bun": "^1.3.14"
@@ -1290,6 +1290,29 @@ export function getPreservedArchive(preserveData: Record<string, unknown> | unde
1290
1290
  };
1291
1291
  }
1292
1292
 
1293
+ /** Drop the persisted frame archive ({@link PRESERVE_KEY}) from `preserveData`,
1294
+ * returning the remaining state — or `undefined` when nothing else remains, so
1295
+ * an empty `{}` is never persisted. Callers strip the archive once its frames
1296
+ * have been migrated into a new compaction's text, preventing the stale frames
1297
+ * from leaking back into the rebuilt context. */
1298
+ export function stripPreservedArchive(
1299
+ preserveData: Record<string, unknown> | undefined,
1300
+ ): Record<string, unknown> | undefined {
1301
+ if (!preserveData || !(PRESERVE_KEY in preserveData)) return preserveData;
1302
+ const { [PRESERVE_KEY]: _removed, ...rest } = preserveData;
1303
+ return Object.keys(rest).length > 0 ? rest : undefined;
1304
+ }
1305
+
1306
+ /** Extract persisted archive source text as plain text for LLM summarization. */
1307
+ export function archiveSourceText(archive: Archive): string | undefined {
1308
+ const text =
1309
+ archive.text ??
1310
+ [archive.textHead, archive.textTail]
1311
+ .filter((part): part is string => typeof part === "string" && part.length > 0)
1312
+ .join(NEWLINE_GLYPH);
1313
+ return text.length > 0 ? toPlainText(text) : undefined;
1314
+ }
1315
+
1293
1316
  /** Convert archive frames into LLM image blocks (oldest first). */
1294
1317
  export function images(archive: Archive): ImageContent[] {
1295
1318
  return archive.frames.map(frame => ({