@oh-my-pi/pi-utils 16.4.0 → 16.4.2

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
+ ## [16.4.2] - 2026-07-10
6
+
7
+ ### Added
8
+
9
+ - Added `stringifyJson` utility with support for BigInt serialization.
10
+
5
11
  ## [16.3.12] - 2026-07-08
6
12
 
7
13
  ### Added
@@ -2,3 +2,13 @@
2
2
  * Try to parse JSON, returning null on failure.
3
3
  */
4
4
  export declare function tryParseJson<T = unknown>(content: string): T | null;
5
+ /**
6
+ * Serialize JSON while preserving bigint precision as decimal strings.
7
+ *
8
+ * Tool arguments normally arrive from JSON providers, but extension hooks and
9
+ * host integrations can supply JavaScript bigint values. Native
10
+ * `JSON.stringify` throws for those values, which makes otherwise valid agent
11
+ * history impossible to persist, replay, or compact. A decimal string is the
12
+ * only lossless JSON representation.
13
+ */
14
+ export declare function stringifyJson(value: unknown, space?: string | number): string | undefined;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@oh-my-pi/pi-utils",
4
- "version": "16.4.0",
4
+ "version": "16.4.2",
5
5
  "description": "Shared utilities for pi packages",
6
6
  "homepage": "https://omp.sh",
7
7
  "author": "Can Boluk",
@@ -31,7 +31,7 @@
31
31
  "fmt": "biome format --write ."
32
32
  },
33
33
  "dependencies": {
34
- "@oh-my-pi/pi-natives": "16.4.0",
34
+ "@oh-my-pi/pi-natives": "16.4.2",
35
35
  "handlebars": "^4.7.9",
36
36
  "winston": "^3.19.0",
37
37
  "winston-daily-rotate-file": "^5.0.0"
package/src/json.ts CHANGED
@@ -8,3 +8,16 @@ export function tryParseJson<T = unknown>(content: string): T | null {
8
8
  return null;
9
9
  }
10
10
  }
11
+
12
+ /**
13
+ * Serialize JSON while preserving bigint precision as decimal strings.
14
+ *
15
+ * Tool arguments normally arrive from JSON providers, but extension hooks and
16
+ * host integrations can supply JavaScript bigint values. Native
17
+ * `JSON.stringify` throws for those values, which makes otherwise valid agent
18
+ * history impossible to persist, replay, or compact. A decimal string is the
19
+ * only lossless JSON representation.
20
+ */
21
+ export function stringifyJson(value: unknown, space?: string | number): string | undefined {
22
+ return JSON.stringify(value, (_key, item) => (typeof item === "bigint" ? item.toString() : item), space);
23
+ }