@erichll/pi-auto-review 0.1.2 → 0.3.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/README.md +13 -14
- package/package.json +2 -2
- package/src/broker/types.ts +1 -1
- package/src/index.ts +6 -6
- package/src/integrations/{landstrip.ts → sandbox.ts} +15 -17
- package/src/policy.ts +1 -1
package/README.md
CHANGED
|
@@ -114,8 +114,8 @@ import {
|
|
|
114
114
|
} from "@erichll/pi-auto-review";
|
|
115
115
|
|
|
116
116
|
const request: BoundaryRequest = {
|
|
117
|
-
id: "
|
|
118
|
-
source: "
|
|
117
|
+
id: "sandbox-runtime-query-id",
|
|
118
|
+
source: "sandbox-runtime",
|
|
119
119
|
surface: "network",
|
|
120
120
|
operation: "connect",
|
|
121
121
|
cwd: "/workspace/project",
|
|
@@ -158,7 +158,7 @@ may additionally receive only these bounded result classes:
|
|
|
158
158
|
a pending deletion target.
|
|
159
159
|
- `git remote`, branch, status, revision, and remote configuration results for
|
|
160
160
|
a pending Git push.
|
|
161
|
-
- The current structured
|
|
161
|
+
- The current structured Sandbox Runtime trap.
|
|
162
162
|
|
|
163
163
|
Unrelated tool results and assistant prose remain excluded. Selected results
|
|
164
164
|
have a separate `maxRelevantResultTokens` budget, common secret/token forms are
|
|
@@ -166,19 +166,18 @@ redacted, and markup characters are escaped before the evidence is sent to the
|
|
|
166
166
|
reviewer. Results remain explicitly labeled as untrusted and possibly
|
|
167
167
|
incomplete.
|
|
168
168
|
|
|
169
|
-
##
|
|
169
|
+
## Sandbox adapter status
|
|
170
170
|
|
|
171
171
|
The broker-facing contract is implemented, but this package does not intercept
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
This monorepo
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
x64/arm64 hosts. Do not load `pi-sandbox` and `pi-landstrip` together.
|
|
172
|
+
OS sandbox events by itself. Adapters translate a concrete boundary into a
|
|
173
|
+
`BoundaryRequest` and must consume the exact grant before allowing the
|
|
174
|
+
operation.
|
|
175
|
+
|
|
176
|
+
This monorepo's `pi-sandbox` uses Anthropic Sandbox Runtime. Filesystem policy
|
|
177
|
+
is static and fails closed; unmatched public network destinations use the
|
|
178
|
+
broker for per-connection approval. Each Bash command or built-in subagent
|
|
179
|
+
session owns an independent Sandbox Runtime broker process. Adapters should use
|
|
180
|
+
the `./sandbox` export.
|
|
182
181
|
|
|
183
182
|
Do not implement the adapter by writing broad permanent rules to
|
|
184
183
|
`.pi/sandbox.json`.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@erichll/pi-auto-review",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Model-backed boundary approval broker for Pi",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"exports": {
|
|
36
36
|
".": "./src/index.ts",
|
|
37
37
|
"./broker": "./src/broker/index.ts",
|
|
38
|
-
"./
|
|
38
|
+
"./sandbox": "./src/integrations/sandbox.ts"
|
|
39
39
|
},
|
|
40
40
|
"pi": {
|
|
41
41
|
"extensions": [
|
package/src/broker/types.ts
CHANGED
package/src/index.ts
CHANGED
|
@@ -38,12 +38,12 @@ import { PermissionUiAutoConfirmer } from "./ui-auto-confirm.ts";
|
|
|
38
38
|
export { parseDecision } from "./policy.ts";
|
|
39
39
|
export * from "./broker/index.ts";
|
|
40
40
|
export {
|
|
41
|
-
|
|
42
|
-
type
|
|
43
|
-
type
|
|
44
|
-
type
|
|
45
|
-
type
|
|
46
|
-
} from "./integrations/
|
|
41
|
+
sandboxTrapToBoundaryRequest,
|
|
42
|
+
type SandboxBoundaryTrap,
|
|
43
|
+
type SandboxFilesystemTrap,
|
|
44
|
+
type SandboxNetworkTrap,
|
|
45
|
+
type SandboxRequestContext,
|
|
46
|
+
} from "./integrations/sandbox.ts";
|
|
47
47
|
|
|
48
48
|
type ReasoningLevel =
|
|
49
49
|
| "off"
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import type { BoundaryRequest } from "../broker/types.ts";
|
|
2
2
|
|
|
3
|
-
export type
|
|
3
|
+
export type SandboxFilesystemTrap = {
|
|
4
4
|
kind: "filesystem";
|
|
5
|
-
code: "FILESYSTEM_DENIED";
|
|
6
|
-
query_id?: string;
|
|
7
5
|
operation: "read" | "write";
|
|
8
6
|
path: string;
|
|
9
7
|
requested_path?: string;
|
|
10
8
|
reason?: string;
|
|
9
|
+
query_id?: string;
|
|
11
10
|
process?: {
|
|
12
11
|
pid?: number;
|
|
13
12
|
exe?: string | null;
|
|
@@ -15,12 +14,11 @@ export type LandstripFilesystemTrap = {
|
|
|
15
14
|
};
|
|
16
15
|
};
|
|
17
16
|
|
|
18
|
-
export type
|
|
17
|
+
export type SandboxNetworkTrap = {
|
|
19
18
|
kind: "network";
|
|
20
|
-
code: "NETWORK_DENIED";
|
|
21
|
-
query_id?: string;
|
|
22
19
|
operation: "connect" | "bind";
|
|
23
20
|
target: string;
|
|
21
|
+
query_id?: string;
|
|
24
22
|
process?: {
|
|
25
23
|
pid?: number;
|
|
26
24
|
exe?: string | null;
|
|
@@ -28,29 +26,29 @@ export type LandstripNetworkTrap = {
|
|
|
28
26
|
};
|
|
29
27
|
};
|
|
30
28
|
|
|
31
|
-
export type
|
|
32
|
-
|
|
|
33
|
-
|
|
|
29
|
+
export type SandboxBoundaryTrap =
|
|
30
|
+
| SandboxFilesystemTrap
|
|
31
|
+
| SandboxNetworkTrap;
|
|
34
32
|
|
|
35
|
-
export type
|
|
33
|
+
export type SandboxRequestContext = {
|
|
36
34
|
command?: string;
|
|
37
35
|
cwd: string;
|
|
38
36
|
agentName?: string;
|
|
39
37
|
};
|
|
40
38
|
|
|
41
|
-
export function
|
|
42
|
-
trap:
|
|
43
|
-
context:
|
|
39
|
+
export function sandboxTrapToBoundaryRequest(
|
|
40
|
+
trap: SandboxBoundaryTrap,
|
|
41
|
+
context: SandboxRequestContext,
|
|
44
42
|
): BoundaryRequest {
|
|
45
43
|
const processSuffix =
|
|
46
44
|
trap.process?.pid === undefined ? "" : `:${trap.process.pid}`;
|
|
47
45
|
const id = trap.query_id
|
|
48
|
-
? `
|
|
49
|
-
: `
|
|
46
|
+
? `sandbox-runtime:${trap.query_id}`
|
|
47
|
+
: `sandbox-runtime:${trap.kind}:${trap.operation}${processSuffix}`;
|
|
50
48
|
if (trap.kind === "filesystem") {
|
|
51
49
|
return {
|
|
52
50
|
id,
|
|
53
|
-
source: "
|
|
51
|
+
source: "sandbox-runtime",
|
|
54
52
|
surface:
|
|
55
53
|
trap.operation === "read"
|
|
56
54
|
? "filesystem-read"
|
|
@@ -70,7 +68,7 @@ export function landstripTrapToBoundaryRequest(
|
|
|
70
68
|
}
|
|
71
69
|
return {
|
|
72
70
|
id,
|
|
73
|
-
source: "
|
|
71
|
+
source: "sandbox-runtime",
|
|
74
72
|
surface: "network",
|
|
75
73
|
operation: trap.operation,
|
|
76
74
|
cwd: trap.process?.cwd || context.cwd,
|
package/src/policy.ts
CHANGED
|
@@ -582,7 +582,7 @@ function relevantResultEvidence(
|
|
|
582
582
|
function sandboxTrapEvidence(
|
|
583
583
|
request: RelevantBoundaryRequest,
|
|
584
584
|
): string | undefined {
|
|
585
|
-
if (request.source !== "
|
|
585
|
+
if (request.source !== "sandbox-runtime") return;
|
|
586
586
|
return `<sandbox-trap>
|
|
587
587
|
${boundedString({
|
|
588
588
|
surface: request.surface,
|