@gotgenes/pi-permission-system 1.2.0 → 2.0.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 +35 -0
- package/LICENSE +1 -1
- package/README.md +4 -3
- package/package.json +1 -1
- package/src/index.ts +3 -78
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,41 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [2.0.0](https://github.com/gotgenes/pi-permission-system/compare/v1.2.1...v2.0.0) (2026-05-03)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### ⚠ BREAKING CHANGES
|
|
12
|
+
|
|
13
|
+
* the pi-permission-system:permission-request event channel is no longer emitted. No known consumers exist; the type was never exported. Re-adding with a proper public contract is tracked
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* add /build-plan prompt template for non-TDD plans ([e98f13c](https://github.com/gotgenes/pi-permission-system/commit/e98f13c2ef32f51edda58ea065635bef31365baa))
|
|
18
|
+
* delete permission-request event channel ([#20](https://github.com/gotgenes/pi-permission-system/issues/20)) ([6a41cfa](https://github.com/gotgenes/pi-permission-system/commit/6a41cfadc56e709d255538f63ff63d587e1b64f3))
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### Documentation
|
|
22
|
+
|
|
23
|
+
* plan delete permission-request event channel ([#20](https://github.com/gotgenes/pi-permission-system/issues/20)) ([e202350](https://github.com/gotgenes/pi-permission-system/commit/e2023509f9ab849f5a1d8bc28a5705b2898b912b))
|
|
24
|
+
* remove event channel from preserved-identity list ([#20](https://github.com/gotgenes/pi-permission-system/issues/20)) ([52299a2](https://github.com/gotgenes/pi-permission-system/commit/52299a27aeaed6e35849878fa224d8a78dcf0f6d))
|
|
25
|
+
* **retro:** add retro notes for issue [#22](https://github.com/gotgenes/pi-permission-system/issues/22) ([55629fe](https://github.com/gotgenes/pi-permission-system/commit/55629fed16b6d73b6d7b02698227e2adab7acd3e))
|
|
26
|
+
* update copyright in license ([b27994e](https://github.com/gotgenes/pi-permission-system/commit/b27994e7d67863ce8b28aa6bd680b60bc700d66d))
|
|
27
|
+
|
|
28
|
+
## [1.2.1](https://github.com/gotgenes/pi-permission-system/compare/v1.2.0...v1.2.1) (2026-05-03)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* **retro:** correct MD060 rule — column alignment, not separator spacing ([7f116b8](https://github.com/gotgenes/pi-permission-system/commit/7f116b884c03d9c346a640f306bca934b91214cd))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Documentation
|
|
37
|
+
|
|
38
|
+
* plan relax on-disk identity rule ([#22](https://github.com/gotgenes/pi-permission-system/issues/22)) ([d886862](https://github.com/gotgenes/pi-permission-system/commit/d886862a3686746f48e618ab2f950c7b1109d804))
|
|
39
|
+
* relax on-disk identity rule for config/log paths ([#22](https://github.com/gotgenes/pi-permission-system/issues/22)) ([352b103](https://github.com/gotgenes/pi-permission-system/commit/352b1038b1492b1f8222950edf4b6d093157128d))
|
|
40
|
+
* **retro:** add retro notes for issue [#19](https://github.com/gotgenes/pi-permission-system/issues/19) ([1d4a4a6](https://github.com/gotgenes/pi-permission-system/commit/1d4a4a6959905f102dea08273e7b827d8111a583))
|
|
41
|
+
* update README badges to match pi-autoformat style ([5c6ef1f](https://github.com/gotgenes/pi-permission-system/commit/5c6ef1fcfb2b6f5ee353765ebeeac7cdf09d2bbb))
|
|
42
|
+
|
|
8
43
|
## [1.2.0](https://github.com/gotgenes/pi-permission-system/compare/v1.1.0...v1.2.0) (2026-05-03)
|
|
9
44
|
|
|
10
45
|
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# 🔐 @gotgenes/pi-permission-system
|
|
2
2
|
|
|
3
|
-
[](LICENSE)
|
|
3
|
+
[](https://www.npmjs.com/package/@gotgenes/pi-permission-system) [](https://github.com/gotgenes/pi-permission-system/actions/workflows/ci.yml) [](https://opensource.org/licenses/MIT) [](https://www.typescriptlang.org/) [](https://pi.mariozechner.at/)
|
|
5
4
|
|
|
6
5
|
Permission enforcement extension for the Pi coding agent that provides centralized, deterministic permission gates for tool, bash, MCP, skill, and special operations.
|
|
7
6
|
|
|
8
|
-
> **Fork notice:** This package is a friendly fork of [MasuRii/pi-permission-system](https://github.com/MasuRii/pi-permission-system), published to npm as `@gotgenes/pi-permission-system`.
|
|
7
|
+
> **Fork notice:** This package is a friendly fork of [MasuRii/pi-permission-system](https://github.com/MasuRii/pi-permission-system), published to npm as `@gotgenes/pi-permission-system`.
|
|
8
|
+
> This fork diverges from upstream in config layout (#10).
|
|
9
|
+
> The `/permission-system` slash command name is preserved; the config and log paths are not.
|
|
9
10
|
|
|
10
11
|
## Features
|
|
11
12
|
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -79,26 +79,7 @@ const PERMISSION_FORWARDING_DIR = join(SESSIONS_DIR, "permission-forwarding");
|
|
|
79
79
|
|
|
80
80
|
const ACTIVE_AGENT_TAG_REGEX = /<active_agent\s+name=["']([^"']+)["'][^>]*>/i;
|
|
81
81
|
|
|
82
|
-
type
|
|
83
|
-
type PermissionRequestState = "waiting" | "approved" | "denied";
|
|
84
|
-
|
|
85
|
-
type PermissionRequestEvent = {
|
|
86
|
-
requestId: string;
|
|
87
|
-
source: PermissionRequestSource;
|
|
88
|
-
state: PermissionRequestState;
|
|
89
|
-
message: string;
|
|
90
|
-
toolCallId?: string;
|
|
91
|
-
toolName?: string;
|
|
92
|
-
skillName?: string;
|
|
93
|
-
path?: string;
|
|
94
|
-
command?: string;
|
|
95
|
-
target?: string;
|
|
96
|
-
toolInputPreview?: string;
|
|
97
|
-
agentName?: string | null;
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
const PERMISSION_REQUEST_EVENT_CHANNEL =
|
|
101
|
-
"pi-permission-system:permission-request";
|
|
82
|
+
type PermissionReviewSource = "tool_call" | "skill_input" | "skill_read";
|
|
102
83
|
const PATH_BEARING_TOOLS = new Set([
|
|
103
84
|
"read",
|
|
104
85
|
"write",
|
|
@@ -1347,24 +1328,11 @@ export default function piPermissionSystemExtension(pi: ExtensionAPI): void {
|
|
|
1347
1328
|
return `${prefix}-${Date.now()}-${Math.random().toString(36).slice(2, 10)}-${process.pid}`;
|
|
1348
1329
|
};
|
|
1349
1330
|
|
|
1350
|
-
const emitPermissionRequestEvent = (event: PermissionRequestEvent): void => {
|
|
1351
|
-
try {
|
|
1352
|
-
pi.events.emit(PERMISSION_REQUEST_EVENT_CHANNEL, event);
|
|
1353
|
-
} catch (error) {
|
|
1354
|
-
writeDebugLog("permission_request.event_emit_failed", {
|
|
1355
|
-
requestId: event.requestId,
|
|
1356
|
-
source: event.source,
|
|
1357
|
-
state: event.state,
|
|
1358
|
-
error: formatUnknownErrorMessage(error),
|
|
1359
|
-
});
|
|
1360
|
-
}
|
|
1361
|
-
};
|
|
1362
|
-
|
|
1363
1331
|
const reviewPermissionDecision = (
|
|
1364
1332
|
event: string,
|
|
1365
1333
|
details: {
|
|
1366
1334
|
requestId: string;
|
|
1367
|
-
source:
|
|
1335
|
+
source: PermissionReviewSource;
|
|
1368
1336
|
agentName: string | null;
|
|
1369
1337
|
message: string;
|
|
1370
1338
|
toolCallId?: string;
|
|
@@ -1399,7 +1367,7 @@ export default function piPermissionSystemExtension(pi: ExtensionAPI): void {
|
|
|
1399
1367
|
ctx: ExtensionContext,
|
|
1400
1368
|
details: {
|
|
1401
1369
|
requestId: string;
|
|
1402
|
-
source:
|
|
1370
|
+
source: PermissionReviewSource;
|
|
1403
1371
|
agentName: string | null;
|
|
1404
1372
|
message: string;
|
|
1405
1373
|
toolCallId?: string;
|
|
@@ -1413,38 +1381,10 @@ export default function piPermissionSystemExtension(pi: ExtensionAPI): void {
|
|
|
1413
1381
|
): Promise<PermissionPromptDecision> => {
|
|
1414
1382
|
if (shouldAutoApprovePermissionState("ask", extensionConfig)) {
|
|
1415
1383
|
reviewPermissionDecision("permission_request.auto_approved", details);
|
|
1416
|
-
emitPermissionRequestEvent({
|
|
1417
|
-
requestId: details.requestId,
|
|
1418
|
-
source: details.source,
|
|
1419
|
-
state: "approved",
|
|
1420
|
-
message: details.message,
|
|
1421
|
-
toolCallId: details.toolCallId,
|
|
1422
|
-
toolName: details.toolName,
|
|
1423
|
-
skillName: details.skillName,
|
|
1424
|
-
path: details.path,
|
|
1425
|
-
command: details.command,
|
|
1426
|
-
target: details.target,
|
|
1427
|
-
toolInputPreview: details.toolInputPreview,
|
|
1428
|
-
agentName: details.agentName,
|
|
1429
|
-
});
|
|
1430
1384
|
return { approved: true, state: "approved" };
|
|
1431
1385
|
}
|
|
1432
1386
|
|
|
1433
1387
|
reviewPermissionDecision("permission_request.waiting", details);
|
|
1434
|
-
emitPermissionRequestEvent({
|
|
1435
|
-
requestId: details.requestId,
|
|
1436
|
-
source: details.source,
|
|
1437
|
-
state: "waiting",
|
|
1438
|
-
message: details.message,
|
|
1439
|
-
toolCallId: details.toolCallId,
|
|
1440
|
-
toolName: details.toolName,
|
|
1441
|
-
skillName: details.skillName,
|
|
1442
|
-
path: details.path,
|
|
1443
|
-
command: details.command,
|
|
1444
|
-
target: details.target,
|
|
1445
|
-
toolInputPreview: details.toolInputPreview,
|
|
1446
|
-
agentName: details.agentName,
|
|
1447
|
-
});
|
|
1448
1388
|
|
|
1449
1389
|
const decision = await confirmPermission(ctx, details.message);
|
|
1450
1390
|
reviewPermissionDecision(
|
|
@@ -1457,21 +1397,6 @@ export default function piPermissionSystemExtension(pi: ExtensionAPI): void {
|
|
|
1457
1397
|
denialReason: decision.denialReason,
|
|
1458
1398
|
},
|
|
1459
1399
|
);
|
|
1460
|
-
emitPermissionRequestEvent({
|
|
1461
|
-
requestId: details.requestId,
|
|
1462
|
-
source: details.source,
|
|
1463
|
-
state: decision.approved ? "approved" : "denied",
|
|
1464
|
-
message: details.message,
|
|
1465
|
-
toolCallId: details.toolCallId,
|
|
1466
|
-
toolName: details.toolName,
|
|
1467
|
-
skillName: details.skillName,
|
|
1468
|
-
path: details.path,
|
|
1469
|
-
command: details.command,
|
|
1470
|
-
target: details.target,
|
|
1471
|
-
toolInputPreview: details.toolInputPreview,
|
|
1472
|
-
agentName: details.agentName,
|
|
1473
|
-
});
|
|
1474
|
-
|
|
1475
1400
|
return decision;
|
|
1476
1401
|
};
|
|
1477
1402
|
|