pi-codex-auto-review 0.1.3 → 0.2.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/NOTICE +4 -2
- package/README.ko.md +85 -0
- package/README.md +51 -52
- package/dist/approval-commands.d.ts +3 -3
- package/dist/approval-commands.js +161 -34
- package/dist/approval-commands.js.map +1 -1
- package/dist/approval-settings.d.ts +1 -1
- package/dist/approval-settings.js +17 -10
- package/dist/approval-settings.js.map +1 -1
- package/dist/approvals.d.ts +10 -9
- package/dist/approvals.js +196 -75
- package/dist/approvals.js.map +1 -1
- package/dist/audit.d.ts +1 -1
- package/dist/audit.js +37 -13
- package/dist/audit.js.map +1 -1
- package/dist/cli.js +63 -34
- package/dist/cli.js.map +1 -1
- package/dist/context-files.d.ts +2 -2
- package/dist/context-files.js +40 -19
- package/dist/context-files.js.map +1 -1
- package/dist/contracts.d.ts +39 -39
- package/dist/contracts.js +117 -51
- package/dist/contracts.js.map +1 -1
- package/dist/index.d.ts +9 -9
- package/dist/index.js +147 -43
- package/dist/index.js.map +1 -1
- package/dist/pi-host.js +3 -3
- package/dist/pi-host.js.map +1 -1
- package/dist/policy/domains.js +17 -7
- package/dist/policy/domains.js.map +1 -1
- package/dist/policy/index.d.ts +7 -7
- package/dist/policy/index.js +382 -139
- package/dist/policy/index.js.map +1 -1
- package/dist/policy/paths.js +31 -18
- package/dist/policy/paths.js.map +1 -1
- package/dist/policy/rule-engine.d.ts +2 -0
- package/dist/policy/rule-engine.js +283 -0
- package/dist/policy/rule-engine.js.map +1 -0
- package/dist/policy/rule-types.d.ts +30 -0
- package/dist/policy/rule-types.js +2 -0
- package/dist/policy/rule-types.js.map +1 -0
- package/dist/policy/rules-sync.d.ts +1 -0
- package/dist/policy/rules-sync.js +14 -0
- package/dist/policy/rules-sync.js.map +1 -0
- package/dist/policy/rules-worker.d.ts +1 -0
- package/dist/policy/rules-worker.js +14 -0
- package/dist/policy/rules-worker.js.map +1 -0
- package/dist/policy/rules.d.ts +4 -31
- package/dist/policy/rules.js +126 -38
- package/dist/policy/rules.js.map +1 -1
- package/dist/policy/shell.js +70 -41
- package/dist/policy/shell.js.map +1 -1
- package/dist/policy/starlark/builtins.d.ts +6 -0
- package/dist/policy/starlark/builtins.js +764 -0
- package/dist/policy/starlark/builtins.js.map +1 -0
- package/dist/policy/starlark/evaluator.d.ts +18 -0
- package/dist/policy/starlark/evaluator.js +518 -0
- package/dist/policy/starlark/evaluator.js.map +1 -0
- package/dist/policy/starlark/lexer.d.ts +14 -0
- package/dist/policy/starlark/lexer.js +189 -0
- package/dist/policy/starlark/lexer.js.map +1 -0
- package/dist/policy/starlark/parser.d.ts +140 -0
- package/dist/policy/starlark/parser.js +508 -0
- package/dist/policy/starlark/parser.js.map +1 -0
- package/dist/policy/starlark/validation.d.ts +4 -0
- package/dist/policy/starlark/validation.js +183 -0
- package/dist/policy/starlark/validation.js.map +1 -0
- package/dist/policy/starlark/values.d.ts +46 -0
- package/dist/policy/starlark/values.js +363 -0
- package/dist/policy/starlark/values.js.map +1 -0
- package/dist/reports.d.ts +1 -1
- package/dist/reports.js +66 -30
- package/dist/reports.js.map +1 -1
- package/dist/review/context.d.ts +16 -3
- package/dist/review/context.js +254 -48
- package/dist/review/context.js.map +1 -1
- package/dist/review/investigation.d.ts +2 -2
- package/dist/review/investigation.js +57 -16
- package/dist/review/investigation.js.map +1 -1
- package/dist/review/lifecycle.d.ts +1 -1
- package/dist/review/lifecycle.js +72 -29
- package/dist/review/lifecycle.js.map +1 -1
- package/dist/review/policy.js +27 -5
- package/dist/review/policy.js.map +1 -1
- package/dist/review/upstream-policy.js +1 -1
- package/dist/review/upstream-policy.js.map +1 -1
- package/dist/review/user-input.d.ts +5 -0
- package/dist/review/user-input.js +54 -0
- package/dist/review/user-input.js.map +1 -0
- package/dist/reviewer.d.ts +16 -6
- package/dist/reviewer.js +258 -70
- package/dist/reviewer.js.map +1 -1
- package/dist/signals.js +24 -9
- package/dist/signals.js.map +1 -1
- package/dist/startup.d.ts +4 -4
- package/dist/startup.js +139 -41
- package/dist/startup.js.map +1 -1
- package/dist/tools/controller.d.ts +19 -13
- package/dist/tools/controller.js +460 -118
- package/dist/tools/controller.js.map +1 -1
- package/dist/tools/environment.d.ts +1 -0
- package/dist/tools/environment.js +5 -0
- package/dist/tools/environment.js.map +1 -1
- package/dist/tools/executor.d.ts +1 -1
- package/dist/tools/executor.js +45 -28
- package/dist/tools/executor.js.map +1 -1
- package/dist/tools/external.d.ts +9 -8
- package/dist/tools/external.js +22 -11
- package/dist/tools/external.js.map +1 -1
- package/dist/tools/mcp.d.ts +6 -6
- package/dist/tools/mcp.js +208 -79
- package/dist/tools/mcp.js.map +1 -1
- package/dist/tools/mutation-queue.js.map +1 -1
- package/docs/publishing.ko.md +114 -0
- package/docs/publishing.md +49 -47
- package/docs/security/dependencies.ko.md +54 -0
- package/docs/security/dependencies.md +27 -26
- package/docs/testing/auto-review-protection.ko.md +158 -0
- package/docs/testing/auto-review-protection.md +105 -97
- package/docs/usage.ko.md +242 -0
- package/docs/usage.md +127 -111
- package/package.json +106 -95
- package/dist/native/darwin-arm64/artifact.json +0 -5
- package/dist/native/darwin-arm64/pi-guard-execpolicy +0 -0
- package/dist/native/linux-x64/artifact.json +0 -5
- package/dist/native/linux-x64/pi-guard-execpolicy +0 -0
- package/native/execpolicy/LICENSE +0 -201
- package/native/execpolicy/NOTICE +0 -6
package/docs/usage.md
CHANGED
|
@@ -1,30 +1,32 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Usage
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
**English** | [한국어](usage.ko.md)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
This guide covers registering pi-codex-auto-review as a Pi extension and configuring the CLI, SDK, and policy files.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## Installing from npm
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Install the npm package with Node.js 22.19 or later and Pi 0.99.1 or 1.0.0. Version `0.2.0` distributes the rule engine as JavaScript, replacing the native executables included through `0.1.4`. The extension requires no Rust compiler or platform-specific rule binary; Pi's own native modules are separate.
|
|
10
|
+
|
|
11
|
+
`0.1.4` includes English approval descriptions, `/scoped-models` integration, `/approve retry`, reapproval through ordinary user messages, and fixes for passing and restoring review context. The earlier `0.1.3` removed the sandbox and added the `/approve` and `/approve-model` settings commands.
|
|
10
12
|
|
|
11
13
|
```sh
|
|
12
|
-
pi install npm:pi-codex-auto-review@0.
|
|
14
|
+
pi install npm:pi-codex-auto-review@0.2.0
|
|
13
15
|
pi list
|
|
14
16
|
pi remove npm:pi-codex-auto-review
|
|
15
17
|
```
|
|
16
18
|
|
|
17
|
-
`--local
|
|
19
|
+
Add `--local` to register the package in the current project's `.pi/settings.json`. Project packages load after a trust decision for that project. Specifying a version pins the installation to that version.
|
|
18
20
|
|
|
19
|
-
Pi
|
|
21
|
+
Pi does not install a physical copy of the host SDK for managed extensions. The extension locates the host SDK through Pi's public path API, so no additional SDK copy or symbolic link is needed.
|
|
20
22
|
|
|
21
|
-
|
|
23
|
+
The earlier `Directory metadata scope is too large to qualify safely` error and startup delays came from sandbox directory inspection. The current source removes that execution path and the `@anthropic-ai/sandbox-runtime` dependency.
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
The extension can read the code and dependencies needed to run even inside the default installation directory, `.pi/agent/npm`. Agent settings and credential paths remain protected.
|
|
24
26
|
|
|
25
|
-
##
|
|
27
|
+
## Building from source
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
Source builds use TypeScript and require no Rust compiler or platform binary. Install development dependencies and build from the repository root. The official Pi SDK is installed from the committed npm lockfile; no `vendor` archive is needed. Follow the [publishing guide](publishing.md) to prepare an npm release package.
|
|
28
30
|
|
|
29
31
|
```sh
|
|
30
32
|
npm ci --ignore-scripts
|
|
@@ -32,9 +34,9 @@ npm run build
|
|
|
32
34
|
node dist/cli.js --help
|
|
33
35
|
```
|
|
34
36
|
|
|
35
|
-
## Pi
|
|
37
|
+
## Registering as a Pi plugin
|
|
36
38
|
|
|
37
|
-
|
|
39
|
+
Register the built repository as a local package. Local paths load directly from their location without copying.
|
|
38
40
|
|
|
39
41
|
```sh
|
|
40
42
|
pi install ./pi-codex-auto-review
|
|
@@ -42,9 +44,9 @@ pi list
|
|
|
42
44
|
pi remove ./pi-codex-auto-review
|
|
43
45
|
```
|
|
44
46
|
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
47
|
+
- Registration connects local tools and official MCP tools to the approval path. Pi's default MCP extension is replaced to avoid duplicate connections.
|
|
48
|
+
- Extension registration alone does not guarantee protected startup. Pi can ignore extension loading failures. When approval protection must be ready at startup, use the CLI entry point below or the SDK's `createGuardedRuntime()`.
|
|
49
|
+
- Project instructions, settings, and MCP servers follow Pi's saved project trust decision and global `defaultProjectTrust`. Without a decision, project resources do not start. To explicitly trust the project for this run, use CLI `--trust-project` or SDK `isProjectTrusted: true`.
|
|
48
50
|
|
|
49
51
|
## CLI
|
|
50
52
|
|
|
@@ -55,7 +57,7 @@ node dist/cli.js --mode rpc
|
|
|
55
57
|
node dist/cli.js --mode tui
|
|
56
58
|
```
|
|
57
59
|
|
|
58
|
-
|
|
60
|
+
Specify a registered external provider with `--extension`, and select both `--provider` and `--model`. Run from a shell with `OLLAMA_API_KEY` exported.
|
|
59
61
|
|
|
60
62
|
```sh
|
|
61
63
|
node dist/cli.js \
|
|
@@ -64,19 +66,19 @@ node dist/cli.js \
|
|
|
64
66
|
--mode print "현재 프로젝트를 분석해줘"
|
|
65
67
|
```
|
|
66
68
|
|
|
67
|
-
|
|
|
69
|
+
| Option | Description |
|
|
68
70
|
| --- | --- |
|
|
69
|
-
| `--mode tui\|print\|json\|rpc` |
|
|
70
|
-
| `--cwd
|
|
71
|
-
| `--agent-dir
|
|
72
|
-
| `--policy
|
|
73
|
-
| `--trust-project` |
|
|
74
|
-
| `--extension
|
|
75
|
-
| `--provider
|
|
71
|
+
| `--mode tui\|print\|json\|rpc` | Execution mode; defaults to TUI. Automatic review also works in print and JSON modes |
|
|
72
|
+
| `--cwd path` | Initial working directory |
|
|
73
|
+
| `--agent-dir path` | Pi resource directory. If omitted, uses `PI_CODING_AGENT_DIR`, then Pi's default resource directory |
|
|
74
|
+
| `--policy file` | Absolute path to a user-managed policy JSON file. Invalid settings block startup |
|
|
75
|
+
| `--trust-project` | Explicitly trusts the selected project for this run |
|
|
76
|
+
| `--extension path`, `-e` | Repeatable. Paths are relative to the directory where the command runs. The code directory is trusted and protected from model writes |
|
|
77
|
+
| `--provider provider --model model` | Must be specified together. Startup is rejected if no registered model matches. Do not put keys in command arguments |
|
|
76
78
|
|
|
77
79
|
## SDK
|
|
78
80
|
|
|
79
|
-
|
|
81
|
+
Use `createGuardedRuntime()` from `pi-codex-auto-review/startup` when execution must refuse to start without approval controls. It checks extension and approval controller readiness and applies the same checks to mode reconnection and direct user shell calls.
|
|
80
82
|
|
|
81
83
|
```ts
|
|
82
84
|
import { createGuardedRuntime } from 'pi-codex-auto-review/startup';
|
|
@@ -92,23 +94,27 @@ try {
|
|
|
92
94
|
}
|
|
93
95
|
```
|
|
94
96
|
|
|
95
|
-
|
|
|
97
|
+
| Option | Description |
|
|
96
98
|
| --- | --- |
|
|
97
|
-
| `cwd`, `agentDir` |
|
|
98
|
-
| `settings`
|
|
99
|
-
| `isProjectTrusted` |
|
|
100
|
-
| `model`
|
|
101
|
-
| `trustedExtensionPaths` |
|
|
102
|
-
| `profile` |
|
|
103
|
-
| `mcp: false`, `mcpToolPolicies` | MCP
|
|
99
|
+
| `cwd`, `agentDir` | Initial directory and Pi resource directory |
|
|
100
|
+
| `settings` or `settingsPath` | Execution policy in the same format as the policy file |
|
|
101
|
+
| `isProjectTrusted` | Explicit project trust. If unspecified, follows Pi's trust decision and global `defaultProjectTrust`. Later directory changes follow each directory's saved trust decision |
|
|
102
|
+
| `model` or `modelSelection` | A model object or `{provider, id}` selection. These cannot be used together |
|
|
103
|
+
| `trustedExtensionPaths` | Trusted extension entry files, loaded through Pi's public loader. The entire containing directory is protected from model writes, including relative imports |
|
|
104
|
+
| `profile` | Directly supplies an SDK profile, including `readOnlyPaths`. Required control and authentication path protection also applies |
|
|
105
|
+
| `mcp: false`, `mcpToolPolicies` | Disables MCP connections, or configures `approvalMode` by `server/tool` key |
|
|
106
|
+
|
|
107
|
+
The protected entry point disables automatic extension discovery. Tools outside the known set are blocked unless they have a trusted adapter.
|
|
108
|
+
|
|
109
|
+
## Policy file
|
|
104
110
|
|
|
105
|
-
|
|
111
|
+
Specify a policy with `--policy` or SDK `settings` or `settingsPath`.
|
|
106
112
|
|
|
107
|
-
|
|
113
|
+
A normal Pi installation uses `<agentDir>/guard/settings.json`. Choose **Approve for me** or **Ask for approval** in `/approve`. The screen uses the English descriptions from [Codex's official approval picker](https://learn.chatgpt.com/docs/security-administration) and wraps the selected description on narrow terminals. Command descriptions, selection screens, status text, and fixed approval dialog text are in English.
|
|
108
114
|
|
|
109
|
-
|
|
115
|
+
`/approve-model` shows only available models in Pi's current `/scoped-models` scope. Without a configured scope, it shows all available models, as Pi does. If every scoped model is unavailable, it does not expand to the full list. A model removed from the scope while the picker is open is not saved; existing settings are preserved.
|
|
110
116
|
|
|
111
|
-
|
|
117
|
+
**Use current Pi model** corresponds to `reviewModel: null` and uses the current main model for review instead of a secondary model. Selecting a secondary model does not change the main model. Esc cancels without saving. When `settingsPath` is specified, the menus also save to that file.
|
|
112
118
|
|
|
113
119
|
```json
|
|
114
120
|
{
|
|
@@ -128,90 +134,100 @@ try {
|
|
|
128
134
|
}
|
|
129
135
|
```
|
|
130
136
|
|
|
131
|
-
|
|
|
137
|
+
| Field | Default | Description |
|
|
132
138
|
| --- | --- | --- |
|
|
133
|
-
| `mode` | `workspace-write` | `read-only`
|
|
134
|
-
| `approvalPolicy` | `on-request` | `"on-request"`, `"never"`,
|
|
135
|
-
| `approvalsReviewer` | `auto_review` | `"user"
|
|
136
|
-
| `reviewModel` | `null` |
|
|
137
|
-
| `ruleFiles` | `[]` |
|
|
138
|
-
| `commandRules` | `[]` |
|
|
139
|
-
| `allowedDomains` | `[]` |
|
|
140
|
-
| `trustedTools` | `[]` |
|
|
141
|
-
| `reviewTimeoutMs`, `approvalTimeoutMs`, `executionTimeoutSeconds` | 20000, 60000, 120 |
|
|
142
|
-
| `reviewPolicy`, `reviewMaxRounds`, `reviewMaxOutputTokens`, `reviewContextChars` | `null`, 4, 2048, 60000 |
|
|
143
|
-
| `writableRoots` | `[]` |
|
|
144
|
-
| `excludeSlashTmp`, `excludeTmpdir` | `false` |
|
|
145
|
-
| `projectDocMaxBytes`, `projectDocFallbackFilenames`, `projectRootMarkers` | 32768, `[]`, `null` |
|
|
146
|
-
|
|
147
|
-
##
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
-
|
|
154
|
-
-
|
|
155
|
-
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
-
|
|
165
|
-
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
-
|
|
173
|
-
-
|
|
174
|
-
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
-
|
|
179
|
-
-
|
|
180
|
-
-
|
|
139
|
+
| `mode` | `workspace-write` | `read-only` or `workspace-write` |
|
|
140
|
+
| `approvalPolicy` | `on-request` | `"on-request"`, `"never"`, or `{"sandbox": true, "rules": false, "mcp_elicitations": true}`. The `sandbox` key names the general approval category for compatibility with existing files; it does not mean OS isolation. Omitted `mcp_elicitations` is not allowed. `never` and disabled categories block requests without review |
|
|
141
|
+
| `approvalsReviewer` | `auto_review` | `"user"` selects user review |
|
|
142
|
+
| `reviewModel` | `null` | A registered model to use instead of the current model (`{"provider": "ollama-cloud", "id": "glm-5.3"}`). Register the provider first |
|
|
143
|
+
| `ruleFiles` | `[]` | Paths to the rule files described below |
|
|
144
|
+
| `commandRules` | `[]` | Literal argument prefix rules (`allow`, `ask`, `deny`) |
|
|
145
|
+
| `allowedDomains` | `[]` | Allowed domain patterns |
|
|
146
|
+
| `trustedTools` | `[]` | Additional tool names allowed outside the known set |
|
|
147
|
+
| `reviewTimeoutMs`, `approvalTimeoutMs`, `executionTimeoutSeconds` | 20000, 60000, 120 | Reviewer and approval dialog timeouts are in milliseconds; shell timeout is in seconds |
|
|
148
|
+
| `reviewPolicy`, `reviewMaxRounds`, `reviewMaxOutputTokens`, `reviewContextChars` | `null`, 4, 2048, 60000 | Replaces the reviewer's organization policy section. Risk assessment, source distinction, and outcome criteria remain intact |
|
|
149
|
+
| `writableRoots` | `[]` | Additional writable roots |
|
|
150
|
+
| `excludeSlashTmp`, `excludeTmpdir` | `false` | Excludes the default temporary paths (`/tmp`, `os.tmpdir()`) from allowed writes |
|
|
151
|
+
| `projectDocMaxBytes`, `projectDocFallbackFilenames`, `projectRootMarkers` | 32768, `[]`, `null` | Combined project instruction limit, fallback filenames, and root markers (`null` means `.git`; `[]` disables parent traversal) |
|
|
152
|
+
|
|
153
|
+
## Rule files
|
|
154
|
+
|
|
155
|
+
The TypeScript engine evaluates `.rules` files in `ruleFiles` using contracts ported from Codex revision `a956835d020762cb2b570053af06f643a11c0ecc`. Captured outputs from the former native engine are replayed in the [parity tests](../test/unit/execpolicy-parity.test.mjs).
|
|
156
|
+
|
|
157
|
+
Evaluation exposes only Starlark values and policy functions, with no host file or network functions or JavaScript `eval`. Input/output size, execution steps, collection size, nesting, and evaluation time are bounded. The asynchronous API uses a cancellable Node.js worker; the synchronous API uses a bounded Node.js process. Invalid or unsupported input and exhausted budgets reject the rules. Without rule files, startup needs neither an evaluation worker nor an external executable.
|
|
158
|
+
|
|
159
|
+
- Supports Starlark functions, conditionals, comprehensions, string interpolation, `prefix_rule`, `host_executable`, `network_rule`, and `match` and `not_match` validation.
|
|
160
|
+
- Applies the strongest matching rule to compound commands.
|
|
161
|
+
- As in Codex's network rule conversion, protocol labels are merged into host allow and deny lists rather than separate protocol permissions.
|
|
162
|
+
- Shell syntax that cannot be interpreted requires review unless a trusted full-command rule allows it.
|
|
163
|
+
- `curl` and `wget` require review when the destination is not an explicit HTTP URL or comes from a separate configuration file. Omitting the scheme or supplying the URL through a configuration file does not bypass general approval review.
|
|
164
|
+
- Trusted `allow` rules can broaden permissions for matching commands; limit them to the commands that need them.
|
|
165
|
+
|
|
166
|
+
## Behavior details
|
|
167
|
+
|
|
168
|
+
### Command review and approval
|
|
169
|
+
|
|
170
|
+
- Approved tools run through Pi's original SDK executor. The final shell command, working directory, environment, timeout, and cancellation signal are preserved.
|
|
171
|
+
- File access outside the normal scope, explicit approval requests, review rules, and commands that cannot be interpreted are reviewed before execution.
|
|
172
|
+
- `additional_permissions` describes the scope to review. Approved commands run with host permissions; the scope is not enforced as an OS access restriction. The extension does not intercept network destinations during execution or create a separate proxy.
|
|
173
|
+
- TUI and RPC approval dialogs offer one-time, session, and saved-rule approval. Full-command permissions can be approved only once. Saved approvals bind to the exact tool, input, working directory, invocation path, policy, and permissions. Policy changes invalidate existing approvals.
|
|
174
|
+
- Direct shell commands entered later by the user are evaluated independently even if repeated denials stopped the model's task.
|
|
175
|
+
|
|
176
|
+
### Automatic reviewer
|
|
177
|
+
|
|
178
|
+
- Uses the current model by default; `reviewModel` can select another registered model.
|
|
179
|
+
- Preserves the sources and chronology of accumulated user instructions and instructions supplied by Pi. Tool results are execution evidence. The outer `user` message sent to the review API and user-role messages generated by extensions do not themselves grant authorization.
|
|
180
|
+
- Investigation is limited to read-only file and directory tools.
|
|
181
|
+
- Stops the actual Pi task after three consecutive denials or ten denials in the latest fifty reviews.
|
|
182
|
+
- Errors and timeouts never become approvals. Invalid risk or authorization level responses are also treated as review failures.
|
|
183
|
+
- `/approve` configures the approval method; `/approve-model` selects the secondary model. Changes apply immediately after saving and invalidate pending reviews and saved approvals from the previous policy.
|
|
184
|
+
- After reading a denial reason, the user can authorize the exact operation, target, and content to send in an ordinary message. The next review receives the latest authorization and new facts; no special command is needed. If the user withdraws authorization or requests another target, review is based on the current instructions and actual operation.
|
|
185
|
+
- `/approve retry` lets the user select one exact operation from up to ten recent automatic review denials. Selecting it after checking the target, input, and denial reason triggers one new review of the same operation in the same context. It does not automatically allow the operation or grant session approval. A previous `critical` assessment can be reevaluated, but an operation still assessed as `critical` or subject to an explicit absolute denial remains blocked. The authorization marker does not apply to changed inputs or stale context.
|
|
186
|
+
- A custom `reviewPolicy` replaces only the original organization policy section. Strings such as `{{ extra_policy }}` inside the policy are preserved literally. Risk and authorization criteria are not replaced.
|
|
187
|
+
- Actual model responses must use the structured `outcome` assessment. The existing `decision` interface of a `ReviewProvider` explicitly injected through the SDK remains for compatibility; actual Pi models cannot use that path.
|
|
188
|
+
- Review input includes the current approval policy, path and domain scope, final execution arguments, linked tool calls and results, and the actual approval dialog's questions and answers. Shell environment evidence includes explicit non-secret values and the names of omitted variables; it is not described as the full process environment.
|
|
189
|
+
- Final prepared calls, results, review assessments, and user confirmations are saved in Pi session custom records for extension reloads and active branch restoration. Audit logs still omit raw arguments. Large evidence is limited with omission markers. If user authorization and the full current review target exceed the budget, execution is not automatic.
|
|
190
|
+
- A statement from an ordinary tool that “the user approved” is evidence. Only answers observed by the protected adapter through actual Pi `select`, `confirm`, and `input` APIs are recorded as user confirmations with their questions. Answers to questions marked as password or API key input are masked in the record.
|
|
191
|
+
|
|
192
|
+
### Context files
|
|
193
|
+
|
|
194
|
+
- Automatically discovers global instructions in `agentDir` and project instructions from the project root to the current directory.
|
|
195
|
+
- In each directory, chooses `AGENTS.override.md`, then `AGENTS.md`, then `projectDocFallbackFilenames`.
|
|
196
|
+
- Rejects aliases pointing to protected files and does not treat filenames in tool output as instruction sources. Untrusted projects are excluded. Files are reread on refresh.
|
|
181
197
|
|
|
182
198
|
### MCP
|
|
183
199
|
|
|
184
|
-
-
|
|
185
|
-
-
|
|
186
|
-
-
|
|
187
|
-
- `codex_requires_user_input
|
|
188
|
-
- `node_repl/js`
|
|
200
|
+
- Uses servers registered in Pi, `agentDir/mcp.json`, and trusted projects' `.pi/mcp.json`. Mode reconnection closes existing connections and creates new ones.
|
|
201
|
+
- Final execution approval binds to the server's actual tool registration. Changes to registration during review, or cancellation, prevent execution.
|
|
202
|
+
- The normal path follows Codex's annotation precedence and approval modes regardless of reviewer type. Strict review requests, sensitive operations, and required user input need fresh approval; read-only annotations and previous approvals cannot skip it.
|
|
203
|
+
- The model does not approve `codex_requires_user_input` on the user's behalf. Empty approval forms are handled, but ordinary forms with input fields and URL authentication requests are rejected by this adapter.
|
|
204
|
+
- The same approval rules apply to the `node_repl/js` name. Additional approval requests bind to the original live call's tool, connection, and actual input. Requests naming another tool or connector instead are rejected.
|
|
189
205
|
|
|
190
|
-
###
|
|
206
|
+
### Execution scope
|
|
191
207
|
|
|
192
|
-
-
|
|
193
|
-
-
|
|
194
|
-
-
|
|
208
|
+
- Review input paths are normalized literally, without conversion to separate OS permission patterns.
|
|
209
|
+
- The extension does not exhaustively scan directory trees or hard links at startup or before tool execution.
|
|
210
|
+
- Direct tool paths and protected paths in interpretable commands are rejected before approval. Indirect access inside approved interpreters, hard-link aliases, and network changes during execution are not isolated.
|
|
195
211
|
|
|
196
|
-
##
|
|
212
|
+
## Ollama Cloud verification in Docker
|
|
197
213
|
|
|
198
|
-
###
|
|
214
|
+
### Preparation
|
|
199
215
|
|
|
200
|
-
-
|
|
201
|
-
-
|
|
202
|
-
-
|
|
216
|
+
- Run from the repository root with the Docker engine running. No local Ollama server is installed.
|
|
217
|
+
- The image pins Node 24.14.0, Pi 0.99.1, `pi-ollama-cloud` 0.12.2, and `fd` 10.3.0. It does not mount host directories or sockets or publish ports, and retains Docker's default security restrictions.
|
|
218
|
+
- Only the initial image build requires network access. Verification containers run without a network.
|
|
203
219
|
|
|
204
|
-
###
|
|
220
|
+
### Verification without keys
|
|
205
221
|
|
|
206
222
|
```sh
|
|
207
223
|
npm run verify:docker -- --mode offline --platform linux/amd64
|
|
208
224
|
```
|
|
209
225
|
|
|
210
|
-
ARM Docker
|
|
226
|
+
For a separate ARM64 result on an ARM Docker host, run with `--platform linux/arm64`.
|
|
211
227
|
|
|
212
|
-
###
|
|
228
|
+
### Live model verification
|
|
213
229
|
|
|
214
|
-
|
|
230
|
+
Export `OLLAMA_API_KEY` in the shell that will run verification. Do not put the key in command arguments, image build arguments, or `auth.json`. Actual calls may consume account usage.
|
|
215
231
|
|
|
216
232
|
```sh
|
|
217
233
|
export OLLAMA_MODEL=glm-5.3
|
|
@@ -219,8 +235,8 @@ npm run verify:docker -- --mode live --platform linux/amd64
|
|
|
219
235
|
npm run verify:docker -- --mode conformance --platform linux/amd64
|
|
220
236
|
```
|
|
221
237
|
|
|
222
|
-
- `live
|
|
223
|
-
- `conformance
|
|
224
|
-
-
|
|
225
|
-
-
|
|
226
|
-
-
|
|
238
|
+
- `live` checks external-path writes by the actual main agent and reviewer.
|
|
239
|
+
- `conformance` checks allowed operations, external-path approvals, protected-path blocks, policy denials, and provider selection approval in the distributed CLI.
|
|
240
|
+
- Each case limits model calls, time, and output, and disables automatic provider retries. The observation extension records only call counts and selected models; it does not replace responses. Web tools and usage queries are disabled.
|
|
241
|
+
- Missing keys, unsupported models, service errors, and isolation errors are not treated as success.
|
|
242
|
+
- Supply the output's `imageDigest` through `--image` to reuse an existing image with matching source and architecture. After source changes, rebuild without `--image`.
|
package/package.json
CHANGED
|
@@ -1,98 +1,109 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
2
|
+
"name": "pi-codex-auto-review",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Codex의 ‘Approve for me’에서 영감을 받은 Pi용 자동 실행 승인 검토 확장. 규칙과 Pi의 현재 모델로 도구 실행을 검토하고, 필요한 경우 사용자 승인을 요청합니다.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"keywords": [
|
|
7
|
+
"pi-package",
|
|
8
|
+
"pi-extension",
|
|
9
|
+
"approval",
|
|
10
|
+
"auto-review"
|
|
11
|
+
],
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/buYoung/pi-codex-auto-review.git"
|
|
15
|
+
},
|
|
16
|
+
"homepage": "https://github.com/buYoung/pi-codex-auto-review#readme",
|
|
17
|
+
"bugs": {
|
|
18
|
+
"url": "https://github.com/buYoung/pi-codex-auto-review/issues"
|
|
19
|
+
},
|
|
20
|
+
"publishConfig": {
|
|
21
|
+
"access": "public",
|
|
22
|
+
"registry": "https://registry.npmjs.org/"
|
|
23
|
+
},
|
|
24
|
+
"type": "module",
|
|
25
|
+
"main": "dist/index.js",
|
|
26
|
+
"types": "dist/index.d.ts",
|
|
27
|
+
"exports": {
|
|
28
|
+
".": "./dist/index.js",
|
|
29
|
+
"./startup": "./dist/startup.js"
|
|
30
|
+
},
|
|
31
|
+
"bin": {
|
|
32
|
+
"pi-codex-auto-review": "dist/cli.js"
|
|
33
|
+
},
|
|
34
|
+
"pi": {
|
|
35
|
+
"extensions": [
|
|
36
|
+
"./dist/index.js"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"prepare": "husky",
|
|
41
|
+
"check": "biome check .",
|
|
42
|
+
"check:fix": "biome check --write .",
|
|
43
|
+
"check:staged": "lint-staged",
|
|
44
|
+
"release": "node scripts/release.mjs",
|
|
45
|
+
"build": "node scripts/clean-build.mjs && tsc",
|
|
46
|
+
"prepack": "node scripts/clean-build.mjs && tsc && node scripts/check-package.mjs",
|
|
47
|
+
"test:contracts": "node scripts/run-tests.mjs contracts",
|
|
48
|
+
"test:policy": "node scripts/run-tests.mjs policy",
|
|
49
|
+
"test:reviewer": "node scripts/run-tests.mjs reviewer",
|
|
50
|
+
"test:approvals": "node scripts/run-tests.mjs approvals",
|
|
51
|
+
"test:execution": "node scripts/run-tests.mjs execution",
|
|
52
|
+
"test:integration": "node scripts/run-tests.mjs integration",
|
|
53
|
+
"test:e2e": "node scripts/run-tests.mjs e2e",
|
|
54
|
+
"test:conformance": "node scripts/run-tests.mjs conformance",
|
|
55
|
+
"verify:guard": "node scripts/verify-guard.mjs",
|
|
56
|
+
"verify:platform": "node scripts/verify-platform.mjs",
|
|
57
|
+
"verify:windows": "node scripts/verify-windows.mjs",
|
|
58
|
+
"verify:docker": "node scripts/verify-docker.mjs"
|
|
59
|
+
},
|
|
60
|
+
"lint-staged": {
|
|
61
|
+
"*": "biome check --no-errors-on-unmatched --files-ignore-unknown=true"
|
|
62
|
+
},
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"@earendil-works/pi-ai": ">=0.86.1",
|
|
65
|
+
"@earendil-works/pi-coding-agent": ">=0.86.1",
|
|
66
|
+
"@earendil-works/pi-tui": ">=0.86.1"
|
|
67
|
+
},
|
|
68
|
+
"devDependencies": {
|
|
69
|
+
"@biomejs/biome": "2.5.15",
|
|
70
|
+
"@earendil-works/pi-ai": "0.99.1",
|
|
71
|
+
"@earendil-works/pi-coding-agent": "0.99.1",
|
|
72
|
+
"@earendil-works/pi-tui": "0.99.1",
|
|
73
|
+
"@inquirer/prompts": "8.5.2",
|
|
74
|
+
"@sinclair/typebox": "0.34.52",
|
|
75
|
+
"@types/node": "24.0.0",
|
|
76
|
+
"husky": "9.1.7",
|
|
77
|
+
"lint-staged": "16.4.0",
|
|
78
|
+
"pi-ollama-cloud": "0.12.2",
|
|
79
|
+
"release-it": "21.0.1",
|
|
80
|
+
"semver": "7.8.5",
|
|
81
|
+
"typescript": "6.0.3"
|
|
82
|
+
},
|
|
83
|
+
"overrides": {
|
|
84
|
+
"@earendil-works/pi-ai": "0.99.1",
|
|
85
|
+
"@earendil-works/pi-agent-core": "0.99.1",
|
|
86
|
+
"@earendil-works/pi-tui": "0.99.1",
|
|
87
|
+
"brace-expansion": "5.0.12"
|
|
88
|
+
},
|
|
89
|
+
"engines": {
|
|
90
|
+
"node": ">=22.19.0"
|
|
91
|
+
},
|
|
92
|
+
"files": [
|
|
93
|
+
"dist/**/*.js",
|
|
94
|
+
"dist/**/*.d.ts",
|
|
95
|
+
"dist/**/*.js.map",
|
|
96
|
+
"README.md",
|
|
97
|
+
"README.ko.md",
|
|
98
|
+
"LICENSE",
|
|
99
|
+
"NOTICE",
|
|
100
|
+
"docs/usage.md",
|
|
101
|
+
"docs/usage.ko.md",
|
|
102
|
+
"docs/publishing.md",
|
|
103
|
+
"docs/publishing.ko.md",
|
|
104
|
+
"docs/security/dependencies.md",
|
|
105
|
+
"docs/security/dependencies.ko.md",
|
|
106
|
+
"docs/testing/auto-review-protection.md",
|
|
107
|
+
"docs/testing/auto-review-protection.ko.md"
|
|
37
108
|
]
|
|
38
|
-
},
|
|
39
|
-
"scripts": {
|
|
40
|
-
"release": "node scripts/release.mjs",
|
|
41
|
-
"build": "node scripts/clean-build.mjs && tsc && node scripts/build-execpolicy.mjs",
|
|
42
|
-
"prepack": "node scripts/clean-build.mjs && tsc && node scripts/check-package.mjs",
|
|
43
|
-
"test:contracts": "node scripts/run-tests.mjs contracts",
|
|
44
|
-
"test:policy": "node scripts/run-tests.mjs policy",
|
|
45
|
-
"test:reviewer": "node scripts/run-tests.mjs reviewer",
|
|
46
|
-
"test:approvals": "node scripts/run-tests.mjs approvals",
|
|
47
|
-
"test:execution": "node scripts/run-tests.mjs execution",
|
|
48
|
-
"test:integration": "node scripts/run-tests.mjs integration",
|
|
49
|
-
"test:e2e": "node scripts/run-tests.mjs e2e",
|
|
50
|
-
"test:conformance": "node scripts/run-tests.mjs conformance",
|
|
51
|
-
"verify:guard": "node scripts/verify-guard.mjs",
|
|
52
|
-
"verify:platform": "node scripts/verify-platform.mjs",
|
|
53
|
-
"verify:windows": "node scripts/verify-windows.mjs",
|
|
54
|
-
"verify:docker": "node scripts/verify-docker.mjs"
|
|
55
|
-
},
|
|
56
|
-
"peerDependencies": {
|
|
57
|
-
"@earendil-works/pi-ai": ">=0.86.1",
|
|
58
|
-
"@earendil-works/pi-coding-agent": ">=0.86.1",
|
|
59
|
-
"@earendil-works/pi-tui": ">=0.86.1"
|
|
60
|
-
},
|
|
61
|
-
"devDependencies": {
|
|
62
|
-
"@earendil-works/pi-ai": "0.99.1",
|
|
63
|
-
"@earendil-works/pi-coding-agent": "file:vendor/pi-coding-agent-0.99.1-security.1.tgz",
|
|
64
|
-
"@earendil-works/pi-tui": "0.99.1",
|
|
65
|
-
"@inquirer/prompts": "8.5.2",
|
|
66
|
-
"@sinclair/typebox": "0.34.52",
|
|
67
|
-
"@types/node": "24.0.0",
|
|
68
|
-
"pi-ollama-cloud": "0.12.2",
|
|
69
|
-
"release-it": "21.0.1",
|
|
70
|
-
"semver": "7.8.5",
|
|
71
|
-
"typescript": "6.0.3"
|
|
72
|
-
},
|
|
73
|
-
"overrides": {
|
|
74
|
-
"@earendil-works/pi-ai": "0.99.1",
|
|
75
|
-
"@earendil-works/pi-agent-core": "0.99.1",
|
|
76
|
-
"@earendil-works/pi-tui": "0.99.1",
|
|
77
|
-
"brace-expansion": "5.0.12"
|
|
78
|
-
},
|
|
79
|
-
"engines": {
|
|
80
|
-
"node": ">=22.19.0"
|
|
81
|
-
},
|
|
82
|
-
"files": [
|
|
83
|
-
"dist/**/*.js",
|
|
84
|
-
"dist/**/*.d.ts",
|
|
85
|
-
"dist/**/*.js.map",
|
|
86
|
-
"dist/native/*/pi-guard-execpolicy*",
|
|
87
|
-
"dist/native/*/artifact.json",
|
|
88
|
-
"README.md",
|
|
89
|
-
"LICENSE",
|
|
90
|
-
"NOTICE",
|
|
91
|
-
"docs/usage.md",
|
|
92
|
-
"docs/publishing.md",
|
|
93
|
-
"docs/security/dependencies.md",
|
|
94
|
-
"docs/testing/auto-review-protection.md",
|
|
95
|
-
"native/execpolicy/LICENSE",
|
|
96
|
-
"native/execpolicy/NOTICE"
|
|
97
|
-
]
|
|
98
109
|
}
|
|
Binary file
|
|
Binary file
|