pi-permission-system 0.3.0 → 0.3.1

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 CHANGED
@@ -5,6 +5,20 @@ 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
+ ## [0.3.1] - 2026-03-24
9
+
10
+ ### Added
11
+ - Permission system status module (`status.ts`) to expose yolo mode status to the UI
12
+ - `syncPermissionSystemStatus()` function to sync status with the TUI status bar
13
+ - `PERMISSION_SYSTEM_STATUS_KEY` and `PERMISSION_SYSTEM_YOLO_STATUS_VALUE` constants for status identification
14
+
15
+ ### Changed
16
+ - Integrated status sync on config load, config save, and extension unload
17
+ - Status is only exposed when yolo mode is enabled
18
+
19
+ ### Tests
20
+ - Added test for permission-system status being undefined when yolo mode is disabled and "yolo" when enabled
21
+
8
22
  ## [0.3.0] - 2026-03-23
9
23
 
10
24
  ### Added
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # 🔐 pi-permission-system
2
2
 
3
- [![Version](https://img.shields.io/badge/version-0.3.0-blue.svg)](package.json)
3
+ [![Version](https://img.shields.io/badge/version-0.3.1-blue.svg)](package.json)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
5
5
 
6
6
  Permission enforcement extension for the Pi coding agent that provides centralized, deterministic permission gates for tool, bash, MCP, skill, and special operations.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pi-permission-system",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Permission enforcement extension for the Pi coding agent.",
5
5
  "type": "module",
6
6
  "main": "./index.ts",
package/src/index.ts CHANGED
@@ -29,6 +29,7 @@ import { PermissionManager } from "./permission-manager.js";
29
29
  import { sanitizeAvailableToolsSection } from "./system-prompt-sanitizer.js";
30
30
  import { checkRequestedToolRegistration, getToolNameFromValue } from "./tool-registry.js";
31
31
  import type { PermissionCheckResult, PermissionState } from "./types.js";
32
+ import { PERMISSION_SYSTEM_STATUS_KEY, syncPermissionSystemStatus } from "./status.js";
32
33
  import { canResolveAskPermissionRequest, shouldAutoApprovePermissionState } from "./yolo-mode.js";
33
34
 
34
35
  const PI_AGENT_DIR = join(homedir(), ".pi", "agent");
@@ -906,6 +907,10 @@ export default function piPermissionSystemExtension(pi: ExtensionAPI): void {
906
907
  const result = loadPermissionSystemConfig();
907
908
  setExtensionConfig(result.config);
908
909
 
910
+ if (runtimeContext?.hasUI) {
911
+ syncPermissionSystemStatus(runtimeContext, result.config);
912
+ }
913
+
909
914
  if (result.warning && result.warning !== lastConfigWarning) {
910
915
  lastConfigWarning = result.warning;
911
916
  notifyWarning(result.warning);
@@ -933,6 +938,7 @@ export default function piPermissionSystemExtension(pi: ExtensionAPI): void {
933
938
  }
934
939
 
935
940
  setExtensionConfig(normalized);
941
+ syncPermissionSystemStatus(ctx, normalized);
936
942
  lastConfigWarning = null;
937
943
 
938
944
  writeDebugLog("config.saved", {
@@ -1142,6 +1148,7 @@ export default function piPermissionSystemExtension(pi: ExtensionAPI): void {
1142
1148
  });
1143
1149
 
1144
1150
  pi.on("session_shutdown", async () => {
1151
+ runtimeContext?.ui.setStatus(PERMISSION_SYSTEM_STATUS_KEY, undefined);
1145
1152
  runtimeContext = null;
1146
1153
  stopForwardedPermissionPolling();
1147
1154
  });
package/src/status.ts ADDED
@@ -0,0 +1,20 @@
1
+ import type { ExtensionCommandContext, ExtensionContext } from "@mariozechner/pi-coding-agent";
2
+
3
+ import { EXTENSION_ID, type PermissionSystemExtensionConfig } from "./extension-config.js";
4
+ import { isYoloModeEnabled } from "./yolo-mode.js";
5
+
6
+ export const PERMISSION_SYSTEM_STATUS_KEY = EXTENSION_ID;
7
+ export const PERMISSION_SYSTEM_YOLO_STATUS_VALUE = "yolo";
8
+
9
+ type PermissionStatusContext = Pick<ExtensionContext, "hasUI" | "ui"> | Pick<ExtensionCommandContext, "ui">;
10
+
11
+ export function getPermissionSystemStatus(config: PermissionSystemExtensionConfig): string | undefined {
12
+ return isYoloModeEnabled(config) ? PERMISSION_SYSTEM_YOLO_STATUS_VALUE : undefined;
13
+ }
14
+
15
+ export function syncPermissionSystemStatus(
16
+ ctx: PermissionStatusContext,
17
+ config: PermissionSystemExtensionConfig,
18
+ ): void {
19
+ ctx.ui.setStatus(PERMISSION_SYSTEM_STATUS_KEY, getPermissionSystemStatus(config));
20
+ }
package/src/test.ts CHANGED
@@ -13,6 +13,7 @@ import {
13
13
  } from "./permission-forwarding.js";
14
14
  import { PermissionManager } from "./permission-manager.js";
15
15
  import { checkRequestedToolRegistration, getToolNameFromValue } from "./tool-registry.js";
16
+ import { getPermissionSystemStatus } from "./status.js";
16
17
  import type { GlobalPermissionConfig } from "./types.js";
17
18
  import { canResolveAskPermissionRequest, shouldAutoApprovePermissionState } from "./yolo-mode.js";
18
19
 
@@ -198,6 +199,14 @@ runTest("Yolo mode resolves ask permissions without UI or delegation forwarding"
198
199
  );
199
200
  });
200
201
 
202
+ runTest("Permission-system status is only exposed when yolo mode is enabled", () => {
203
+ assert.equal(getPermissionSystemStatus(DEFAULT_EXTENSION_CONFIG), undefined);
204
+ assert.equal(
205
+ getPermissionSystemStatus({ ...DEFAULT_EXTENSION_CONFIG, yoloMode: true }),
206
+ "yolo",
207
+ );
208
+ });
209
+
201
210
  runTest("Permission-system logger respects debug toggle and keeps review log enabled by default", () => {
202
211
  const baseDir = mkdtempSync(join(tmpdir(), "pi-permission-system-logs-"));
203
212
  const logsDir = join(baseDir, "logs");