pi-reasoning-zip 0.2.4 → 0.2.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.
- package/CHANGELOG.md +9 -1
- package/README.md +3 -2
- package/dist/messageTransform.js +5 -1
- package/package.json +1 -1
- package/scripts/smoke-extension.mjs +1 -1
- package/src/messageTransform.ts +4 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.2.5] - 2026-07-03
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- Skip Pi `thinkingSignature` and redacted thinking blocks instead of rewriting opaque provider metadata.
|
|
15
|
+
- Enforce `thresholds.targetRatio` when accepting compacted thinking output.
|
|
16
|
+
|
|
10
17
|
## [0.2.4] - 2026-07-03
|
|
11
18
|
|
|
12
19
|
### Fixed
|
|
@@ -71,7 +78,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
71
78
|
- Added package motto to README.
|
|
72
79
|
- Added npm release metadata: description, keywords, repository links, exports, and Node engine.
|
|
73
80
|
|
|
74
|
-
[Unreleased]: https://github.com/Ryu-CZ/pi-reasoning-zip/compare/v0.2.
|
|
81
|
+
[Unreleased]: https://github.com/Ryu-CZ/pi-reasoning-zip/compare/v0.2.5...HEAD
|
|
82
|
+
[0.2.5]: https://github.com/Ryu-CZ/pi-reasoning-zip/compare/v0.2.4...v0.2.5
|
|
75
83
|
[0.2.4]: https://github.com/Ryu-CZ/pi-reasoning-zip/compare/v0.2.3...v0.2.4
|
|
76
84
|
[0.2.3]: https://github.com/Ryu-CZ/pi-reasoning-zip/compare/v0.2.2...v0.2.3
|
|
77
85
|
[0.2.2]: https://github.com/Ryu-CZ/pi-reasoning-zip/compare/v0.2.1...v0.2.2
|
package/README.md
CHANGED
|
@@ -60,7 +60,7 @@ The npm library entrypoint still builds to `dist/index.js`, but Pi package metad
|
|
|
60
60
|
- **llama.cpp-first targeting** — defaults to llama.cpp-like providers such as `llama-server=http://127.0.0.1:7484`.
|
|
61
61
|
- **Prompt minimization** — optional grug-style request injection for target local providers.
|
|
62
62
|
- **Fail-open safety** — preserves original messages on errors, timeouts, invalid output, or unknown payloads.
|
|
63
|
-
- **Opaque reasoning guard** — skips signed
|
|
63
|
+
- **Opaque reasoning guard** — skips signed, encrypted, signature-bearing, redacted, or provider-opaque reasoning metadata.
|
|
64
64
|
|
|
65
65
|
## Commands
|
|
66
66
|
|
|
@@ -142,7 +142,7 @@ next:
|
|
|
142
142
|
- ...
|
|
143
143
|
```
|
|
144
144
|
|
|
145
|
-
If the compactor returns `none`, empty output, output longer than the original, or output over `thresholds.maxTraceChars`, the original block is preserved.
|
|
145
|
+
If the compactor returns `none`, empty output, output above `thresholds.targetRatio` of the original length, output longer than the original, or output over `thresholds.maxTraceChars`, the original block is preserved.
|
|
146
146
|
|
|
147
147
|
## Safety model
|
|
148
148
|
|
|
@@ -159,6 +159,7 @@ It skips:
|
|
|
159
159
|
- non-assistant messages
|
|
160
160
|
- messages without array content
|
|
161
161
|
- short thinking below `thresholds.minChars`
|
|
162
|
+
- signature-bearing or redacted thinking blocks
|
|
162
163
|
- unknown providers by default in `llama-only`
|
|
163
164
|
- hosted/non-local providers in `local-only`
|
|
164
165
|
|
package/dist/messageTransform.js
CHANGED
|
@@ -5,8 +5,10 @@ function isThinkingBlock(block) {
|
|
|
5
5
|
function hasOpaqueReasoningMetadata(block) {
|
|
6
6
|
return (typeof block.signature === "string" ||
|
|
7
7
|
typeof block.reasoning_signature === "string" ||
|
|
8
|
+
typeof block.thinkingSignature === "string" ||
|
|
8
9
|
typeof block.encrypted_content === "string" ||
|
|
9
|
-
Array.isArray(block.reasoning_details)
|
|
10
|
+
Array.isArray(block.reasoning_details) ||
|
|
11
|
+
block.redacted === true);
|
|
10
12
|
}
|
|
11
13
|
function acceptableCompaction(original, compacted, settings) {
|
|
12
14
|
const text = compacted.trim();
|
|
@@ -14,6 +16,8 @@ function acceptableCompaction(original, compacted, settings) {
|
|
|
14
16
|
return undefined;
|
|
15
17
|
if (text.length >= original.length)
|
|
16
18
|
return undefined;
|
|
19
|
+
if (text.length / original.length > settings.thresholds.targetRatio)
|
|
20
|
+
return undefined;
|
|
17
21
|
if (text.length > settings.thresholds.maxTraceChars)
|
|
18
22
|
return undefined;
|
|
19
23
|
return text;
|
package/package.json
CHANGED
|
@@ -15,7 +15,7 @@ try {
|
|
|
15
15
|
JSON.stringify({
|
|
16
16
|
reasoningZip: {
|
|
17
17
|
mode: "llama-only",
|
|
18
|
-
thresholds: { minChars: 5, maxTraceChars: 100 },
|
|
18
|
+
thresholds: { minChars: 5, targetRatio: 1, maxTraceChars: 100 },
|
|
19
19
|
compactor: { baseUrl: "http://mock.local/v1", model: "mock", timeoutMs: 1000 },
|
|
20
20
|
},
|
|
21
21
|
}),
|
package/src/messageTransform.ts
CHANGED
|
@@ -11,8 +11,10 @@ function hasOpaqueReasoningMetadata(block: PiMessageBlock): boolean {
|
|
|
11
11
|
return (
|
|
12
12
|
typeof block.signature === "string" ||
|
|
13
13
|
typeof block.reasoning_signature === "string" ||
|
|
14
|
+
typeof block.thinkingSignature === "string" ||
|
|
14
15
|
typeof block.encrypted_content === "string" ||
|
|
15
|
-
Array.isArray(block.reasoning_details)
|
|
16
|
+
Array.isArray(block.reasoning_details) ||
|
|
17
|
+
block.redacted === true
|
|
16
18
|
);
|
|
17
19
|
}
|
|
18
20
|
|
|
@@ -20,6 +22,7 @@ function acceptableCompaction(original: string, compacted: string, settings: Rea
|
|
|
20
22
|
const text = compacted.trim();
|
|
21
23
|
if (!text || text === "none") return undefined;
|
|
22
24
|
if (text.length >= original.length) return undefined;
|
|
25
|
+
if (text.length / original.length > settings.thresholds.targetRatio) return undefined;
|
|
23
26
|
if (text.length > settings.thresholds.maxTraceChars) return undefined;
|
|
24
27
|
return text;
|
|
25
28
|
}
|