mirror of
https://bitbucket.org/siakitem/my-pi.git
synced 2026-10-26 10:45:22 +00:00
36 lines
890 B
TypeScript
36 lines
890 B
TypeScript
import type {
|
|
ExtensionCommandContext,
|
|
ExtensionContext,
|
|
} from "@earendil-works/pi-coding-agent";
|
|
|
|
import {
|
|
EXTENSION_ID,
|
|
isYoloModeEnabled,
|
|
type PermissionSystemExtensionConfig,
|
|
} from "./extension-config";
|
|
|
|
export const PERMISSION_SYSTEM_STATUS_KEY = EXTENSION_ID;
|
|
export const PERMISSION_SYSTEM_YOLO_STATUS_VALUE = "yolo";
|
|
|
|
type PermissionStatusContext =
|
|
| Pick<ExtensionContext, "hasUI" | "ui">
|
|
| Pick<ExtensionCommandContext, "ui">;
|
|
|
|
export function getPermissionSystemStatus(
|
|
config: PermissionSystemExtensionConfig,
|
|
): string | undefined {
|
|
return isYoloModeEnabled(config)
|
|
? PERMISSION_SYSTEM_YOLO_STATUS_VALUE
|
|
: undefined;
|
|
}
|
|
|
|
export function syncPermissionSystemStatus(
|
|
ctx: PermissionStatusContext,
|
|
config: PermissionSystemExtensionConfig,
|
|
): void {
|
|
ctx.ui.setStatus(
|
|
PERMISSION_SYSTEM_STATUS_KEY,
|
|
getPermissionSystemStatus(config),
|
|
);
|
|
}
|