@huseynsnmz/pi-modes 0.1.3 → 0.1.4
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 +7 -0
- package/README.md +4 -4
- package/package.json +2 -2
- package/src/index.ts +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.1.4]
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
|
|
7
|
+
- Fixed a false "Auto has no permission judge" warning when `pi-permission-classifier` loads after `pi-permission-system`, where it only registers during the first prompt.
|
|
8
|
+
- Moved the "could not take control" check to after every extension has had the chance to register.
|
|
9
|
+
|
|
3
10
|
## [0.1.3]
|
|
4
11
|
|
|
5
12
|
### Changed
|
package/README.md
CHANGED
|
@@ -20,7 +20,7 @@ Requires Pi 1.5 or newer.
|
|
|
20
20
|
1. Install it:
|
|
21
21
|
|
|
22
22
|
```bash
|
|
23
|
-
pi install npm:@huseynsnmz/pi-modes@0.1.
|
|
23
|
+
pi install npm:@huseynsnmz/pi-modes@0.1.4
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
2. Move it above `@gotgenes/pi-permission-system`, because `pi install` adds packages last. Otherwise, in `plan` and `read-only` you may be asked to approve an action that is then blocked anyway. It stays blocked either way, and the extension warns you at startup. Skip this step if you don't use that package.
|
|
@@ -39,7 +39,7 @@ Requires Pi 1.5 or newer.
|
|
|
39
39
|
|
|
40
40
|
4. Restart Pi. The footer shows `mode: normal`, and `Shift+Tab` changes the mode.
|
|
41
41
|
|
|
42
|
-
To install from git instead, use `pi install git:github.com/huseynsnmz/pi-modes@v0.1.
|
|
42
|
+
To install from git instead, use `pi install git:github.com/huseynsnmz/pi-modes@v0.1.4`.
|
|
43
43
|
|
|
44
44
|
## Commands
|
|
45
45
|
|
|
@@ -67,7 +67,7 @@ In plan mode the agent calls the `submit_plan` tool. You then choose one of:
|
|
|
67
67
|
|
|
68
68
|
**`@gotgenes/pi-permission-system`:** still runs in every mode. This extension only adds restrictions, so a `deny` rule always wins.
|
|
69
69
|
|
|
70
|
-
**`pi-permission-classifier`:** runs only in `auto`. In every other mode it defers, and the request goes to your normal prompt. Set it up as its README describes, with `permission-judge` in `authorizerChain`. Its `perm-judge:` footer entry stays visible in all modes, so go by the `mode:` entry.
|
|
70
|
+
**`pi-permission-classifier`:** runs only in `auto`. In every other mode it defers, and the request goes to your normal prompt. Set it up as its README describes, with `permission-judge` in `authorizerChain`. Its `perm-judge:` footer entry stays visible in all modes, so go by the `mode:` entry. If the classifier is listed after `pi-permission-system`, it only registers during your first prompt, and `auto` starts working from then on.
|
|
71
71
|
|
|
72
72
|
Without a classifier, `auto` behaves like `normal`, and the extension warns you when you switch to it.
|
|
73
73
|
|
|
@@ -104,7 +104,7 @@ The end-to-end test drives real Pi in a real terminal against a fake model, usin
|
|
|
104
104
|
|
|
105
105
|
```bash
|
|
106
106
|
npm run e2e:solo # only this extension
|
|
107
|
-
npm run e2e # with the five packages it was built for, in
|
|
107
|
+
npm run e2e # with the five packages it was built for, in three load orders
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
`npm run e2e` installs those packages from npm with scripts disabled, then starts them.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huseynsnmz/pi-modes",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "Shift+Tab permission modes for Pi: normal, auto, plan and read-only",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"check": "tsc --noEmit",
|
|
33
33
|
"test": "node --test test/*.test.ts",
|
|
34
34
|
"e2e:solo": "python3 test/e2e/run.py solo",
|
|
35
|
-
"e2e": "python3 test/e2e/run.py modes-first && python3 test/e2e/run.py modes-last"
|
|
35
|
+
"e2e": "python3 test/e2e/run.py modes-first && python3 test/e2e/run.py modes-last && python3 test/e2e/run.py classifier-last"
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@earendil-works/pi-coding-agent": "*",
|
package/src/index.ts
CHANGED
|
@@ -69,7 +69,9 @@ export default function piModes(pi: ExtensionAPI): void {
|
|
|
69
69
|
apply(next, ctx);
|
|
70
70
|
pi.appendEntry(ENTRY_TYPE, { mode: next });
|
|
71
71
|
if (!ctx.hasUI) return;
|
|
72
|
-
|
|
72
|
+
// A judge named in the chain may not have registered yet: some load orders
|
|
73
|
+
// only register it during the first prompt. agent_start checks that case.
|
|
74
|
+
if (next === "auto" && !judgeGated(ctx.sessionManager.getSessionId()) && !chainNamesJudge()) {
|
|
73
75
|
ctx.ui.notify(
|
|
74
76
|
"Auto has no permission judge, so it behaves like normal. Set up pi-permission-classifier to use it.",
|
|
75
77
|
"warning",
|
|
@@ -102,8 +104,10 @@ export default function piModes(pi: ExtensionAPI): void {
|
|
|
102
104
|
clearGate(ctx.sessionManager.getSessionId());
|
|
103
105
|
});
|
|
104
106
|
|
|
105
|
-
|
|
106
|
-
|
|
107
|
+
// Runs after every before_agent_start handler, which is the judge's last chance to register.
|
|
108
|
+
pi.on("agent_start", (_event, ctx) => warnIfJudgeUncontrolled(ctx));
|
|
109
|
+
|
|
110
|
+
pi.on("before_agent_start", (event) => {
|
|
107
111
|
const prompt = modePrompt(mode);
|
|
108
112
|
return prompt ? { systemPrompt: `${event.systemPrompt}\n\n${prompt}` } : undefined;
|
|
109
113
|
});
|