@hank-warren/pi-auto-permissions 0.9.0 → 0.10.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/CHANGELOG.md +8 -0
- package/README.md +6 -4
- package/index.ts +25 -10
- package/openai-codex-transport.ts +9 -0
- package/package.json +2 -2
- package/openai-codex-provider.ts +0 -42
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# @hank-warren/pi-auto-permissions
|
|
2
2
|
|
|
3
|
+
## 0.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 0e9400e: Remove the built-in `openai-codex-auto-permissions` provider. Additional logins are now the job of `@hank-warren/pi-multi-login`, which adopts the existing credential on first run, so an existing `reviewer.provider` config keeps resolving with no edit.
|
|
8
|
+
|
|
9
|
+
Without that package installed the reviewer provider is missing; session start now warns once naming the provider instead of leaving the first guarded command to fail with a bare "review model not found".
|
|
10
|
+
|
|
3
11
|
## 0.9.0
|
|
4
12
|
|
|
5
13
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -116,10 +116,10 @@ Set `enabled` to `false` to disable the extension. Invalid configuration fails c
|
|
|
116
116
|
|
|
117
117
|
By default, the guardian uses Pi's active model with low reasoning effort and a 30-second timeout. You can select a separate low-cost model.
|
|
118
118
|
|
|
119
|
-
|
|
119
|
+
Giving the guardian its own account keeps reviews from competing with your interactive session for a subscription's rate limits. Pi keys OAuth credentials by provider id, so a second login needs a second provider id — which is what [`@hank-warren/pi-multi-login`](../pi-multi-login/README.md) exists to create. This package no longer registers one itself.
|
|
120
120
|
|
|
121
|
-
1.
|
|
122
|
-
2.
|
|
121
|
+
1. `pi install npm:@hank-warren/pi-multi-login`
|
|
122
|
+
2. Run `/multi-login`, add a login with base `openai-codex` and suffix `auto-permissions`, and complete OAuth with the account reserved for guardian reviews.
|
|
123
123
|
3. Select the dedicated provider in the Auto Permissions config:
|
|
124
124
|
|
|
125
125
|
```json
|
|
@@ -133,7 +133,9 @@ For OpenAI Codex, this package registers a second provider named **OpenAI Codex
|
|
|
133
133
|
}
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
The separate credential is stored in Pi's normal `auth.json` under `openai-codex-auto-permissions`; the existing `openai-codex` credential is unchanged. The alias uses Pi's built-in OpenAI Codex OAuth flow, model catalog, and transport. Because it is a normal provider, its models also appear
|
|
136
|
+
The separate credential is stored in Pi's normal `auth.json` under `openai-codex-auto-permissions`; the existing `openai-codex` credential is unchanged. The alias uses Pi's built-in OpenAI Codex OAuth flow, model catalog, and transport. Because it is a normal provider, its models also appear in Pi's model selector and in `/login` after login.
|
|
137
|
+
|
|
138
|
+
If you already used the login this package registered in earlier versions, nothing changes: `pi-multi-login` adopts the existing `openai-codex-auto-permissions` credential on first run, so the config above keeps resolving. Without that package installed, the provider is missing and Auto Permissions warns once per session; point `reviewer.provider` at `openai-codex` (or any signed-in provider) to silence it.
|
|
137
139
|
|
|
138
140
|
Other reviewer providers continue to work by setting their normal provider and model ids.
|
|
139
141
|
|
package/index.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { cleanupSessionResources, type Message } from "@earendil-works/pi-ai";
|
|
2
2
|
import { resolveGuardianCompleteSimple } from "./guardian-transport.js";
|
|
3
|
-
import {
|
|
4
|
-
createAutoPermissionsOpenAICodexProvider,
|
|
5
|
-
isOpenAICodexModel,
|
|
6
|
-
} from "./openai-codex-provider.js";
|
|
3
|
+
import { isOpenAICodexModel } from "./openai-codex-transport.js";
|
|
7
4
|
import { detectSubagentContext } from "./subagent-context.js";
|
|
8
5
|
import * as PiCodingAgent from "@earendil-works/pi-coding-agent";
|
|
9
6
|
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
@@ -272,6 +269,29 @@ export default function autoPermissionsExtension(pi: ExtensionAPI) {
|
|
|
272
269
|
}
|
|
273
270
|
}
|
|
274
271
|
|
|
272
|
+
/**
|
|
273
|
+
* The dedicated `openai-codex-auto-permissions` login used to be registered
|
|
274
|
+
* here. It now belongs to @hank-warren/pi-multi-login, which adopts the
|
|
275
|
+
* existing credential, so an existing reviewer config keeps working — but only
|
|
276
|
+
* if that package is installed. Say so once per session instead of letting the
|
|
277
|
+
* first guarded command fail with a bare "review model not found".
|
|
278
|
+
*/
|
|
279
|
+
function warnAboutMissingReviewerProvider(ctx: ExtensionContext): void {
|
|
280
|
+
let provider: string | undefined;
|
|
281
|
+
try {
|
|
282
|
+
provider = currentConfig(ctx).reviewer?.provider;
|
|
283
|
+
} catch {
|
|
284
|
+
return; // The config error was already reported by currentConfig().
|
|
285
|
+
}
|
|
286
|
+
if (!provider || ctx.modelRegistry.getProvider(provider)) return;
|
|
287
|
+
|
|
288
|
+
const message =
|
|
289
|
+
`reviewer provider "${provider}" is not registered. Install @hank-warren/pi-multi-login to` +
|
|
290
|
+
` provide additional logins such as this one, or point reviewer.provider at a signed-in provider.`;
|
|
291
|
+
console.warn(`[pi-auto-permissions] ${message}`);
|
|
292
|
+
ctx.ui.notify(`Auto Permissions: ${message}`, "warning");
|
|
293
|
+
}
|
|
294
|
+
|
|
275
295
|
async function reviewCommand(
|
|
276
296
|
gate: Gate,
|
|
277
297
|
toolName: string,
|
|
@@ -997,12 +1017,7 @@ export default function autoPermissionsExtension(pi: ExtensionAPI) {
|
|
|
997
1017
|
});
|
|
998
1018
|
|
|
999
1019
|
pi.on("session_start", async (_event, ctx) => {
|
|
1000
|
-
|
|
1001
|
-
if (openaiCodex?.auth.oauth) {
|
|
1002
|
-
pi.registerProvider(createAutoPermissionsOpenAICodexProvider(openaiCodex));
|
|
1003
|
-
} else {
|
|
1004
|
-
console.warn("[pi-auto-permissions] OpenAI Codex OAuth is unavailable; the dedicated Auto Permissions login was not registered.");
|
|
1005
|
-
}
|
|
1020
|
+
warnAboutMissingReviewerProvider(ctx);
|
|
1006
1021
|
|
|
1007
1022
|
reviewerLifecycleController.abort();
|
|
1008
1023
|
discardReviewerLineage();
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codex models are reached over a websocket session rather than plain HTTP, and
|
|
3
|
+
* the guardian has to pick that transport itself. The check is on the model's
|
|
4
|
+
* api rather than its provider id so it keeps working for a reviewer pointed at
|
|
5
|
+
* an aliased Codex login (see @hank-warren/pi-multi-login).
|
|
6
|
+
*/
|
|
7
|
+
export function isOpenAICodexModel(model: { api?: string }): boolean {
|
|
8
|
+
return model.api === "openai-codex-responses";
|
|
9
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hank-warren/pi-auto-permissions",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"description": "Fork of @ogulcancelik/pi-auto-permissions with dialog-answer user evidence: context-aware Bash permissions for Pi with automated guardian review.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"approval-pulse.ts",
|
|
43
43
|
"config.ts",
|
|
44
44
|
"guardian-transport.ts",
|
|
45
|
-
"openai-codex-
|
|
45
|
+
"openai-codex-transport.ts",
|
|
46
46
|
"subagent-context.ts",
|
|
47
47
|
"evaluation-log.ts",
|
|
48
48
|
"gates.ts",
|
package/openai-codex-provider.ts
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import type { Provider } from "@earendil-works/pi-ai";
|
|
2
|
-
|
|
3
|
-
export const AUTO_PERMISSIONS_OPENAI_CODEX_PROVIDER_ID = "openai-codex-auto-permissions";
|
|
4
|
-
export const AUTO_PERMISSIONS_OPENAI_CODEX_PROVIDER_NAME = "OpenAI Codex - Auto Permissions";
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Registering a second provider id gives Pi a second auth.json credential slot.
|
|
8
|
-
* The transport and model catalog still come from Pi's built-in OpenAI Codex
|
|
9
|
-
* provider, so the alias follows the host Pi version instead of duplicating its
|
|
10
|
-
* OAuth or Responses implementation here. The effective catalog is snapshotted
|
|
11
|
-
* when the session starts; the source provider remains the sole owner of any
|
|
12
|
-
* dynamic catalog refresh state.
|
|
13
|
-
*/
|
|
14
|
-
export function createAutoPermissionsOpenAICodexProvider(source: Provider): Provider {
|
|
15
|
-
const models = source.getModels().map((model) => ({
|
|
16
|
-
...model,
|
|
17
|
-
provider: AUTO_PERMISSIONS_OPENAI_CODEX_PROVIDER_ID,
|
|
18
|
-
}));
|
|
19
|
-
const oauth = source.auth.oauth;
|
|
20
|
-
|
|
21
|
-
if (!oauth) {
|
|
22
|
-
throw new Error("Pi's OpenAI Codex provider does not expose OAuth authentication");
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
return {
|
|
26
|
-
...source,
|
|
27
|
-
id: AUTO_PERMISSIONS_OPENAI_CODEX_PROVIDER_ID,
|
|
28
|
-
name: AUTO_PERMISSIONS_OPENAI_CODEX_PROVIDER_NAME,
|
|
29
|
-
auth: {
|
|
30
|
-
oauth: {
|
|
31
|
-
...oauth,
|
|
32
|
-
name: AUTO_PERMISSIONS_OPENAI_CODEX_PROVIDER_NAME,
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
getModels: () => models,
|
|
36
|
-
refreshModels: undefined,
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
export function isOpenAICodexModel(model: { api?: string }): boolean {
|
|
41
|
-
return model.api === "openai-codex-responses";
|
|
42
|
-
}
|