protect-context 1.2.0 → 1.3.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.
Files changed (2) hide show
  1. package/README.md +22 -0
  2. package/package.json +3 -1
package/README.md CHANGED
@@ -113,6 +113,28 @@ pi install npm:protect-context
113
113
  pi -e npm:protect-context
114
114
  ```
115
115
 
116
+ Install it through pi, not through `npm install`. The extension declares pi's
117
+ host modules (`@earendil-works/pi-ai`, `@earendil-works/pi-coding-agent`,
118
+ `typebox`) as `"*"` peer dependencies, as Pi requires; Pi suppresses peer
119
+ installation for managed npm packages, while a plain `npm install
120
+ protect-context` does not. The second path downloads the whole pi runtime and
121
+ surfaces advisories from that tree, which belong to the host and not to this
122
+ zero-runtime-dependency extension.
123
+
124
+ Remove any hand-installed copy first — a directory such as
125
+ `~/.pi/agent/extensions/protect-context` or `.pi/extensions/protect-context`,
126
+ or `pi remove npm:protect-context` if that copy came from npm. Two copies
127
+ register the same tool names, and pi drops the second one:
128
+
129
+ ```text
130
+ Error: Failed to load extension "…/.pi/npm/node_modules/protect-context/extension/index.ts":
131
+ Tool "guard_verify" conflicts with /home/you/.pi/agent/extensions/protect-context/index.ts
132
+ ```
133
+
134
+ One error is reported per tool (`guard_verify`, `guard_note`,
135
+ `guard_contract_check`, `guard_status`), so nothing from the npm copy loads
136
+ until the other copy is gone.
137
+
116
138
  Or copy/symlink the checkout into a trusted extension directory:
117
139
 
118
140
  ```sh
package/package.json CHANGED
@@ -1,9 +1,10 @@
1
1
  {
2
2
  "name": "protect-context",
3
- "version": "1.2.0",
3
+ "version": "1.3.1",
4
4
  "description": "Pi extension that adds agent guardrails: context brief, verification evidence, loop blocking, diff-scope warnings, and a durable journal.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
+ "author": "xjtlumedia <xjtlumedia@gmail.com> (https://github.com/XJTLUmedia)",
7
8
  "keywords": [
8
9
  "pi-package",
9
10
  "pi-extension",
@@ -36,6 +37,7 @@
36
37
  "node": ">=22.19.0"
37
38
  },
38
39
  "scripts": {
40
+ "pretest": "node --input-type=module -e \"import{existsSync,readdirSync}from'node:fs';const d='extension/test';const ok=existsSync(d)&&readdirSync(d).some(f=>f.endsWith('.test.ts'));if(!ok){console.error('pretest: no extension/test/*.test.ts found here. Tests ship only in the repository checkout, not in the npm tarball.');process.exit(1)}\"",
39
41
  "test": "node --experimental-strip-types --test extension/test/*.test.ts",
40
42
  "typecheck": "tsc --noEmit -p extension/tsconfig.json",
41
43
  "check": "npm run typecheck && npm test",