pi-permission-classifier 0.5.0 → 0.5.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
@@ -5,6 +5,26 @@ format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
5
5
  this project adheres to
6
6
  [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.5.2] - 2026-09-25
9
+
10
+ ### Fixed
11
+
12
+ - A provider error from the judge model (for example an HTTP 429 or 503)
13
+ now defers with reason `call-failed` instead of `no-tool-call`. The
14
+ circuit breaker counts it, so repeated errors open the breaker instead
15
+ of calling the failing API on every ask. The provider's error text is
16
+ written to the `classifier.model_reply` debug entry.
17
+
18
+ ## [0.5.1] - 2026-09-19
19
+
20
+ ### Changed
21
+
22
+ - README setup installs the package from npm with
23
+ `pi install npm:pi-permission-classifier` and tells you to check that
24
+ the classifier is listed before `pi-permission-system` in `packages`.
25
+ A local checkout is still an option.
26
+ - The npm page links to the GitHub repository, README, and issue tracker.
27
+
8
28
  ## [0.5.0] - 2026-09-19
9
29
 
10
30
  ### Added
package/README.md CHANGED
@@ -36,20 +36,22 @@ defer. More prompting, never less.
36
36
  Everything below is an operator action - the package never enables itself,
37
37
  and installing it grants it no authority until you name it in the chain.
38
38
 
39
- 1. Get the package and install its dependencies:
39
+ 1. Install the package from npm:
40
40
 
41
- git clone <this repo> ~/pi-permission-classifier
42
- cd ~/pi-permission-classifier
43
- npm install
41
+ pi install npm:pi-permission-classifier
44
42
 
45
- 2. Register the package with pi. In `~/.pi/agent/settings.json`, add the
46
- package directory to the `packages` list (path relative to
47
- `~/.pi/agent`, or absolute). List `pi-permission-classifier` before
43
+ pi installs it under `~/.pi/agent/npm/` and adds
44
+ `npm:pi-permission-classifier` to the `packages` list in
45
+ `~/.pi/agent/settings.json`.
46
+
47
+ 2. Check the package order. `pi install` adds the new entry at the end of
48
+ `packages`, so it can land after `pi-permission-system`. Edit
49
+ `~/.pi/agent/settings.json` if needed. List `pi-permission-classifier` before
48
50
  `pi-permission-system` in `packages`:
49
51
 
50
52
  "packages": [
51
- "../../pi-permission-classifier",
52
- "<path to pi-permission-system>"
53
+ "npm:pi-permission-classifier",
54
+ "npm:@gotgenes/pi-permission-system"
53
55
  ]
54
56
 
55
57
  Order matters: pi runs `session_start` handlers in package order, and
@@ -61,6 +63,10 @@ and installing it grants it no authority until you name it in the chain.
61
63
  first agent turn (asks are still reviewed, since they happen inside
62
64
  agent turns).
63
65
 
66
+ To run from a local checkout instead, clone the repository, run
67
+ `npm install` in it, and put its directory in `packages` (path relative
68
+ to `~/.pi/agent`, or absolute), in the same position.
69
+
64
70
  3. Activate the chain link. In
65
71
  `~/.pi/agent/extensions/pi-permission-system/config.json`, add:
66
72
 
package/package.json CHANGED
@@ -1,9 +1,17 @@
1
1
  {
2
2
  "name": "pi-permission-classifier",
3
- "version": "0.5.0",
3
+ "version": "0.5.2",
4
4
  "description": "Auto-classifier Authorizer chain link for pi-permission-system: a light model reviews each ask and returns allow, deny, or defer",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/TacoTakumi/pi-permission-classifier.git"
10
+ },
11
+ "homepage": "https://github.com/TacoTakumi/pi-permission-classifier#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/TacoTakumi/pi-permission-classifier/issues"
14
+ },
7
15
  "files": [
8
16
  "src",
9
17
  "config/config.example.json",
@@ -130,8 +130,8 @@ export type ModelCallDeferReason =
130
130
  * The full result of a model review: the verdict plus the observability the
131
131
  * decision trail records. `deferReason` is set iff the verdict is `defer`;
132
132
  * `rawReply` carries the tool-call arguments as JSON when a tool call arrived,
133
- * or the assistant text on a `no-tool-call` defer (absent on a timeout/throw
134
- * before any reply).
133
+ * the assistant text on a `no-tool-call` defer, or the provider error text on
134
+ * a `call-failed` error reply (absent on a timeout/throw before any reply).
135
135
  */
136
136
  export interface ReviewOutcome {
137
137
  verdict: AuthorizerVerdict;
@@ -185,6 +185,17 @@ export async function reviewAsk(inputs: ReviewAskInputs): Promise<ReviewOutcome>
185
185
  latencyMs: Date.now() - startedAt,
186
186
  };
187
187
  }
188
+ // pi-ai also resolves (not rejects) on a provider error such as an
189
+ // HTTP 429 or 503: the reply has no content and carries the error text.
190
+ // Report it as `call-failed` so the breaker counts it.
191
+ if (reply.stopReason === "error") {
192
+ return {
193
+ verdict: { kind: "defer" },
194
+ deferReason: "call-failed",
195
+ latencyMs: Date.now() - startedAt,
196
+ rawReply: reply.errorMessage,
197
+ };
198
+ }
188
199
  return readToolCallOutcome(reply, Date.now() - startedAt);
189
200
  } catch {
190
201
  return {