pi-permission-system-lean 0.0.0-stage → 42.0.0
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/LICENSE +21 -0
- package/README.md +43 -2
- package/index.ts +47 -0
- package/package.json +41 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 MasuRii and Christopher D. Lasher
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,44 @@
|
|
|
1
|
-
#
|
|
1
|
+
# pi-permission-system-lean
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Based on [`@gotgenes/pi-permission-system`](https://github.com/gotgenes/pi-packages/tree/main/packages/pi-permission-system) by [Chris Lasher](https://github.com/gotgenes), MIT-licensed (see LICENSE). Upstream is pinned to `42.0.0`.
|
|
4
|
+
|
|
5
|
+
A description-only lean wrapper: upstream registers one slash command and **zero tools**, so there are no tool schemas to trim. This package re-registers the same command with a shorter description; the name, handler, events, and the whole permission-enforcement engine (per-turn tool hiding, allow/ask/deny gates, subagent forwarding) run the original upstream code untouched.
|
|
6
|
+
|
|
7
|
+
## Token numbers
|
|
8
|
+
|
|
9
|
+
Model-facing startup text is just the one command description (no tools, no parameter schemas, no system-prompt additions). Tokens estimated as `ceil(characters / 4)`:
|
|
10
|
+
|
|
11
|
+
| Command | Upstream | Lean |
|
|
12
|
+
| --- | --- | --- |
|
|
13
|
+
| `/permission-system` | Configure pi-permission-system logging and yolo-mode behavior (61) | Permission-system logging and yolo mode (39) |
|
|
14
|
+
| **Total** | **61 chars → 16 tokens** | **39 chars → 10 tokens** |
|
|
15
|
+
|
|
16
|
+
Saves **6 tokens (37.5% fewer)**. Absolute saving is small because upstream's only model-facing surface is a single description — see MAINTENANCE.md. The real token win of this extension is dynamic: fully-denied tools stay hidden from the model every turn.
|
|
17
|
+
|
|
18
|
+
## Installation
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pi install npm:pi-permission-system-lean
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Do not load this alongside upstream `@gotgenes/pi-permission-system`; both register the same command name.
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
Same command as upstream: `/permission-system` (configure logging and yolo mode, or `show`/`path`/`reset`/`help`). Behavior is identical — only the `/help` description is shorter.
|
|
29
|
+
|
|
30
|
+
## Versions
|
|
31
|
+
|
|
32
|
+
- Lean wrapper: `42.0.0`
|
|
33
|
+
- Upstream dependency is pinned to `@gotgenes/pi-permission-system@42.0.0`.
|
|
34
|
+
|
|
35
|
+
## Development
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install
|
|
39
|
+
npm run check
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## License
|
|
43
|
+
|
|
44
|
+
MIT. This project wraps the MIT-licensed [`@gotgenes/pi-permission-system`](https://github.com/gotgenes/pi-packages/tree/main/packages/pi-permission-system) by Chris Lasher.
|
package/index.ts
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// pi-permission-system-lean — description-only facade over @gotgenes/pi-permission-system.
|
|
2
|
+
//
|
|
3
|
+
// Upstream 42.0.0 registers one slash command and zero tools, so there are no
|
|
4
|
+
// tool schemas to trim. The whole saving is in the command description:
|
|
5
|
+
// 61 chars upstream vs 39 here. The command name, handler, event
|
|
6
|
+
// subscriptions, and the entire permission-enforcement engine (per-turn tool
|
|
7
|
+
// hiding, allow/ask/deny gates, subagent forwarding, service publication) run
|
|
8
|
+
// the original upstream code untouched.
|
|
9
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
10
|
+
// The upstream package's exports map only exposes "." (the cross-extension
|
|
11
|
+
// service surface), so the extension entry point is unreachable by package
|
|
12
|
+
// subpath. Reach it by file path instead: every lean package installs its own
|
|
13
|
+
// dependencies in its own node_modules (no workspaces), which keeps this
|
|
14
|
+
// relative import stable.
|
|
15
|
+
import upstreamActivate from "./node_modules/@gotgenes/pi-permission-system/src/index.ts";
|
|
16
|
+
|
|
17
|
+
const UPSTREAM_VERSION = "42.0.0";
|
|
18
|
+
|
|
19
|
+
type RegisterCommandOptions = Parameters<ExtensionAPI["registerCommand"]>[1];
|
|
20
|
+
|
|
21
|
+
// Trimmed per the lean rules: say each thing once. Keeps the nouns that say
|
|
22
|
+
// what the command configures (permission-system logging, yolo mode); drops
|
|
23
|
+
// the verb, the package-name prefix, and the generic "behavior".
|
|
24
|
+
export const LEAN_DESCRIPTIONS: Record<string, string> = {
|
|
25
|
+
"permission-system": "Permission-system logging and yolo mode",
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
function capturePi(pi: ExtensionAPI): ExtensionAPI {
|
|
29
|
+
return new Proxy(pi, {
|
|
30
|
+
get(target, prop, receiver) {
|
|
31
|
+
if (prop === "registerCommand") {
|
|
32
|
+
return (name: string, options: RegisterCommandOptions) => {
|
|
33
|
+
const description = LEAN_DESCRIPTIONS[name] ?? options.description;
|
|
34
|
+
target.registerCommand(name, { ...options, description });
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
const value = Reflect.get(target, prop, receiver);
|
|
38
|
+
return typeof value === "function" ? value.bind(target) : value;
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export default function leanActivate(pi: ExtensionAPI): void {
|
|
44
|
+
upstreamActivate(capturePi(pi));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export { UPSTREAM_VERSION };
|
package/package.json
CHANGED
|
@@ -1,6 +1,43 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pi-permission-system-lean",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "42.0.0",
|
|
4
|
+
"description": "Lean wrapper of @gotgenes/pi-permission-system: same permission-system command with trimmed startup description.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "index.ts",
|
|
8
|
+
"homepage": "https://github.com/loxoron218/my-lean-pi-setup/tree/main/packages/pi-permission-system-lean",
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/loxoron218/my-lean-pi-setup.git",
|
|
12
|
+
"directory": "packages/pi-permission-system-lean"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"index.ts",
|
|
16
|
+
"README.md",
|
|
17
|
+
"LICENSE"
|
|
18
|
+
],
|
|
19
|
+
"scripts": {
|
|
20
|
+
"test": "node --test tests/*.test.mjs",
|
|
21
|
+
"typecheck": "tsc -p tsconfig.json",
|
|
22
|
+
"check": "npm run typecheck && npm test"
|
|
23
|
+
},
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@gotgenes/pi-permission-system": "42.0.0"
|
|
26
|
+
},
|
|
27
|
+
"peerDependencies": {
|
|
28
|
+
"@earendil-works/pi-coding-agent": "*",
|
|
29
|
+
"@earendil-works/pi-tui": "*"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@earendil-works/pi-coding-agent": "1.4.0",
|
|
33
|
+
"@earendil-works/pi-tui": "1.4.0",
|
|
34
|
+
"@types/node": "24.10.1",
|
|
35
|
+
"jiti": "2.6.1",
|
|
36
|
+
"typescript": "5.9.3"
|
|
37
|
+
},
|
|
38
|
+
"pi": {
|
|
39
|
+
"extensions": [
|
|
40
|
+
"./index.ts"
|
|
41
|
+
]
|
|
42
|
+
}
|
|
43
|
+
}
|