@hank-warren/pi-auto-permissions 0.11.0 → 0.11.1

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
@@ -1,5 +1,13 @@
1
1
  # @hank-warren/pi-auto-permissions
2
2
 
3
+ ## 0.11.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 3fbf632: Stop evidence truncation from re-appending the whole record. With a per-record cap of 1-3 the head share rounded up to the entire budget, leaving a zero-length tail — and `slice(-0)` is `slice(0)`, so the "truncated" record was longer than its input and carried an elision marker for text the reviewer could still read. Caps of 4 and above, including every shipped default, are unaffected.
8
+ - Updated dependencies [3fbf632]
9
+ - @hank-warren/pi-permission-selector@1.3.0
10
+
3
11
  ## 0.11.0
4
12
 
5
13
  ### Minor Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hank-warren/pi-auto-permissions",
3
- "version": "0.11.0",
3
+ "version": "0.11.1",
4
4
  "description": "Fork of @ogulcancelik/pi-auto-permissions with dialog-answer user evidence: context-aware Bash permissions for Pi with automated guardian review.",
5
5
  "type": "module",
6
6
  "keywords": [
@@ -57,7 +57,7 @@
57
57
  "CHANGELOG.md"
58
58
  ],
59
59
  "dependencies": {
60
- "@hank-warren/pi-permission-selector": "^1.1.1"
60
+ "@hank-warren/pi-permission-selector": "^1.3.0"
61
61
  },
62
62
  "peerDependencies": {
63
63
  "@earendil-works/pi-ai": "*",
package/review.ts CHANGED
@@ -46,12 +46,20 @@ const TRUNCATION_HEAD_SHARE = 0.7;
46
46
  * the final segment of command chains, so both are preserved; the marker
47
47
  * tells the reviewer content is elided so it can never treat truncation as
48
48
  * proof of absence.
49
+ *
50
+ * A cap small enough that the head share rounds up to the whole budget leaves
51
+ * no tail. That case must drop the tail segment entirely rather than emit
52
+ * `slice(-0)`, which is `slice(0)` and would splice the *entire* record back
53
+ * in behind a marker claiming it had been elided — output longer than the
54
+ * input, and a marker the reviewer is told to trust.
49
55
  */
50
56
  export function truncateEvidenceText(text: string, maxChars: number): string {
51
57
  if (maxChars <= 0 || text.length <= maxChars) return text;
52
58
  const head = Math.ceil(maxChars * TRUNCATION_HEAD_SHARE);
53
59
  const tail = maxChars - head;
54
- return `${text.slice(0, head)}\n…[truncated ${text.length - maxChars} chars]…\n${text.slice(-tail)}`;
60
+ const marker = `\n…[truncated ${text.length - maxChars} chars]…`;
61
+ if (tail <= 0) return `${text.slice(0, head)}${marker}`;
62
+ return `${text.slice(0, head)}${marker}\n${text.slice(-tail)}`;
55
63
  }
56
64
 
57
65
  const COLLAPSED_TOOL_PATTERN = /^TOOL (\S+)/;