@trim21/personal-pi-extensions 0.1.659 → 0.1.660

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trim21/personal-pi-extensions",
3
- "version": "0.1.659",
3
+ "version": "0.1.660",
4
4
  "type": "module",
5
5
  "description": "Custom pi coding-agent extensions: bwrap sandbox, workspace guard, opencode edit, and more",
6
6
  "keywords": [
@@ -104,10 +104,15 @@ export const PRELUDE_SOURCE = String.raw`(function (bridge, toolsJson, storeJson
104
104
  Object.freeze(allTools);
105
105
 
106
106
  // key -> JSON 文本;容量按 key 与 JSON 的字符数计
107
- const stored = new Map(Object.entries(parse(storeJson)));
107
+ const stored = new Map();
108
108
  const writes = new Map();
109
109
  let storedChars = 0;
110
- for (const [key, json] of stored) storedChars += key.length + json.length;
110
+ for (const [key, value] of Object.entries(parse(storeJson))) {
111
+ const json = stringify(value);
112
+ if (json === undefined) continue;
113
+ stored.set(key, json);
114
+ storedChars += key.length + json.length;
115
+ }
111
116
 
112
117
  function checkKey(name, key) {
113
118
  if (typeof key !== "string") throw new TypeErrorCtor(name + "() key must be a string");
@@ -89,10 +89,15 @@ var PRELUDE_SOURCE = String.raw`(function (bridge, toolsJson, storeJson) {
89
89
  Object.freeze(allTools);
90
90
 
91
91
  // key -> JSON 文本;容量按 key 与 JSON 的字符数计
92
- const stored = new Map(Object.entries(parse(storeJson)));
92
+ const stored = new Map();
93
93
  const writes = new Map();
94
94
  let storedChars = 0;
95
- for (const [key, json] of stored) storedChars += key.length + json.length;
95
+ for (const [key, value] of Object.entries(parse(storeJson))) {
96
+ const json = stringify(value);
97
+ if (json === undefined) continue;
98
+ stored.set(key, json);
99
+ storedChars += key.length + json.length;
100
+ }
96
101
 
97
102
  function checkKey(name, key) {
98
103
  if (typeof key !== "string") throw new TypeErrorCtor(name + "() key must be a string");