mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-10-26 10:45:22 +00:00
refactor(permission-system): simplify policy and autoreview flow
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
||||
import { getAgentDir, getPackageDir } from "@earendil-works/pi-coding-agent";
|
||||
import { getAgentDir } from "@earendil-works/pi-coding-agent";
|
||||
import { warmBashParser } from "./access-intent/bash/parser";
|
||||
import { buildResolvedIntentFromMatchValues } from "./access-intent/input-normalizer";
|
||||
import { AuthorizerRegistry } from "./authority/authorizer-registry";
|
||||
@@ -57,9 +57,7 @@ import { ToolInputFormatterRegistry } from "./tool-input-formatter-registry";
|
||||
|
||||
export default function piPermissionSystemExtension(pi: ExtensionAPI): void {
|
||||
const agentDir = getAgentDir();
|
||||
// getPackageDir() is Pi's own install dir; auto-allow it for read-only tools
|
||||
// so the agent can read Pi's bundled docs/examples regardless of layout.
|
||||
const paths = computeExtensionPaths(agentDir, getPackageDir());
|
||||
const paths = computeExtensionPaths(agentDir);
|
||||
// The single process.platform read for the whole extension, resolved once
|
||||
// into the path-language flavor that every consumer shares (the session's
|
||||
// PathNormalizer, rule evaluation, and subagent detection). Interior modules
|
||||
@@ -273,8 +271,6 @@ export default function piPermissionSystemExtension(pi: ExtensionAPI): void {
|
||||
|
||||
const toolRegistry = {
|
||||
getAll: () => pi.getAllTools(),
|
||||
getActive: () => pi.getActiveTools(),
|
||||
setActive: (names: string[]) => pi.setActiveTools(names),
|
||||
};
|
||||
|
||||
const audit = new DecisionAudit();
|
||||
@@ -285,14 +281,9 @@ export default function piPermissionSystemExtension(pi: ExtensionAPI): void {
|
||||
logger,
|
||||
audit,
|
||||
);
|
||||
const agentPrep = new AgentPrepHandler(
|
||||
session,
|
||||
resolver,
|
||||
toolRegistry,
|
||||
() => {
|
||||
void warmBashParser();
|
||||
},
|
||||
);
|
||||
const agentPrep = new AgentPrepHandler(session, resolver, () => {
|
||||
void warmBashParser();
|
||||
});
|
||||
|
||||
const reporter = new GateDecisionReporter(logger, pi.events);
|
||||
const gateRunner = new GateRunner(
|
||||
|
||||
Reference in New Issue
Block a user